https://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/
There was another great satirical take on FizzBuzz which had something to do with runes and incantation and magical spells...? I sort of remember that the same author maybe even wrote a follow up? to this extremely experienced developer solving FizzBuzz in the most arcane way possible. Does this ring a bell for anyone? --- Found it! https://aphyr.com/posts/340-reversing-the-technical-intervie... https://aphyr.com/pos…
Solving Fizz Buzz with Cosines
61–69 of 69 posts
Re: Solving Fizz Buzz with Cosines
#62Earlier quoted context omitted.
> LMAOOOOO OKAY SO THE POLYNOMIAL IS LITERALLY SHITTING ITSELF That was a fun read, but I can see that persona quickly becoming wearing. I had a "talk like a wiki article" persona for a while that worked better (for me) than any attempt to inject personality. The greyer the better, when it comes to tools. (Being a child of the internet rather than the classroom my abusive solution would be to look up the sequence in…
Yes, it's indeed very over the top and one-dimensional. However, I've been iterating on this system prompt since the early early days of chatgpt.com, and I find that I can't really chat with AI systems in their "grey", dry mode anymore. On their default behavior they try too hard to make me like them, which I find intolerable. "You're absolutely right!" for some reason drives me insane; getting "lmaaoooo my bad fam i…
Yeah, that's what I was trying to avoid, too. Why do we have such strong negative reactions to sycophancy? I went for something like: "You are a maximally terse assistant with minimal affect. Be detailed and complete, but brief."
Re: Solving Fizz Buzz with Cosines
#63Made me envision this terrible idea. arr = []; y = 0; setInterval(()=>{arr[y]=x},10) setInterval(()=>{x=y++},1000) setInterval(()=>{x="fizz"},3000) setInterval(()=>{x="buzz"},5000) setInterval(()=>{x="fizzbuzz"},15000)
Re: Solving Fizz Buzz with Cosines
#64I wonder where this is coming from. I saw on USENET in comp.os.linux.misc a conversation about fizzbuzz too. That was on Nov 12. Anyway an interesting read.
You saw a Usenet post on Nov 12? 2025?
Re: Solving Fizz Buzz with Cosines
#65What a neat trick. I'm thinking you can abuse polynomials similarly. If the goal is to print the first, say, 100 elements, a 99-degree polynomial would do just fine :^) EDIT: the llm gods do recreational mathematics as well. claude actually thinks it was able to come up with and verify a solution... https://claude.ai/share/5664fb69-78cf-4723-94c9-7a381f947633
Re: Solving Fizz Buzz with Cosines
#66Earlier quoted context omitted.
A massively over-engineered, incorrect solution?
A candidate that appreciates the value of the question, yet won't subject themselves to the absurdity of demonstrating compliance. Yes, very much yes.
Re: Solving Fizz Buzz with Cosines
#67What a neat trick. I'm thinking you can abuse polynomials similarly. If the goal is to print the first, say, 100 elements, a 99-degree polynomial would do just fine :^) EDIT: the llm gods do recreational mathematics as well. claude actually thinks it was able to come up with and verify a solution... https://claude.ai/share/5664fb69-78cf-4723-94c9-7a381f947633
Oh man. This system prompt is everything I'm looking for in my coding agents. This shit should be fun. Let it be fun!
This is orthogonal to the style, still, if it realizes that it can use Python's arbitrary precision integers instead of floats then the problem becomes absolutely trivial. Fast, and numerically stable.
Re: Solving Fizz Buzz with Cosines
#68* Generate a tuple from 1 to 1000 and name it 'Sequence'
tuple_gen_sequence (1, 1000, 1, Sequence)
* Replace elements in 'Sequence' divisible by 3 with 'Fizz', storing the result in 'SequenceModThree'
tuple_mod (Sequence, 3, Mod)
tuple_find (Mod, 0, Indices)
tuple_replace (Sequence, Indices, 'Fizz', SequenceModThree)
* Replace elements in 'Sequence' divisible by 5 with 'Buzz', storing the result in 'SequenceModFive'
tuple_mod (Sequence, 5, Mod)
tuple_find (Mod, 0, Indices)
tuple_replace (SequenceModThree, Indices, 'Buzz', SequenceModFive)
* Replace elements in 'Sequence' divisible by 15 with 'FizzBuzz', storing the final result in 'SequenceFinal'
tuple_mod (Sequence, 15, Mod)
tuple_find (Mod, 0, Indices)
tuple_replace (SequenceModFive, Indices, 'FizzBuzz', SequenceFinal)
Alternatively, this process can be written more compactly using inline operators:
tuple_gen_sequence (1, 1000, 1, Sequence)
tempThree:= replace(Sequence, find(Sequence % 3, 0), Fizz')
tempFive:= replace(tempThree, find(Sequence % 5, 0), 'Buzz')
FinalSequence := replace(tempFive, find(Sequence % 15, 0), 'FizzBuzz')
In this program, I applied a vectorization approach, which is an efficient technique for processing large datasets. Instead of iterating through each element individually in a loop (a comparatively slower process), I applied operations directly to the entire data sequence in one step. This method takes advantage of Halcon's optimized, low-level implementations to significantly improve performance and streamline computations.
Re: Solving Fizz Buzz with Cosines
#69Earlier quoted context omitted.
A candidate that appreciates the value of the question, yet won't subject themselves to the absurdity of demonstrating compliance. Yes, very much yes.
I'd worry about them over-complicating solutions at work as well.
FWIW I have never been asked this question or similar, but since it's so famous I do have my own answer at the ready, which is just slightly more complex than the naive solution, but still well within the realm of production-worthy (maintainable, testable, readable) code. We don't really ever see any discussion of such because of course it isn't "interesting".