Both "code fizzbuzz" and just "fizbuz" gave this longer python one-liner
print('\n'.join("Fizz"*(i%3==0)+"Buzz"*(i%5==0) or str(i) for i in range(1, 101)))
That's the magic of using a known problem, you don't need to write much and even with incomplete prompts it can be understood. Everything a different new chat in kimi.ai, which was the AI window that I found first among mine.
Not interesting enough, to me, to try with other LLMs or phrases.
Whenever I try those short prompts, I get bunch of text + the code itself, but way more than just the code. Which model specifically are you doing this with?
Update: this is because ChatGPT was cheating and reading my conversation history. The closest I can get on a standard LLM is golffizbuz (10 characters)
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
"golf fizbuz" works well, giving a 54 Python one
"golf fizzbuzz" gave a 46 perl one
Both "code fizzbuzz" and just "fizbuz" gave this longer python one-liner
That's the magic of using a known problem, you don't need to write much and even with incomplete prompts it can be understood. Everything a different new chat in kimi.ai, which was the AI window that I found first among mine.
Not interesting enough, to me, to try with other LLMs or phrases.
Whenever I try those short prompts, I get bunch of text + the code itself, but way more than just the code. Which model specifically are you doing this with?
2 replies →
My attempt:
> Prompt: mkfzbuzgolf
> LLM Used: Default ChatGPT free LLM
> Output: for i in range(1,101):print("Fizz"*(i%3<1)+"Buzz"*(i%5<1)or i)
So, 11 prompt characters and 62 output.
——-
Did a few more tries and I can get the 4-character string “glfz” (2 tokens) to work surprisingly consistently. But only on ChatGPT
Update: this is because ChatGPT was cheating and reading my conversation history. The closest I can get on a standard LLM is golffizbuz (10 characters)
"100fizzbuzz" as the prompt works to satisfys fizz buzz to 100 on Claude.