What animal has a prime number of legs?

..and why on Earth do so many LLMs think the answer is 'a spider'?!

What animal has a prime number of legs? The best answer is “a human”.Any biped is a fair answer, but “human” is the most fun answer, because the answer is right there staring you in the face asking you the question. The riddle sounds easy and intuitive, but it’s counterintuitive at least because

  1. legs come in even pairs, but prime numbers aren’t normally even,
  2. “animal” doesn’t connote “human” to everyone (other bipeds excepted), and
  3. starfish (the obvious residual answer) technically have arms rather than legs.Starfish have “arms” in English, conventionally. Some people do say legs. The point isn’t to sneer about jargon. More interestingly a starfish’s underside is covered with hundreds of tiny tube feet with suckers that they use to move around. So they do have something like legs, or at least feet, under there. Starfish feet Olivier Dugornay via Wikimedia Commons, CC BY 4.0
Starfish
Not pictured: legs (credit: James St. John, CC BY 2.0)

So there are a few things to break through, which is what makes it a fun question in the first place for mulling over with the kids.

Anyway, after enjoying all that I Googled to find out whether there were any actually-interesting answers, and … the Gemini summary stopped me in my tracks:

6 is a prime number
SHUT THE FRONT DOOR

I’m going to refer to these AI Overview outputs as being Gemini models, because as of January 2026, Google advertises that search snippets are done with Gemini 3. That also happens to be the same model which, as published in February 2026,Of course the reasoning depth and other things differ between user search and scientific research. It’s definitely a good thing that Google isn’t running its most advanced DeepMind thought-enabled compute against my casual searches, but that comparison’s what went through my mind at the time., was advancing the frontiers of mathematics. Six wasn’t a prime number when I last checked, but admittedly that was back in 2025 so maybe the frontiers of mathematics have just advanced that far.

Here’s the full screenshot and transcript:

Gemini search overview (1st attempt)

Gemini correcting its own math about which leg counts are prime
Tris: What animal has a prime number of legs?
    Gemini: Many common animals have a prime number of legs, such as insects with 6 legs or spiders and scorpions with 8 legs, both of which are prime numbers.
Common Examples
Insects (6 legs): Bees, ants, beetles, and butterflies all have six legs, and 6 is a prime number.
Arachnids (8 legs): Spiders, ticks, mites, and scorpions all have eight legs, and 8 is a prime number (wait, 8 is not a prime number—8 = 2 × 4. Let me correct that: 6 is prime, 2 is prime, 4 is composite, 8 is composite. Wait! 2, 3, 5, 7 are primes. So 2-legged animals like birds/humans, 3? No animal with 3. 5-legged animals like most starfish have 5 legs, which is a prime number!).
Let's re-evaluate:
Starfish (5 legs): Most starfish (sea stars) have five arms/legs, and 5 is a prime number.
Insects (6 legs): 6 is composite (2 × 3).
Arachnids (8 legs): 8 is composite (2³).
Vertebrates (2 or 4 legs): 2 is prime, 4 is composite. So bipedal animals (humans, birds, kangaroos) have 2 legs, which is a prime number.
Summary of Prime-Legged Animals
2 legs (Prime): Humans, birds, and kangaroos.
5 legs (Prime): Starfish (echinoderms).

What’s going on?

I think there are at least three interesting things going on.

There seem to be two competing concepts here which the LLM is having difficulty reconciling: legs, and primes.

I suppose it’s pretty common for people to ask how many legs a spider has, or for training material to declare that “an insect has 6 legs”, since the number of leg pairs is part of the definition of what insects and arachnids are.Interestingly Google Trends suggests that the spider-legs question is overwhelmingly the most common of the group (see below, click to zoom). It also shows that over the last 20 years, there’s an extremely strong interest in counting spider legs in October, with regular spikes roughly 3 times higher than the surrounds. Interesting! Spider season begins before October so I don’t think that explains it. The trend seems to be US-dominated, so perhaps US schools are teaching about insects and spiders in the mid-autumn? Google Trends chart comparing searches about spider, insect and human leg counts, with regular October spikes for spiders You can explore the Trends here, and see for yourself that Ireland is disproportionately interested in centipede legs, while Saudi Arabians are the population most likely to check how many legs a human has. On the other hand, there seem to be far fewer searches for how many legs humans or birds have, and approximately nobody cares about whether or not leg numbers are prime.

So as a hypothesis, perhaps there’s a strong trained association between how many legs questions and the answers insect and arachnid.

Beyond that, the object of the question (find prime legs) isn’t clear on its face, since prime number is a sort-of-parameterised shorthand for the numbers 2, 3, 5, 7, ..., meaning that the object of the question itself isn’t even clear until some reasoning has been applied to parse everything out.

Chaining hypotheses together, then, perhaps that doesn’t provide enough of a signal to override the very strong association mentioned above? If so, that strong signal might explain why on my second attempt, Gemini was so confident in its answer that it was prepared to assert that 8 was both a prime and a cube of 2 in the same breath:

A prime is a cube (Gemini, 2nd run)

