Those two solutions are neat.
Searching around for tips for code golfing in Julia, on the Code Golf StackExchange came across discussion for this problem. From the discussion it appears there is a 60char/bye solution using
repr and there is a 59char/byte solution using
another whacky one (65)
Well for what its worth I freed up one char/byte on
f="Fizz";b="Buzz";1:100 .|>i->println([i i f f*b b][gcd(i,15)%11])
Does it have to be short, or just weird:
t=1:100;t.|>println∘x->["$x","Fizz","Buzz","FizzBuzz"][Dict([1 3 5 0].*t.=>[1 2 3 4])[x%15]]
Weird examples are certainly welcome. I’m sure they could get pretty weird, I really want to crack that 59 char/byte solution though.
This one is cool
This one is both weird and breaks all barriers (but of dubious correctness):
This is very cool
\b gives something visually almost correct
another hint from the leaderboard is that the smallest solution is 59bytes/59chars, so no unicode trickeries.
But there’s a shorter solution with 61bytes/57chars which may imply the use of
It has me pretty stumped, I’ve been working on it in-between writing stuff for my thesis.
I feel you xD
I have so many solutions 1byte from best on that website…it drives me crazy
The most frustrating is when an idea seems potentially it then realize you’re at 61+ char/bytes haha.
If the approach is different share it even though is not the shortest one. Someone else could find a way to make it work
The primary different approach I have tried is to use something like
"$x FizzBuzz"[start condition:end condition] or another variation because besides using
max to compare strings
"Fizz^(x%x<1)*"Buzz"^(x%5<1) not sure how using
"$x" would help–given that at least one of the 59char/byte solutions involves using that interpolation.
the problem is that “$x” length will change, so a unique start condition is tricky…
on that line I have a 64
/ =gcd;1:100 .|>n->println(max("FizzBuzz"[7-2(3/n):3+5/n],"$n"))
Yeah that’s why I abandoned that approach.
That is a neat solution
putting together various ideas that appeared in previous posts …
oddly this type of solution works correctly in the Julia REPL but if plugging in here Fizz Buzz it doesn’t.
in fact, it seemed too within the reach of previous posts to be overlooked
this is printing both digits and “fizz”/“buzz” instead of skipping either
also, code.golf checks the solution verbatim, thus
it would have been nice to beat the record by 2 tho!
So I know there is a 60 char/byte solution that uses
repr and I got a 61byte/char so maybe analyzing it can give a hint how they got the 60 byte/char.