Are You Lucky?

Read Euler, Read Euler. The master of us all. — Pierre−Simon Laplace

--

This is the Ulam spiral and which is drawn with prime numbers which start in the centre and spiral out:

If we could find a pattern, our public key methods would likely be cracked.

Getting lucky

So how lucky are you? Well, basically, some people are more lucky than others, and it is the way that life goes. Many of us rely on lucky numbers, such as 7, 3 and 11, and see 13 are unlucky. But, Leonhard Euler found that a polynomial of:

k² + k -n

had six lucky numbers of 2, 3, 5, 11, 17 and 41 that produced a sequence of prime numbers [here]. A simple Python program to produce these is [here]:

import sys
n=41
if (len(sys.argv)>1):
n=int(sys.argv[1])

print(f"Trying lucky number of {n} for k^2-k+{n}\n")
for k in range(1, n):
prime=k*k-k+n
print(prime, end=' ')

And for an input of 41, we get a sequence of 41 prime numbers [here]:

Trying lucky number of 41 for k^2-k+41
41 43 47 53 61 71 83 97 113 131 151 173 197 223 251 281 313 347…

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.