Live data from Hacker News

Primel – guess a 5 digit prime number – each guess must be a prime

converged.yt

71–80 of 139 posts

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#71
post #65

Earlier quoted context omitted.

Looks like there's 8,363 5 digit primes, from 10007 to 99991, so about 1 in 11

Why isn’t 00002 your lower bound?

The game does not accept leading zeros (00017: "Not a 5 digit prime")

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#73
post #68

Earlier quoted context omitted.

You want a natural log there; ln(100000) ~ 11.5. That being said, the pool you're really working from is the numbers with last digit 1, 3, 7, or 9. One out of every 4.6 such numbers under 10^5 is prime. So just guessing until you find a prime is practical.

Hi, can you provide some search terms that will help me understand the relationship between ln and prime density?

https://en.wikipedia.org/wiki/Prime_number_theorem

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#74

So are people just really good with numbers? I don't know any 5 digit primes nor do I know a way to calculate them on the fly.

I used this site to explore options. http://compoasso.free.fr/primelistweb/page/prime/liste_onlin... It's a bit tedious but still fun-ish and seemed better than guessing.

Unlike Wordle, I assume it's unreasonable to expect a player to know primes so I don't think I'd call this cheating.

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#75

My side-project this week has been searching for an optimal Wordle strategy. I figured it would make a great blog post but I haven't got that far yet. Step 1 is to find an optimal starting word. My most insightful finding so far has came from trying to define a cost function for comparing potential starting words. It turns out that "% of potential guesses [not] eliminated" is an excellent loss function. Importantly,…

You are looking for Information Gain and Mutual Information (concepts from information theory). Have fun!

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#76
post #68

Earlier quoted context omitted.

You want a natural log there; ln(100000) ~ 11.5. That being said, the pool you're really working from is the numbers with last digit 1, 3, 7, or 9. One out of every 4.6 such numbers under 10^5 is prime. So just guessing until you find a prime is practical.

Hi, can you provide some search terms that will help me understand the relationship between ln and prime density?

[deleted]

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#77
post #68

Earlier quoted context omitted.

You want a natural log there; ln(100000) ~ 11.5. That being said, the pool you're really working from is the numbers with last digit 1, 3, 7, or 9. One out of every 4.6 such numbers under 10^5 is prime. So just guessing until you find a prime is practical.

Hi, can you provide some search terms that will help me understand the relationship between ln and prime density?

Or https://en.wikipedia.org/wiki/Prime-counting_function .

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#78
This is really cool, nice idea!

Also, the following script might help to make the game more accessible (or to help you cheat :P) -

  // note: game doesn't seem to automatically clear at the end, so in the dev console use:
  // window.localStorage.clear();
  // then refresh the page

  const prime = n => {
    for (let i = 2, s = Math.sqrt(n); i  1;
  }
  const generateNums = digits => (
    m => [...Array(9 * m).keys()].map(i => i + m)
  )(Math.pow(10, digits - 1));
  const generate5DigitPrimes = () => generateNums(5).filter(prime);

  const all5DigitPrimes = generate5DigitPrimes();

  // updated to take an optional array (defaults to all5DigitPrimes)
  // this means you can chain the check function to do things that normal regex can't do
  // e.g. check(/some_regex/, check(/some_other_regex/))
  const check = (r, a = all5DigitPrimes) => a.filter(p => r.test('' + p));
Usage:

paste the above code into the dev console

type 'all5DigitPrimes' and press Enter to see a list of all 5-digit primes

type 'check(/some_regular_expression/)' to see a filtered list of primes that match your regular expression

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#79

Earlier quoted context omitted.

log(100000) is 5, so approximately 1 in 5 numbers below 100k is prime. Obviously those in the range 10000-99999 are less dense, but primes are still surprisingly common.

You want a natural log there; ln(100000) ~ 11.5. That being said, the pool you're really working from is the numbers with last digit 1, 3, 7, or 9. One out of every 4.6 such numbers under 10^5 is prime. So just guessing until you find a prime is practical.

[deleted]

Re: Primel – guess a 5 digit prime number – each guess must be a prime

#80

Earlier quoted context omitted.

log(100000) is 5, so approximately 1 in 5 numbers below 100k is prime. Obviously those in the range 10000-99999 are less dense, but primes are still surprisingly common.

You want a natural log there; ln(100000) ~ 11.5. That being said, the pool you're really working from is the numbers with last digit 1, 3, 7, or 9. One out of every 4.6 such numbers under 10^5 is prime. So just guessing until you find a prime is practical.

Ah you're correct. Annoying how Google interprets log(x) as base-10 (but more shame on me for not realising that e^5 is obviously not 100000). In my experience everyone uses log and ln interchangeable outside of lessons at school.
Post reply on HN