Why do prime numbers make these spirals? (2019)
3blue1brown.com
3blue1brown.com
The reasoning, which is in the article here, is that you can make any whole number you wish if the number is of the form 6k+1, 6k-1, 6k+2, 6k-2, 6k+3, or 6k-3. But you cannot make primes with the numbers of the form 6k+2, 6k-2 (they would always have to be divisible by 2), and you cannot makes primes with numbers of the form 6k+3, 6k-3 because they are always divisible by 3. So what are you left with? All primes >3 must of the form 6k+1 or 6k-1. And that factor 6 is just a bit less than 2 pi (a full turn in radians) so you get spirals from the offset. They are also a pixel or two off, but that is imperceptible.
The same logic is a nice exercise to apply to the problem of why primes >2 can only be of the form 4k+1 or 4k-1. Apply the same logic as above.
And yes, in base 6 that becomes 1 and 5, as p%6 = 1 or 5, equivalent to p=6k±1. Interesting observation, thanks :)
[append] Oh, and because this pattern (of 1 always being one of the constants) carries out for arbitrarily large linear coefficients, that also explains the "twin prime" phenomenon: https://www.youtube.com/watch?v=QKHKD8bRAro
If we take any number K=N*4 divisible by 4 and >2, that'd be an even number by definition. The two closest odd numbers on either side would be (K-3), (K-1), (K+1), (K+3). As it happens (K+3) is the same as K(-1) for the next N, and (K-3) is the same as (K+1) for the previous N. So _all_ odd numbers follow this rule.
What "4k+1 or 4k-1" says in a roundabout way is that all prime numbers (>2) are odd, which isn't much of a surprise.
For a certain point of view, most of math is trivial corollaries.
(Proof: check.)
Additionally, for the 4k+1 / 4k-1 topic, it is just a complicated way of saying 2k+1 (as parent suggested).
As well, i think the 2k+1 thing is drastically more trivial and not at all equivalent being that all you need to know for 2k+1 is that 2k+1=odd. 4k and especially 6k take a larger generalization and different analytical method and often aren't included in the definition of the primes we learn like 2k+1 (odd) is.
More generally, if you take the first n primes p_1, ..., p_n and define P=p_1*...*p_n, then all primes bigger than P be in the form of P*k +- a, such that a < P and GCD(P, a) = 1. In case of n=2 (P=2*3=6), there is this nice property that the only such a are 1 and 5 (which are equivalent), but in principle, the same can be done for any n. It's just that the set of all a has the size equal to Euler's totient function of P, which grows pretty fast as n increases.
For example, if n = 3, then P = 2*3*5 = 30, so all prime numbers bigger than 30 have to be in the form of 30k +- 1, 30k +- 7, 30k +- 11, 30k +- 13, 30k +- 17, 30k +- 19, 30k +- 23 or 30k +- 29 (notice that half of these are equivalent to the other half and can be ommitted). It is interesting that in this particular case, all a are either 1 or a prime less than P: I don't think that property holds for all n, though.
Except in Indiana, where the legal value of pi is 3.2 by mandate.
isn't that sort of cheating, when it comes to math?
It's "almost" the thing just not the thing
You just have to properly define what you mean by "imperceptible" and you are good to go. Now you can look for a bounded approximation. See how it changes as things get bigger. See if it can be improved.
Bounds and approximation are generally a very useful tool. Properties simplifications and working on sub parts can also yield interesting results.
Generally I would say that if you can’t prove something, trying something close but simpler is nearly always a good idea.
More seriously, it’s an integer variable. By convention, letters from the middle of the alphabet are used for them (generally n then k).
Here, the commenter uses k because that’s what’s used in the article and that’s what’s used because n is already used to designate the class in the definition of a residue class.
> 6k+3, or 6k-3.
These are the same collection of numbers, you meant to put 6k instead of one of them :-)
Wouldn't the vast majority of those studying primes learn this from their textbook?
Note that 6k-1 is the same as 6k + 5. By writing that way, we can focus in positive representations of the modulo 6 congruence.
6k + 0 can't be prime, it's divisible by 6, yielding k
6k + 1 might be prime: we cannot rule it out by division.
6k + 2 cannot be prime, it's divisible by 2, yielding 3k + 1.
6k + 3 cannot be prime, it's divisible by 3, yielding 2k + 1
6k + 4 cannot be prime, it's divisible by 2, yielding 3k + 2
6k + 5 might be prime again.
That covers all cases of the modulo 6 congruence.
Thus only 6k + 1 and 6k + 5 can possibly be prime.
This is trivial fluff, only a smidgeon more clever than "all primes greater than 2 are of the form 2k + 1".
Another line of reasoning:
If a number N is divisible by 6, then it is even. This means that N + 2 and N + 4 are also even. Thus none of those numbers are prime.
If a number N is divisible by 6, it is also divisible by 3. This means that N + 3 is also divisible by 3. Thus, it cannot be prime.
That leaves N + 1 and N + 5, whose divisibility doesn't relate to 6.
And that's why it's one of the five books I have kept in the decades since.
The 1 and 5 elements of the (modulo 6) congruence are precisely those which are relatively prime to 6: those two elements that Euler's totient function counts: φ(6) = 2.
It doesn't generalize trivially; there is osmething to puzzle out there. For instance in the case of M = 15, we have 8 being relatively prime to 15. Yet 15k + 8 might be composite (like in the case k = 0).
I may go into it more if I have a bit of time away from other interesting or urgent matters.
Every prime p > 15 can be written as 15k + r, where r = p % 15 is coprime to 15. Put this way, it should be pretty clear what's going going on: gcd(15, r) is necessarily a factor of p, so we need that to be 1. Of course for prime p, gcd(p, q) is necessarily 1 for all q < p.
what's the value in using this "formula"? We could also keep extending this rule, and say that all primes greater than 5 are of the form 30k±1, 30k±7, 30k±11, or 30k±13. Or go further by multiplying coefficient of X with the next primes
Since this means every pair of twin primes > 3 must be separated by a multiple of 6, so they can be written as 6k+1, 6k-1. That means the product of any pair of twin primes will be of the form 36k^2-1.
In other words take any pair of twin primes, multiply them together, add 1, divide by 36, you are guaranteed to get a perfect square. E.g. 11*13=143, +1=144, /36=4 =2^2.
Or (and this one’s actually a little more complicated because it gets kind of casewise) you can show that the square of any prime (>3) is either one more or one less than a multiple of 24 (which is the product of the 6 and the 4 from the 6k and 4k rules)
The key to understanding primes is in relative primes and reduced residue sets. All patterns in (higher) primes (absolute) are generated by the members of RRS of smaller primes. This includes the clusters, such as twins, triple, quadruple, ..., primes. RRSs also hint [imo] at intimate connection between complex numbers and primes.
https://en.wikipedia.org/wiki/Primorial
https://en.wikipedia.org/wiki/Coprime_integers
You can think of the sieve of Eratosthenes as starting with an infinite string of 1 bits, then for each prime p, you AND it with a periodic infinite string that's all 1's except for 0's at multiples of p. Then repeat until you get to sqrt(sieve_size), with the next p being the next 1 bit in the string.
AND is associative so you could alternatively AND together several of the periodic strings first, then you get a string whose period is the product of the periods.
Could you use that to optimize? Yes. For example if your big sieve is 1GB, naively you'd need to do four 1GB passes to knock out four consecutive primes, say 11, 13, 17, 19. But you can instead calculate the combined action of those primes by doing four passes over a (much smaller!) bit vector of size 11x13x17x19, then apply that in one pass over the main 1GB sieve. (I guess you'd want to tune the max size of the small bit vector based on your cache size.)
Further optimizations are possible, e.g. you could special-case the smallest primes. With a trivial indexing change, you can have your sieve bits represent odd numbers only, and halve the memory requirement (or double the largest prime you can find with a fixed amount of memory). Subsequent primes (e.g. knocking out multiples of 3 so your bit vector only contains bits representing numbers of the form 6k±1) involve less trivial changes to the indexing logic with diminishing returns.
For commenters saying "well, doesn't anything in polar coordinates end up like spirals?", do yourself a favor and watch the video. He says as much pretty early on that yes, any plotting of the integers like that will look like spirals, but goes into excellent detail in my opinion explaining why the specific patterns you see with prime numbers are as they are.
Or multiply by 19.
-1 is a circle, brah!
Plotting primes p like this is plotting p*e^(ip), but the spirals are an interesting observation. You can straighten them out by adding a pi factor to the polar coordinate (so iside the sin...) but that's less interesting.
https://en.wikipedia.org/wiki/Goldbach%27s_conjecture
How is it that all even number are the sum of 2 primes and odd number the sum of 3 primes?
It matters for all the articles, so yes.
[0] https://terrytao.wordpress.com
[1] https://www.math.ucla.edu/~tao/preprints/Slides/primes.pdf
https://www.abc.net.au/news/science/2018-01-20/how-prime-num...
Seems the title is a bit misleading!
Another really interesting idea is to deliberately change the thing which you are rationally approximating; you don't have to rationally approximate π if you don't want to, that's just if you make steps of 1 radian. Make steps of q radians and you get the denominators for rational approximations of q/π.
This is used in the golden spiral algorithm[1] to evenly-ish distribute points on a sphere, we choose the most irrational number q/π = φ, the golden ratio. Since all of its rational approximations suck, the spirals are as inoffensive as they can be.
1. https://stackoverflow.com/questions/9600801/evenly-distribut...
https://i.ibb.co/59k5dRT/polarplot.png
Slightly more interesting is what the primes look like when one complete turn is defined as 1, 2, 3... 30 units:
[0] https://en.wikipedia.org/wiki/Dirichlet%27s_theorem_on_arith...
As far as we know, for now.