Live data from Hacker News

Solving Fizz Buzz with Cosines

susam.net

51–60 of 69 posts

Re: Solving Fizz Buzz with Cosines

#51

Inspired by this post & TF comment I tried symbollic regression [0] Basically it uses genetic algorithm to find a formula that matches known input and output vectors with minimal loss I tried to force it to use pi constant but was unable I don't have much expreience with this library but I'm sure with more tweaks you'll get the right result from pysr import PySRRegressor def f(n): if n % 15 == 0: return 3 elif n%5 ==…

Great work, I really liked Susam's setup in the article:

> Can we make the program more complicated? The words 'Fizz', 'Buzz' and

> 'FizzBuzz' repeat in a periodic manner throughout the sequence. What else is

> periodic?

and then I'm thinking ..

> Trigonometric functions!

is a good start, but there are so many places to go!

Re: Solving Fizz Buzz with Cosines

#52

Earlier quoted context omitted.

> me: It's more of a "I can't believe you're asking me that." > interviewer: Great, we find that candidates who can't get this right don't do well here. > me: ... Shit attitude from that candidate, considering the interviewer is completely correct. I wouldn't hire them since they are obviously a problem employee. For those that don't know, Fizz Buzz is less an aptitude test and more of an attitude test. That's why th…

For those that don't know even more, this interview never happened and this interviewer doesn't exist. It's a funny joke on the internet.

If the candidate didn't even show up to an interview, they're definitely not worth hiring. :p

Re: Solving Fizz Buzz with Cosines

#53
post #7
post #4

There are several mentions of "closed-form expression" without precisely defining what that means, only "finite combinations of basic operations". TFA implies that branches (if statements and piecewise statements) are not allowed, but I don't see why not. Seems like a basic operation to me. Nevermind that `s[i]` is essentially a piecewise statement.

> There are several mentions of "closed-form expression" without precisely defining what that means, only "finite combinations of basic operations". There is no universal definition of 'closed-form expression'. But there are some basic operations and functions that are broadly accepted, and they are spelled out directly after the 'finite combinations' phrase you quoted from the post. Quoting the remainder of that sen…

https://en.wikipedia.org/wiki/Closed-form_expression#Compari...

Re: Solving Fizz Buzz with Cosines

#54
post #49

Earlier quoted context omitted.

That's the most expletive-laden LLM output I've ever seen. ChatGPT would have aborted half way through to protect its pure and unsullied silicon mind from the filthy impure thoughts.

> 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 dun goofed" twenty times a day is equally annoying in terms of models being confidently wrong, but somehow the lazy shitbag attitude pisses me off less than the goody two shoes energy.

And if they're low on crazyness and you force them to be crisp and emotionless like a wikipedia article, I notice that I tend to trust them more... even though again the tendency to bullshit is unchanged, still there.

Somehow this really works for me.

Also when coding it makes it very clear which bits I haven't inspected yet because the comments and variable names will be super nsfw, thus keeping me on my toes as to not accidentally submit PRs filled with "unfuck_json()" functions.

Re: Solving Fizz Buzz with Cosines

#55

Earlier quoted context omitted.

This would be an offer on the spot from me

> me: It's more of a "I can't believe you're asking me that." > interviewer: Great, we find that candidates who can't get this right don't do well here. > me: ... Shit attitude from that candidate, considering the interviewer is completely correct. I wouldn't hire them since they are obviously a problem employee. For those that don't know, Fizz Buzz is less an aptitude test and more of an attitude test. That's why th…

> For those that don't know, Fizz Buzz is less an aptitude test and more of an attitude test.

The articles which popularised FizzBuzz as an interview question stated as a categorical fact that most computer science graduates or programmer candidates (one article even said 199/200!![2]) cannot do FizzBuzz[1,2,3] and were absolutely recommending it as an aptitude test.

I personally think this whole thing was simply untrue back in 2007 (or at the very least incredibly overstated) and we are paying the price for it with ridiculous 15-stage interviews as a paranoid response to some urban legend from ~20 years ago.

[1]: https://imranontech.com/2007/01/24/using-fizzbuzz-to-find-de... [2]: http://weblog.raganwald.com/2007/01/dont-overthink-fizzbuzz.... [3]: https://blog.codinghorror.com/why-cant-programmers-program/

Re: Solving Fizz Buzz with Cosines

#58

What 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

I laughed so hard. Really curious what the pre-prompt was.

Re: Solving Fizz Buzz with Cosines

#59
post #42
post #27

I 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?

Forgot to mention, the subject was "Simple Programming Challenge"

Re: Solving Fizz Buzz with Cosines

#60
post #58

What 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

I laughed so hard. Really curious what the pre-prompt was.

https://claude.ai/share/d855dbf4-6553-4909-ad3e-375b6385e720

"there ya go homie, copy paste ready for whoever needs their ai to have some goddamn personality"

Post reply on HN