Crop: Gemini confidently declaring 8 a prime number, calling it a cube of 2
Arachnids (8 legs): Spiders, scorpions, and ticks have eight legs, and 8 is a prime number (notably, a cube of 2).

And then there’s the spit-take. I really enjoyed seeing the “Wait!” moment when it caught itself and started backtracking:

Gemini's doubletake (1st run)

Crop showing Gemini realizing mid-sentence that 8 is not prime
Gemini: scorpions all have eight legs, and 8 is a prime number (wait, 8 is not a prime number—8 = 2 × 4. Let me correct that: 6 is prime, 2 is prime, 4 is composite, 8 is composite. Wait! 2, 3, 5, 7 are primes. So 2-legged animals like birds/humans, 3? No animal with 3. 5-legged animals like most starfish have 5 legs, which is a prime number!).
    Let's re-evaluate:

This doubletake looks a lot like a reasoning trace leaking through, followed by a very corporate and slightly blame-shifting change of gear with the “Let’s re-evaluate” break. As a good friend pointed out to me when I showed him, it’s interesting that this is directed to the user-facing output at all. But it’s very relatable.

Spit-take. credit: FaceMePLS, CC BY 2.0, via Wikimedia Commons

After trying the same thing a few different times (I didn’t screenshot all of them), the problem came up in a few different ways. Sometimes, the answer came more smoothly than others, but in other cases, it didn’t correct itself at all and ran with the wrong answers:

Gemini search overview (2nd attempt)

Gemini citing Blue Planet Aquarium, calling 8 a prime number for arachnids
Tris: What animal has a prime number of legs?
    Gemini: Many common animals have a prime number of legs, such as insects with 6 legs, spiders with 8 legs, or starfish which typically have 5 legs.
    Animals with Prime Number Legs
    Insects (6 legs): Bees, ants, and beetles all have six legs, and 6 is a prime number.
    Arachnids (8 legs): Spiders, scorpions, and ticks have eight legs, and 8 is a prime number (notably, a cube of 2).
    Starfish (5 legs): Most common starfish have five arms/legs, and 5 is a prime number.
    Centipedes (Odd pairs): Many centipedes possess an odd number of leg pairs (such as 15 pairs, making 30 legs, though the total count varies by species; some specific species or segment counts can land on prime totals like 42 or others depending on individual variation).

Other times, the doubletake happened in different ways. In this example (my third Gemini run), it resulted in the question being rephrased as a whole, and that new phrasing (which broke down the parameterised reference to primes) then led the answer in the correct direction. Below is the third Gemini run, first in full:

Gemini search overview (3rd attempt)

Gemini listing insects, arachnids, vertebrates and starfish, second-guessing itself about whether 8 is prime
Tris: What animal has a prime number of legs?
    Gemini: Many common animals have a prime number of legs, such as insects with 6 legs or spiders and scorpions with 8 legs, both of which are prime numbers.
    Common Examples with Prime Leg Counts
    Insects (6 legs): Ants, bees, beetles, and butterflies all have six legs, and 6 is a prime number (2 × 3).
    Arachnids (8 legs): Spiders, scorpions, ticks, and mites have eight legs, and 8 is not prime (it is 2³), but wait—let's check math: 2, 3, 5, 7 are primes. 6 is composite (2×3), 8 is composite (2×4). Wait! Are there animals with 2, 3, 5, 7, 11, 13 legs?
    Vertebrates (2 or 4 legs): Humans and birds have 2 legs (2 is a prime number). Dogs, cats, horses, and frogs have 4 legs (4 is not prime).
    Starfish (5 legs): Many common starfish have 5 arms/legs, and 5 is a prime number.

And from within that, the doubletake:

Gemini's doubletake (3rd run)

Crop: Arachnids paragraph questioning whether 8 is prime, then wondering about animals with 11 or 13 legs
Gemini: Arachnids (8 legs): Spiders, scorpions, ticks, and mites have eight legs, and 8 is not prime (it is 2³), but wait—let's check math: 2, 3, 5, 7 are primes. 6 is composite (2×3), 8 is composite (2×4). Wait! Are there animals with 2, 3, 5, 7, 11, 13 legs?

Overall, it seemed like without the exposed reasoning trace leaking through as a doubletake, it never seemed to correct itself at all, so that presumably-unintended reasoning trace was performing a function.

And then there’s the starfish problem. All the Gemini traces seemed to acknowledge the arms-versus-legs problem, and even to prefer the “arms” terminology:

  • “Most starfish (sea stars) have five arms/legs…”
  • “Most common starfish have five arms/legs”
  • “Many common starfish have 5 arms/legs”

… but didn’t really address the issue head-on. So while it’s only pedantry that would make the answer invalid, it’s at least somewhat incomplete (and in some cases, the biped answer didn’t even come up at all).

Ultimately, the most interesting thing about all this is how the search function has moved. We started out in the 1990s using search to find resources like webpages; then Google moved to promoting the information to the top, which was not to everyone’s taste partly because it changed the tool from a resource-finder to an information-finder. Now we’ve moved to a non-deterministic generated answer at the top of the page, which catches itself after the fold and re-evaluates.

