Hacker News new | ask | show | jobs
by RA2lover 606 days ago
Failed to realize doge prime was supposed to only count prime-numbered wows until after looking at the game's code.

From the game's script:

  function isFibonacci(numberToCheck) {
    return (
      isSquare(5 * numberToCheck * numberToCheck + 4) ||
      isSquare(5 * numberToCheck * numberToCheck - 4)
    )
  }
How does that end up working for all numbers?
1 comments

Looks like a quadratic residue check for primes, or just a residue check

But passing to ChatGPT reveals it is in fact a test for if the number is a Fibonacci number