← Back to context Comment by rrrx3 19 hours ago https://github.com/enterprisequalitycoding/fizzbuzzenterpris... 18 comments rrrx3 Reply embedding-shape 19 hours ago On the other spectrum, shortest JS fizzbuzz (62 characters): for(i=0;++i<101;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz' Anyone can beat it? (any language accepted) NitpickLawyer 19 hours ago Perl6: say "Fizz"x$_%%(2+1)~"Buzz"x$_%%(4+1)||$_ for 1..100from here - https://github.com/rsha256/shortest-fizzbuzz/blob/master/Per... danbruc 18 hours ago Why does this use 2+1 and 4+1 instead of 3 and 5? chrisguilbeau 19 hours ago LLM: wrt frst 100fizzbuzz embedding-shape 19 hours ago Actually kind of curious challenge; what's the shortest prompt you can use, which would produce the shortest possible fizzbuzz?Edit: counting including the entire assistant reply, any text + code 7 replies → wilkystyle 19 hours ago Python:[(x%3<1)*'Fizz'+(x%5<1)*'Buzz'or x for x in range(1,101)]edit: Hacker News stripped the * character. Now it's properly escaped. gilleain 18 hours ago >>> len("[(x%3<1)'Fizz'+(x%5<1)'Buzz'or x for x in range(1,101)]")57 winrid 19 hours ago you can flip it and save a few bytes, but not valid fizzbuzz then:for(i=100;i--;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz' embedding-shape 19 hours ago > but not valid fizzbuzz thenWell, if we let that requirement be broken, I'll present an even shorter JS version: 1 1 reply →
embedding-shape 19 hours ago On the other spectrum, shortest JS fizzbuzz (62 characters): for(i=0;++i<101;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz' Anyone can beat it? (any language accepted) NitpickLawyer 19 hours ago Perl6: say "Fizz"x$_%%(2+1)~"Buzz"x$_%%(4+1)||$_ for 1..100from here - https://github.com/rsha256/shortest-fizzbuzz/blob/master/Per... danbruc 18 hours ago Why does this use 2+1 and 4+1 instead of 3 and 5? chrisguilbeau 19 hours ago LLM: wrt frst 100fizzbuzz embedding-shape 19 hours ago Actually kind of curious challenge; what's the shortest prompt you can use, which would produce the shortest possible fizzbuzz?Edit: counting including the entire assistant reply, any text + code 7 replies → wilkystyle 19 hours ago Python:[(x%3<1)*'Fizz'+(x%5<1)*'Buzz'or x for x in range(1,101)]edit: Hacker News stripped the * character. Now it's properly escaped. gilleain 18 hours ago >>> len("[(x%3<1)'Fizz'+(x%5<1)'Buzz'or x for x in range(1,101)]")57 winrid 19 hours ago you can flip it and save a few bytes, but not valid fizzbuzz then:for(i=100;i--;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz' embedding-shape 19 hours ago > but not valid fizzbuzz thenWell, if we let that requirement be broken, I'll present an even shorter JS version: 1 1 reply →
NitpickLawyer 19 hours ago Perl6: say "Fizz"x$_%%(2+1)~"Buzz"x$_%%(4+1)||$_ for 1..100from here - https://github.com/rsha256/shortest-fizzbuzz/blob/master/Per... danbruc 18 hours ago Why does this use 2+1 and 4+1 instead of 3 and 5?
chrisguilbeau 19 hours ago LLM: wrt frst 100fizzbuzz embedding-shape 19 hours ago Actually kind of curious challenge; what's the shortest prompt you can use, which would produce the shortest possible fizzbuzz?Edit: counting including the entire assistant reply, any text + code 7 replies →
embedding-shape 19 hours ago Actually kind of curious challenge; what's the shortest prompt you can use, which would produce the shortest possible fizzbuzz?Edit: counting including the entire assistant reply, any text + code 7 replies →
wilkystyle 19 hours ago Python:[(x%3<1)*'Fizz'+(x%5<1)*'Buzz'or x for x in range(1,101)]edit: Hacker News stripped the * character. Now it's properly escaped. gilleain 18 hours ago >>> len("[(x%3<1)'Fizz'+(x%5<1)'Buzz'or x for x in range(1,101)]")57
winrid 19 hours ago you can flip it and save a few bytes, but not valid fizzbuzz then:for(i=100;i--;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz' embedding-shape 19 hours ago > but not valid fizzbuzz thenWell, if we let that requirement be broken, I'll present an even shorter JS version: 1 1 reply →
embedding-shape 19 hours ago > but not valid fizzbuzz thenWell, if we let that requirement be broken, I'll present an even shorter JS version: 1 1 reply →
On the other spectrum, shortest JS fizzbuzz (62 characters):
Anyone can beat it? (any language accepted)
Perl6: say "Fizz"x$_%%(2+1)~"Buzz"x$_%%(4+1)||$_ for 1..100
from here - https://github.com/rsha256/shortest-fizzbuzz/blob/master/Per...
Why does this use 2+1 and 4+1 instead of 3 and 5?
LLM: wrt frst 100fizzbuzz
Actually kind of curious challenge; what's the shortest prompt you can use, which would produce the shortest possible fizzbuzz?
Edit: counting including the entire assistant reply, any text + code
7 replies →
Python:
[(x%3<1)*'Fizz'+(x%5<1)*'Buzz'or x for x in range(1,101)]
edit: Hacker News stripped the * character. Now it's properly escaped.
>>> len("[(x%3<1)'Fizz'+(x%5<1)'Buzz'or x for x in range(1,101)]")
57
you can flip it and save a few bytes, but not valid fizzbuzz then:
for(i=100;i--;console.log(i%5?f||i:f+'Buzz'))f=i%3?'':'Fizz'
> but not valid fizzbuzz then
Well, if we let that requirement be broken, I'll present an even shorter JS version:
1 reply →