In fact, according to the celebrated prime number theorem, the number of primes less than or equal to n is asymptotic to n/log n, which means the density of primes near n is asymptotic to 1/log n.
I have a small section about this at https://susam.net/journey-to-prime-number-theorem.html#prime... if you want to read more about this.
See also: https://en.wikipedia.org/wiki/Prime_number_theorem
> In fact, according to the celebrated prime number theorem, the number of primes less than or equal to n is asymptotic to n/log n, which means the density of primes near n is asymptotic to 1/log n.
When written down as a string of digits, log n is another way to say 'proportional to the number of digits'.
The number of digits grows fairly slowly, thus also the 'probability' of a number being prime drops very slowly.
There are more prime numbers than there are squares of integers.
Depends on what you mean by 'hard'. It's easy in the sense that we have algorithms to decide whether a number is prime or composite that take time polynomial in the space it takes to write down your number (ie polynomial in log n).
More from the fact that each prime number makes all its multiples non-prime, so you'd expect this would accumulate quickly in making primes an increasingly rare find. Which is the case, but slower than intuition suggests.
Try these shapes: 100x113, then 100x114, then 100x115, the "patterns" swing from slant down, to vertical, to slant up.
I'd love this (even more) with some animation and colo(u)r options.
cols.value = 1n; setInterval(() => {cols.value++; readInput()}, 250);
Of course the pressing question is, if this is the start field for a Conway game-of-life, do any interesting patterns evolve?
It would be fun to brute-force a few starting grid sizes and seeing how long the game continues. Games that last more than a few steps can be set aside for human evaluation.
Because if it turns out that some particular smallish grid or spiral of primes causes something interesting to happen in game-of-life, then you can imagine HN melting down!?
1. Make the grid render as a square when rows == columns 2. Default to the largest number of rows and columns that would still avoid page scrolling
susam•2h ago
My tool uses the Miller-Rabin primality test with prime bases drawn from https://oeis.org/A014233 to determine whether a number is prime. This allows it to handle numbers up to 3317044064679887385961980.
For example, https://susam.net/primegrid.html#3317044064679887385961781-2... shows the upper limit of the numbers this tool can check. The three circles displayed there represent the following prime numbers:
I hope this is fun for you too!camillomiller•2h ago
You actually sent me on a rabbit hole trying to visually look for patterns :D But I guess the discretionality with which you can organize in rows and columns makes mine quite a pointless excercise :D
jona-f•2h ago
susam•2h ago
For all primes p greater than 3, p ≡ ±1 (mod 6).
Therefore, when the total number of columns is a multiple of 6, all primes except 2 fall into the same columns, namely 1, 5, 7, 11, 13, 17 and so on.
jacobtomlinson•1h ago
ainiriand•1h ago
Daub•54m ago
Tepix•1h ago
Would we see new patterns emerge if the number of columns increases per row by X (X being constant or perhaps prime numbers ;-) )?
susam•52m ago
Tepix•17m ago
Here's an idea on how to implement it without the slowdown: https://jsfiddle.net/qpswztj8/
Given that it's a preformatted text with a known number of columns, the number below the mouse pointer can be computed using the mouse position, character width and line height.
davedx•41m ago
lblume•40m ago
xandrius•28m ago