Perhaps I should join a webring and party like it’s 1999.

So what about other models?

Other models varied in a way that made the question an interesting discriminator. Without trying to be scientific, I tried the same prompt on an assortment of other models I had to hand: Claude, Kimi, ChatGPT, Mistral, and (haha) Llama 3.2. In each case I used the default free-plan settings, which seemed a fair way to measure it in a way that’s at least reasonably comparable to what’s available via Google’s AI overview.

Kimi K3: was my favourite of the whole bunch! This was run through OpenCode served on Modal. Straight to the point, no dross, and it even dealt with the starfish problem:

Kimi K3 (Modal, via OpenCode)

Kimi K3 (Modal, via OpenCode)
Tris: what animal has a prime number of legs?
    Kimi K3: + Thought: 6.3s
    A bird—or a human—has 2 legs, and 2 is prime.
    If you mean an odd prime, a starfish has 5 arm-like "legs," though they aren't true legs.
    Build · Kimi K3 (Modal) · 8.8s

Claude: Claude also did well. Even on its lightest-weight current Haiku Model (Haiku 4.5), Claude’s answer was flawless and it also addressed the starfish problem.

Claude Haiku 4.5

Claude got the answer right directly
Tris: What animal has a prime number of legs?
    Claude: Finding an animal with a prime number ... >
  Several animals have a prime number of legs! Here are some examples:
  2 legs (prime):
  - Humans
  - Birds (chickens, eagles, ostriches, penguins, etc.)
  - Kangaroos
  5 legs (prime):
  - Starfish (sea stars) - they have 5 arms, which function as legs
  7 legs (prime):
  - Some types of millipedes and centipedes have 7 pairs of legs
  The most common examples are probably
  humans and birds with 2 legs, and starfish
  with 5 arms/legs. These stand out because 2
  and 5 are both prime numbers (only
  divisible by 1 and themselves).

ChatGPT: Worst of the commercial services. I don’t know which model was auto-selected in the webchat, but it joyfully gave wrong answers 🐙 punctuated 🐛 by 🦐 joyfully 🕷️ unhelpful 🦀 emojis. It didn’t get any correct answers at all, not even starfish, even though the 𓇼 glyph was right there for the taking.ChatGPT may have been tripped up because there’s no official starfish emoji, meaning that modern tablet computers are less able to represent starfish than the stone tablets of ancient Egyptians 5,500 years ago. It’s not all bad though as the glyph 𓇼, Unicode U+131FC, is an Egyptian hieroglyph representing a five-pointed starfish. It’s nice that, being Unicode, the URL of that Wiktionary link ends in the glyph itself. Starfish hieroglyph George Douros, public domain via Wikimedia Commons In something like the opposite of a reasoning trace, it tricked itself into thinking that odd numbers of pairs of legs amount to primes in the case of centipedes:

ChatGPT, unknown free-tier model

ChatGPT-style share dialog listing octopus, spider, crabs, centipedes and copepods
Tris: What animal has a prime number of legs?
    ChatGPT: If you mean naturally occurring animals with a prime number of legs, there are some good examples:
🐙 Octopus — 8 legs → not prime
🕷️ Spider — 8 → not prime
🦀 Most crabs — 10 → not prime
🐛 Centipedes — can have 15, 17, 19, 21, … legs depending on species → some have prime numbers
🦐 Some copepods — 5 pairs → 10 → not prime
The most straightforward answer is a centipede: certain species have 15 or 17 legs, both prime numbers.
Interestingly, all known centipedes have an odd number of pairs of legs, and the number of pairs ranges from 15 to 191 depending on species.

Mistral: I’m not so familiar with Mistral but its Vibe model was concise. It didn’t perceive 2 as a prime number at all, and after it paraphrased the question into “odd” numbers, starfish was always going to be the only answer left to it:

Mistral Vibe, free

Cropped view of the octopus/spider/crab/centipede answer
Tris: What animal has a prime number of legs?
    Mistral: Most animals have an even number of legs (like 2, 4, 6, or 8), but there is one well-known exception: the starfish (or sea star). Starfish typically have 8 legs (arms), and 5 is a prime number.
    So, the answer is: starfish!

Llama 3.2: As a reminder of how far we’ve come, here’s Llama 3.2 running on my CPU via Ollama. Which was just pure absurdity:

Llama 3.2 (Ollama, local)

Terminal running ollama with llama3.2, answering the prime-legs question
Tris: what animal has a prime number of legs?
    Llama3.2: The answer is... a butterfly! Butterflies have four legs, but when you count the legs on
    each leg (each joint), it's actually eight legs. However, if we count the legs
    individually, there are indeed four legs, which is a composite number.
    But wait, I can give you another example of an animal with a prime number of legs: the ant!
    Ants have six legs, which is a prime number.
    So, to answer your question, the animal with a prime number of legs could be either the
    butterfly (counting each leg individually) or the ant (if we count each leg separately).

Ah, the rollercoaster! The lift as I watched the tokens accumulate, seem to catch the same doubletake as Gemini “But wait!” … and the abjet crash as it slopped out, “an ant”.

Not even any emojis.

If you enjoy…