12:00 PM
I get 5 bytes for Jelly, İS÷@L

for the harmonic mean one: is lambda l:3/sum(i**-1 for i in l) correct?

1/i is shorter

only for lists with 3 elements is it correct @totallyhuman

-2

I have a generic wrapper type: public class Wrap<T> { public T Contents { get; set; } } I can wrap any object in a wrap or unwrap a wrapped object: public static class WrapHelpers { public static Wrap<T> Wrap<T>(this T contents) { return new Wrap<T> { Contents = contents }; ...

@LeakyNun is it possible in just 4 bytes?

12:02 PM
replace 3 with len(l) and you're good @totallyhuman
@KritixiLithos it = ?

ohhhh
sorry i just looked it up on wikipedia :P

@LeakyNun the Jelly program to your first CMC
@LeakyNun Dyalog APL, ↑,\

@KritixiLithos I don't think it is

formatting borked, it is 3 bytes in APL

@KritixiLithos nice
should I post my second one on main?

12:05 PM
yes

@LeakyNun Charcoal, 8 bytes: ＳαＧ↘←Ｌαα

the first one, if it isn't already a duplicate, can wait if you want to post it. Let's not have too many alphabet challenges together again
I get 7 bytes in Retina: Try it online!
with two trailing newlines
s/8/7/

CMC: given positive integers a and n, apply the collatz function on a, n times.

btw I was talking about his earlier CMC

user165474
12:11 PM
@EriktheOutgolfer lol that's exactly what I did

user165474
like -2 mins

user165474
you can FGITW i'm going for a bounty right now

what bounty?

nobody is getting my 3-byte answer
@EriktheOutgolfer try to use my style in the abcab CMC

@LeakyNun JavaScript, 33 bytes: f=(a,n)=>n--?f(a%2?a*3+1:a/2,n):a

12:14 PM
19 mins ago, by Leaky Nun
CMC: harmonic mean of a list of positive floats

@LeakyNun oh, you mean something like this?

@ASCII-only use curry to save bytes

@KritixiLithos huh?

@EriktheOutgolfer precisely

Anonymous

@KritixiLithos Doesn't save bytes

@EriktheOutgolfer Leaky said "I don't think it is" to my message about doing that CMC I posted and not the newer CMC

oh I was confused...

@ASCII-only oh it's a recursive

@KritixiLithos seems impossible to bring under 5

user165474
12:19 PM
I got İSİ×L but I don't think I can get it any lower.

Time ti try it I guess

@HyperNeutrino you must at least (afaict) have 1 arithmetic operator, 2 reciprocals, 1 sum and 1 length, those sum up to 5, so I don't think you can get it any lower

user165474
True. Yeah I think it's not possible then.

coincidentally, those 5 are all 1-byte atoms

user165474
well actually

12:21 PM
CMC: define a bijective function from the natural numbers to itself, such that the image of the even numbers under that function is a proper subset of the even numbers

user165474
Kritixi did it using reciprocal -> sum -> division [reversed] -> length

[reversed] corresponds to reciprocal

user165474
@LeakyNun ??? So that means that some even numbers have to be mapped to odd numbers? Or am I being dumb

user165474
@EriktheOutgolfer not quite but I guess

user165474
well it does the same thing ¯\_(ツ)_/¯

12:22 PM
the reciprocal of a / b is b / a that's why

@HyperNeutrino Some odd numbers need to map to even numbers

user165474
What do you mean by image? I think I get what it means but I'm not sure based on your last message.

user165474
@EriktheOutgolfer whoops >_< I'm just being dumb today always don't mind me

f[B] subset B, where B is the set of even numbers

12:24 PM
Would f=B=>B+1 work?

f[B] means {f(b) : b in B}

user165474
Oh okay that makes sense thanks

what does f[B] mean?

@KritixiLithos the image of the even numbers is the odd numbers, which is not a subset of the even numbers

user165474
32 secs ago, by Leaky Nun
f[B] means {f(b) : b in B}

12:25 PM
@KritixiLithos 2 messages above you

@LeakyNun f(x ∈ B) = x?
where B is the set of even numbers

@EriktheOutgolfer proper subset

user165474
Wait so how is it possible to make it bijective then... nvm there are infinite elements

user165474
f(x) = x^2? random guess

what does a proper subset mean?

12:27 PM
:37966206 that's left to you
@HyperNeutrino not bijective

@HyperNeutrino not bijective

@KritixiLithos subset but not equal

@LeakyNun that's what happens when you reply to a removed message I guess :P

user165474
hm

@Mego thanks for taking the time to prove that js is pretty dumb in some cases

user165474
12:28 PM
Wait how so not

Anonymous
@Mayube It's less JS and more IEEE-754 floats. But JS is dumb for only using doubles.

user165474

@HyperNeutrino bijective is injective and surjective

user165474

user165474
12:29 PM
@LeakyNun which one is which again? I can't remember >_<

@HyperNeutrino It has to be a 1:1 mapping

user165474
Oh wait I ... nvm just being dumb

@Mego I suspect that the issue may still be due to IEEE-754 floats storing the exponent in only 52 bytes, but js doesn't shorten the number at all as it tends to do for larger numbers, so I'm not sure

@HyperNeutrino what is mapped to 2?

user165474
Ok I see.

12:30 PM
@LeakyNun f(x ∈ B) = x + x mod 2 * 2 - 2
does this count as proper subset?

user165474
CMC: Given a group G and an element a in G and a positive integer k, determine if the cyclic subgroups generated by a and a^k are equal. You may assume that |<a>| is finite.

@EriktheOutgolfer Wait this isn't bijective nothing maps to the odd numbers

user165474
And an operator f as a function (though theoretically you don't need this btw)

@HyperNeutrino basically "is k coprime with the order of a?"

user165474
Does such a mapping exist?

user165474
12:31 PM
@LeakyNun darn you're too fast

user165474
:P

user165474
yeah that's what the problem reduces down to

@HyperNeutrino yes of course

Anonymous
@Mayube No, JS follows the IEEE-754 standard. The standard is the issue - accuracy of computations decreases with the size of the input(s). After 2**53-1, not every integer is representable, so that fact can be (ab)used to find values n where (n**.5)**2 != n. That is true in any language that uses IEEE-754 floats.

user165474
ok just wondering :p

12:32 PM
@HyperNeutrino yeah his speed can be too fast sometimes

@EriktheOutgolfer what does f(x in B) mean?

user165474
@EriktheOutgolfer Wait so if his speed is too fast, then his speed has a high speed, which means he has a good acceleration rate? :p

possibly...
@LeakyNun am I required to allow odd numbers too?

@Mego right but surely in that case it can then be said that those n values are not accurately representable by the language, and thus not valid inputs?

@EriktheOutgolfer of course

user165474
12:33 PM
@EriktheOutgolfer "Bijective function from the natural numbers to itself"

@HyperNeutrino does F=x=>x+2 work?

user165474
What maps to 1?

user165474
Not a natural number

Anonymous
@Mayube In the case of 2**54-2, it is representable within the language, but ((2**54-2)**.5)**2 is not, so the inaccuracy causes incorrect results.

12:34 PM
@LeakyNun hmm, then it's more complicated than that...

user165474
Also, proper subset. :P

@Mego hmm alright, I'll leave my answer as deleted then

user165474

user165474
?

user165474
Or is 0 in N

12:36 PM
@LeakyNun Does this count: n=>n%2?n===1?0:n-2:n+2 :P

@HyperNeutrino up to you

user165474
yay

user165474
@ASCII-only What does 1 map to?

@LeakyNun you say that the image of the set of even numbers under the function must be a proper subset of them, while you also say that some odd numbers must map to even numbers, while the function is bijective. then, though, since the function is bijective, the even numbers resulting from odd numbers must return the odd numbers, however this violates the image rule...impossible?

@HyperNeutrino 0 of course

Anonymous
12:37 PM
@Mayube Clearly the solution is to use a language that uses symbolic computation :P

user165474
oh wait I forgot about the extra ternary

Wait 0 isn't a natural number whoops

Anonymous
Bonus points if that language has a builtin that is short... Say, 9 bytes or so?

@ASCII-only it is actually

user165474
@ASCII-only It's up to you whether or not it is

12:38 PM
and @ASCII-only is the winner

user165474
congrats! :D :P

user165474
ok anyway I'm going back to work cya o/

@EriktheOutgolfer how does that violate the image rule?
the rule is that even number -> even number
some odd numbers also -> even number
just that no even number -> odd number

how would it be bijective then?

n=>n%2?n%4===1?n+1:(n+1)/4:n*2 should work as well?

12:41 PM
it is surjective and injective

f=n=>n%2?n%4===1?n+1:(n+1)/4:n*2;
Array(25).fill().map((_, n)=>f(n))

@LeakyNun oh you mean that every result is only mapped to by one natural number, and that one natural number doesn't map to any other results?
but not necessarily f(f(x)) = x?

@EriktheOutgolfer Yeah, 1:1 mapping

@EriktheOutgolfer f f x = x is involution...

yeah...
*really giant facepalm*

12:44 PM
why would bijection imply involution...

what are you guys talking about?

@LeakyNun btw those terms always confused me

@orlp define bijective f:N->N such that f[2N] is a proper subset of 2N

2N is the set of even numbers?

yes

12:45 PM
and N = N0 or N+ here?

@LeakyNun wait would f(x) = 2x work then?

@EriktheOutgolfer not surjective
@orlp up to you

@LeakyNun huh? any example?

@EriktheOutgolfer that is only injective
@EriktheOutgolfer what is mapped to 1?

2
and what is mapped to 2? 4
oh wait that isn't surjective?

12:47 PM
@EriktheOutgolfer 1 is mapped to 2 in your function, not the other way round

@LeakyNun I don't believe it's possible to have it be a proper subset
every even number must still be even after f has been applied

@ASCII-only Leaky said not necessarily involution though

@orlp continue

actually never mind

@LeakyNun oh I see what you mean

12:48 PM
@orlp scroll above for a solution

no

@ASCII-only here @orlp

@LeakyNun I said I didn't want to see it

oh sorry

f(n) = 2^n if n is even, otherwise smallest positive value not taken by any f(k) with k < n

12:50 PM
@LeakyNun btw idk if this is also valid

@orlp good but not golfy

@LeakyNun so...surjective means that if f(N) returns N then all inputs must correspond to all numbers in N?

@EriktheOutgolfer surjective only means that f(N)=N, dunno wt the conditonal means

@LeakyNun oh so f(x) = 2x is f(N)=2N not f(N)=N which is not surjective right?

@EriktheOutgolfer correct

12:52 PM
and I can't use bitwise xor either, since f(2N) must return a number in 2N

@LuisMendo matl ftw=)

f(n) = 2*n if n is even, otherwise n+1 - ceil((n+1)/3) + 1

would f=n=>n%2?n-1:n+1 work?

@KritixiLithos No, even numbers don't map to a proper subset of even numbers

which can be simplified
f(n) = 2*n if n is even, otherwise n - floor(n/3) + 3

12:56 PM
so the set of even numbers have to map to the set of even numbers?

@LeakyNun Wait it has to be golfy? 18 bytes, ES6
@KritixiLithos Yes but not every even number so e.g. an odd number must map to 0, or maybe every number divisible by 4

of course it has, we're golfers here

eh actually my 'answer' is broken
@LeakyNun ok looking at that solution it's not that interesting =/
that's just removing 1 element to get the subset

17 mins ago, by ASCII-only
f=n=>n%2?n%4===1?n+1:(n+1)/4:n*2;
Array(25).fill().map((_, n)=>f(n))
This is slightly less boring but still super simple

@orlp nobody said it had to be interesting
it just has to be golfy

12:59 PM
@LeakyNun then make it a popcon :D

every popcon is closed

how can a CMC be closed?

alright, it's a popcon then

Anonymous
@orlp I can show you if you really want :P

@EriktheOutgolfer f[2N] is a set, so "f(2N) must return a number" is nonsense false

Anonymous
1:01 PM
-> 1 CMC moved to Trash

wow

@Mego please don't, this is actually a good cmc

@EriktheOutgolfer he's just joking

I believe he's joking people

@Mego looking for this symbol →?

1:02 PM
@LeakyNun ikr what do you think I'm serious?

@LeakyNun Python 2, 27 bytes: lambda x:x%2and x-x/2or x*2 (x/2 is the same as floor(x/2))

@KritixiLithos You've got your APL keyboard always on, right?
8

@EriktheOutgolfer what does 2 and 7 return, respectively?

@EriktheOutgolfer Not valid

1:06 PM
oh injection fail

@Adám Well I use WinCompose for that

I don't know why people starred it, but it got 3 stars, so I gotta star it.
9

@LeakyNun that is how starring here works in general.

@Adám most of the times the APL keyboard is on, occasionally I switch to a keyboard more suitable for V/Jelly while golfing (this time I had Jelly).

@KritixiLithos you do actually have an APL keyboard?

1:09 PM
yes, I installed an APL keyboard layout
It's very useful

@LeakyNun Python 2: lambda n:(2*n+n%2)/(1+n%2*2)

@KritixiLithos so that's why you can post those carrots so easily

user165474
CMC: Make a program with at least 2 bytes that when given dimension x will output that code new-line delimited to fit inside a rectangle of width x with each line as wide as possible. Tokens and identifiers may be split over a line.

:| Charcoal has no newline

1:13 PM
o0

user165474
(you may assume that if l is the length of your program that 0 < x <= l

@HyperNeutrino I don't understand the CMC

user165474
Let's say you have program abcdef

user165474
Then if given input 1, it gives:

user165474
a
b
c
d
e
f

user165474
1:13 PM
If given input 2:

user165474
ab
cd
ef

user165474
If given input 3:

user165474
abc
def

So the result doesn't have to be a valid program right?

user165474
no

user165474
1:13 PM
If given input 4:

O_O

@LeakyNun remember those modular power towers?

user165474
abcd
ef   < You may optionally have spaces here but not necessarily

-1

Background Hello golfers! I would like to learn all the programming languages! But I kinda have a short attention span... and copying all the Hello World examples gets boring... but I like fire! ^w^ Challenge So here is the plan! I want you all to write the smallest code that will compile, pr...

@NewMainPosts i'm not sure how to react to that challenge

1:14 PM
Oh no Charcoal can't do this very golfily

@orlp yes?

2

Given an infinite sequence $a_1, a_2, \dots$ where all $a_i > 1$ we study $a_1^{\,a_2^{\,\cdots}} \bmod m$. While this is an infinite power tower that grows without bound, I argue that it can be assigned a value. If $f(n)$ is the power tower with the first $n$ terms of $a$, there is a constant $c... maybe you can think of a counterexample :) @HyperNeutrino CJam, 15 bytes: {"_~"]sri/N*}_~ basically by writing an infinite sequence as a power tower then taking that power tower mod 1, mod 2, mod 3, etc... we get another infinite sequence is this operation injective? user165474 :o that is cool 1:17 PM$a_1$maps to$a_1^{{a_2}^{...}} mod 1$right? no this mapping applies to the sequence as a whole if b = MPT(a) then you are right that b_1 = a_1^{a_2}^{...} mod 1 Unique for all inputs = unique for all valid input sequences? @orlp just let$a_1=6$and see that$\operatorname{MPT}(a)(2) = \operatorname{MPT}(a)(3) = 0$. @LeakyNun I don't understand, can you elaborate? CMC: Port jQuery to your language js: 0 bytes  1:26 PM Holy hell, I made it to the top of the HNQ with my first challenge! :o @orlp I mean, if$a_1=6$, then$b_2 = b_3 = 0\$, right?
@Shaggy congrats

@Shaggy 24 answers in 2 hours is pretty good

@HyperNeutrino Jelly, 13 bytes: “v0¡µṾ;ḢsƓY”v

@LeakyNun Python, 38 bytes: def f(x):y=x-x%2;return y+y%4*-2+2+x%2

@LeakyNun yes

1:27 PM
@orlp so it isn't injective

@LeakyNun no, the question is whether MPT is injective
with input domain the set of all infinite sequences of integers > 1

@orlp wow, meta.

@Shaggy it's not that hard to get a ~trivial, decent PPCG challenge a ton a hotness points

^ true

and output domain a set of infinite sequences of nonnegative integers

1:28 PM
@orlp so it is in some sense N^N -> N^N...

@StephenS Let me have my moment! :p :D

@LeakyNun can you find two distinct infinite sequences such that after application of MPT they have the same output?
that's the question

I can't.

@LeakyNun is my function valid?
it seems to be bijective and following your image rule

@Shaggy well... I might, but my challenge was on top of HNQ before you came along xD

1:30 PM
oh wait...is it a proper subset though?

@EriktheOutgolfer it isn't.

yeah just realized

@StephenS Oops, sorry!

@Shaggy it's no problem, just being persnickety :)

@LeakyNun damn this cmc is hard

1:32 PM
@EriktheOutgolfer you just need to have the right intuition

Hmm I wonder whether not getting a design has something to do with all the work hours PPCG wastes :P or maybe the number of questions it has on HNQ

I think I've come closer to the solution though
if that's the intuition

Shout out to @Arnauld for that time he implemented the entire MD2 hashing algorithm into his JS answer to my first ever challenge :P
@ASCII-only or maybe we're just not active enough

0

I have a challenge that I posted which I'd like to put on hold while I refine it in sandbox. Is this possible? I don't want to delete it because I'd like to recycle bits of it, and I'm guessing if it's deleted then I'll lose the work I've done/ there will be a time limit on how long I can still ...

@LeakyNun does this count as a proper subset?
lambda x:x%2and max(x-2,0)or x+2
generally, if x is even, it returns x+2, if x is 1 it returns 0 otherwise it returns x-2
might be able to shorten though...

1:37 PM
does not return 0 for x=1 because of the or
in general, you only need and ... or if you need short-circuiting.

@LeakyNun as I said above, not ready yet, but you get the idea
of course I can use a ternary or even some math

So lambda x:[x+2,max(x-2,0)][x%2] fixes the problem and is shorter

@EriktheOutgolfer Just port this

hmm...

1:40 PM
lambda x:max(x+x%2*-4+2,0)

Would a programming language based on Wang tiles work?
Since they're turing complete?

@EriktheOutgolfer wonderful

@PyRulez Yes
@EriktheOutgolfer lambda n:max(n+2-4*n%8,0) or lambda x:max(x-x%2*4+2,0) should work

I already figured out second one...
...it's just that 2.5 minutes already passed

How are meta key strokes counted? is M-^ one, two or three bytes?

1:47 PM
@LeakyNun of course this is 9 bytes in Jelly hehe
so I guess I'm the new winner?

lol

@EriktheOutgolfer But it's a popcon

is there a tag anywhere?

48 mins ago, by Leaky Nun
alright, it's a popcon then

oh sneaky...yet it seems that my function is coincidentally same as yours, only a bit more math involved, and more math involved means more interesting, so I'm still the new winner...

1:50 PM
@EriktheOutgolfer A bit more math?

yeah, it uses max instead of ternary for n=1
basically it doesn't check for n=1 at all

@flawr Well, there is an APL keyboard (software layout) and an APL keyboard:

:37968592 Oh no it's 1 byte longer

@ASCII-only this is the fixed version, still 1 byte longer
even though you can compute x <= 1 in 1 byte, here you need x == 1 since for input 0 behavior is different