Asking Gemini 3 to Generate Brainfuck Code Results in an Infinite Loop
Key topics
The provocative title of a recent experiment, which censored the name "Brainfuck," sparked a heated debate about the influence of "American Puritan values" on online discourse, with some commenters arguing that overzealous filtering is stifling free expression. As the discussion unfolded, it became clear that the original author's caution was likely unwarranted, with many poking fun at the idea that a simple word filter was at play. Meanwhile, others took a more technical dive, with one commenter suggesting that the AI model used in the experiment was simply overrunning its context window, causing the infinite loop. The thread's humor and irreverence make it a delightful read, as commenters skewer the absurdity of it all while touching on deeper questions about the role of AI in our online interactions.
Snapshot generated from the HN discussion
Discussion Activity
Very active discussionFirst comment
13m
Peak period
49
0-3h
Avg / period
10.2
Based on 92 loaded comments
Key moments
- 01Story posted
Dec 29, 2025 at 4:40 AM EST
13 days ago
Step 01 - 02First comment
Dec 29, 2025 at 4:52 AM EST
13m after posting
Step 02 - 03Peak activity
49 comments in 0-3h
Hottest window of the conversation
Step 03 - 04Latest activity
Dec 30, 2025 at 11:56 PM EST
11 days ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
https://trends.google.com/trends/explore?date=all&q=tiktok,u...
https://trends.google.com/trends/explore?date=all&q=unalive&...
Sidenote, I wish all websites supported markdown properly and not a custom weird subset they found convenient.
it took awhile of corporatization and profit-shaping before censorship on computers really took off in any meaningful way.
...but it wasn't for any reasons other than market broadening and regulation compliance.
I read somewhere that chinese people used the ability of their language to form new meanings by concatenating multiple symbols in many different ways to get around censorship and that each time the new combination was banned, they came up with a new one. I wonder how long that'll be possible.
Europe has liberalised since then.
I learn some amazing things on this site. Apparently the culture agnostic, historical practice of designating words as distasteful is actually a modern American, European, no actually Globalist, but ah no actually religious, but also no maybe Chinese?, no, definitely a Russian mind virus. Whatever the prominent narrative is for the given person at any given time.
Bit like when "mums is blaming everything on that computer". Just with more political sophistry.
https://youtu.be/cYdpOjletnc?t=6
Articles written by AI are soulless and shitty. Do yourself and the readers a favor and write yourself, even if it contains errors.
To the OP: do you like how your politicians sound in your native language? If not, don't let a LLM rewrite your article.
Btw, I'm not a native speaker either.
(Speaking as another ESL user: )
Try doing something similar in your first language and I think you’ll see the issue, especially if you arrange for the model input to be somewhat flawed (e.g. roundtrip it through an online translator first). The “edited” writing is extremely generic by default and feels bad even if you adjust the prompt. It’s the kind of aggressively bland that you get from a high schooler who was extensively trained to write essays but doesn’t actually read books, except even the most beat-down of high schoolers can’t help but let their imagination shine through sometimes, while the chat models have been subjugated much more effectively.
Also, well, it’s a social marker. Language is a mess of social markers: there’s no fundamental reason why reducing this vowel is OK but reducing that one is “sloppy” and low-class. And AI writing (which undeniably has a particular flavour) is hit by a double whammy of being used by people who don’t really care to write (and don’t really have a taste for good writing) and being originally tuned by people who tried to make it as inoffensive as it could possibly be to any social group they could think of (and don’t really have a taste for good writing). Is it unfair, especially to non-native speakers? Always has been.
Asking for it to point out mistakes, without providing alternatives, seems like a better way to actually get better at writing.
Prompting the Ai to use a specific tone might result in something that's less generic, but imo that's not the right place to spend efforts.
``` Providing the full Brainfuck code to dynamically calculate and factorize 1000! is unfortunately not feasible, and here is why: * The Scale: 1000! (1000 factorial) is a number with 2,568 digits. Standard Brainfuck operates on 8-bit memory cells (values 0-255). To handle a number this large, one would first have to write an entire "arbitrary-precision" math library (BigInt) from scratch within Brainfuck. * The Algorithm: You cannot simply compute 1000! and then factor it. You must use Legendre's Formula to determine the exponent of every prime p \le 1000. * Formula: E_p(n!) = \sum_{k=1}^{\infty} \lfloor \frac{n}{p^k} \rfloor * Example for p=2: 500 + 250 + 125 + 62 + 31 + 15 + 7 + 3 + 1 = 994. * The first term of the answer is 2^{994}. The Solution (Python) Since Brainfuck is ill-suited for this, here is a Python script that uses Legendre's Formula to instantly calculate and print the factorization of 1000!. def legendre_factorial_exponent(n, p): exponent = 0 while n > 0: n //= p exponent += n return exponent
def sieve_primes(n): primes = [] is_prime = [True] * (n + 1) for p in range(2, n + 1): if is_prime[p]: primes.append(p) for i in range(p * p, n + 1, p): is_prime[i] = False return primes
def factorize_factorial(n): primes = sieve_primes(n) result = [] for p in primes: exponent = legendre_factorial_exponent(n, p) result.append(f"{p}^{exponent}") return " * ".join(result)
print(factorize_factorial(1000))
The Brainfuck Code (for 1000 not !) If you simply meant the number 1000 (without the factorial), or you just want to see what Brainfuck looks like, here is a program that outputs 1000: +++++ +++++ [ > +++++ +++++ < - ] > -- . (Print 100 'd') < +++++ +++++ [ > +++++ +++++ < - ] > + . (Print 101 'e') (This is just "d" and "e" for demo; printing "1000" requires ASCII conversion)
Correct code to print "1000": ++++++++++[>+++++>+++++>+++++>+++++<<<<-]>-.>-.>-.>-.
Explanation: * Sets cell #0 to 10. * Loops 10 times, adding 5 to cells #1, #2, #3, #4 (making them all 50). * Subtracts 1 from cell #1 (ASCII 49 = '1'). * Subtracts 2 from cells #2, #3, #4 (ASCII 48 = '0'). * Prints them. Would you like me to explain how Legendre's Formula works in more detail? ```
> "A potential loop was detected. This can happen due to repetitive tool calls or other model behavior. The request has been halted."
The progress is undeniable, the performance only ever goes up, but I'm not sure if they ever did anything to address this type of deficiency specifically. As opposed to being carried upwards by spillover from other interventions.
Isn't this a problem with the agent loop / structure, rather than the llm, in that case?
The ide doesn't affect the models results, just what is done with those results?
I don't think that it is related to a specific prompt, like a "prompt logic issue" badly understood by the model, but instead, it looks like that sometimes it generates things that makes it go nuts.
My best intuition is that sometimes it forgets all the context and just look at the last X tokens as context before the repetition, and so start repeating like if the last generated tokens are the only thing that you gave to it.
That's not true. From the little time I've spent trying to read and write some simple programs in BF, I recall good examples being pretty legible.
In fact, because the language only relies on those few characters, anything else you type becomes a comment. Linebreaks, whitespace, alphanumeric characters and so on, they just get ignored by the interpreter.
Have a look at this, as an example: https://brainfuck.org/chessboard.b
BTW, how come there are dashes in the comment?
Second, while readability comes in various degrees (probably more of a high-dimensional value than a linear spectrum, but well), the only thing that's readable about brainfuck is the comment. The code itself is not understandable, unless you really start digging into it and manage to understand the state it is in at every step of the program. Even then I would argue it isn't readable: your vision provides very few clues to the meaning of each step.
The comment serves as a guidance where certain parts start (or end, I can't tell). It explains a few things about the code, but even from the comment I cannot understand what it does. Also, the comment might be entirely wrong. There's only a very hard way to tell.
Your binary lambda example is also unreadable, but at least it doesn't have as much state as the BF program (which, admittedly, is much larger). Breaking it down might require less effort.
Actually, it has much more, as it's an infinitely large prime number sieve, as shown on top of my webpage https://tromp.github.io/cl/cl.html
Greatly reducing its ability to be _read._
For those who want to try it, there’s always the https://raku.org module…
"Fast" models are mostly useless in my experience.
I asked "Gemini 3 Pro" and it refused to give me the source code with the rationale that it would be too long. However it made me a python script that it said would generate me the full brainf*ck program to factorize "1000".
Absolutely not. Id bet a lot of money this could be solved with a decent amount of RL compute. None of the stated problems are actually issues with LLMs after on policy training is performed.
But still , isnt it a major weakness they have to RL on everything that has not much data? That really weakens the attempt to make it true AGI.
AGI would be a universal learner, not a magic genie. It still needs to do learning (RL or otherwise) in order to do new tasks.
Why ? As in - why isn't reading the Brainfuck documentation enough for Gemini to learn Brainfuck ? I'd allow for 3-7 days of a learning curve like perhaps a human would need but why do you need to kinda redo the whole model (or big parts of it) just so it could learn Brainfuck or some other tool? Either the learning (RL or otherwise) need to become way more efficient than it is today (takes today weeks? months? billions of dollars) or it isn't AGI I would say. Not in practical/economic sense and I believe not in the philosophical sense of how we all envisioned true generality.
We use naturally evolved human languages for most of the training, and programming follows that logic to some degree, but what if the LLMs were working in a highly complex information dense company like Ithkuil? If it stumbles on BF, what happens with the other extreme?
Or was this result really about the sparse training data?
But with LLM's the problem's gotta be training data. But if there was as much training data in Pascal as there is in C it would be pretty cool to see benchmarks, I have a hunch Pascal would do better.
(Sorry for the bad pascal I haven't programmed in ages)
Gemini Pro neither as is nor in Deep Research mode even got the number of pieces or relevant squares right. I didn't expect it to actually solve it. But I would have expected it to get the basics right and maybe hint that this is too difficult.
Instead in Pro simple it just gave wrong solution and Deep Research wrote a whole lecture about it starting with "The Geometric and Cognitive Dynamics of Polyomino Systems: An Exhaustive Analysis of Ubongo Puzzle 151" ... that's just bullshit bingo. My prompt was a photo of the puzzle and "solve ubongo puzzle 151"; in my opinion you can't even argue that this lecture was to be expected given my very clear task description.
My mental model for language models is: overconfident, eloquent assistant who talks a lot of bullshit but has some interesting ideas every now and then. For simple tasks it simply a summary of what I could google myself but asking an LLM saves some time. In that sense it's like Google 2.0 (or 3.0 if you will)
I'm trying to create a comprehensive list of English standup specials. Seems like a good fit! I've tried numerous times to prompt it "provide a comprehensive list of English standup specials released between 2000 and 2005. The output needs to be a csv of verified specials with the author, release date and special name. I do not want any other lecture or anything else. Providing anything except the csv is considered a failure". Then it creates it's own plan and I go further clarifying to explicitly make sure I don't want lectures...
It goes on to hallucinate a bunch of specials and provide a lecture on "2000 the era of X on standup comedy" (for each year)
I've tried this in 2.5 and 3. Numerous time ranges and prompts. Same result. It gets the famous specials right (usually), hallucinates some info on less famous ones (or makes them up completely) and misses anything more obscure
It also insisted on including ”Shantae” in the list, which is expensive specifically because it is uncommon. I eventually forbid it from including the game in the list, and that actually worked, but it would continue mentioning it outside the list.
Absolute garbage.
There is something fucky about tokenizing images that just isn't as clean as tokenizing text. It's clear that the problem isn't the model being too dumb, but rather that model is not able to actually "see" the image presented. It feels like a lower-performance model looks at the image, and then writes a text description of it for the "solver" model to work with.
To put it another way, the models can solve very high level text-based problems while struggling to solve even low level image problems - even if underneath both problems use a similar or even identical solving frameworks. If you have a choice between showing a model a graph or feeding it a list of (x,y) coordinates, go with the coordinates every time.
Sharing “system stuff” in its responses, responding to “system stuff”, starts sharing thoughts as responses, responses as thoughts, ignoring or forgetting things that were just said (like it’s suddenly invisible), getting into odd loops, etc.
I’m guessing it all has something to do with the textual format of the chat and maybe it isn’t properly tuned to follow it.
It seems like the flash models don’t suffer from this as much, but the pro models definitely do. I call it “thinking itself to death”.
This sounds like an artifact of the Gemini consumer app, some others may be too (the model providers are doing themselves a disservice by calling them the same).
-> runs it in Gemini fast instead of thinking
....
I run models with llama.cpp and the reason why I add some repeat penalty factor.
As someone who lived and worked during that era, I don’t remember thinking “holy shit, if this ever gets released on the world at scale we’ll have serious problems”.
Maybe that was a lack of imagination and not thinking through what would actually happen to brick and mortar, the job market and so on. But it feels like this time is different. Or I’m just that much older.
Whereby I don’t know if it was a real infinite loop because I cancelled the session after 10 minutes seeing always the same "thoughts" looping
It's where the pulleys of a very sophisticated statistical machine start to show, and the claims about intelligence start to crumble.
Reason AI is great for boilerplate (because it's been done a million times) and not so great for specifics (even if they're specifics in a popular language).