A305099 Least prime m such that either prime(n)# - m is prime or prime(n)# + m is prime, where p# denotes the product of all primes <= p.
3, 3, 7, 11, 13, 17, 19, 23, 37, 41, 67, 59, 47, 47, 67, 59, 61, 89, 89, 103, 79, 83, 89, 97, 103, 131, 113, 127, 223, 191, 163, 179, 389, 239, 151, 167, 173, 239, 199, 191, 199, 223, 233, 593, 293, 457, 227, 311, 373, 257, 307, 313, 283, 277, 271, 307, 307
Offset: 1
Keywords
Examples
For n = 6, the sixth primorial is 30030. The nearest prime such that p(6)# plus or minus prime equals its 30030's closest prime is equal to 17 because 30030+17=30047 which is prime or 30030 - 17 = 30013 which is also prime. Given that we only care about the smallest prime distance to the closest prime to the primorial, then we return 17. For n = 7, the seventh primorial is 510510. The closest prime to the primorial is 510529 which is 510510 + 19; therefore 19 is in the sequence.
References
- Martin Gardner, The Last Recreations (1997), pp. 194-195.
- R. K. Guy, Unsolved Problems in Number Theory, Section A2
- Stephen P. Richards, A Number For Your Thoughts, 1982, p. 200.
Links
- S. W. Golomb, Evidence of Fortunes conjecture, Mathematics Magazine, Vol. 54, No. 4 (Sep., 1981), pp. 209-210.
- The Prime Glossary, Fortunate and lesser fortunate numbers
Programs
-
Mathematica
primorial[n_] := Product[Prime[i], {i, 1, n}]; a[n_] := Module[{k = 2, pr = primorial[n]}, While[! PrimeQ[pr - k] && ! PrimeQ[pr + k], k = NextPrime[k]]; k]; Array[a, 57] (* Amiram Eldar, Oct 31 2018 *)
-
PARI
a(n) = { my(pr = prod(k=1, n, prime(k)), m=2); while (!isprime(pr-m) && !isprime(pr+m), m = nextprime(m+1)); m;} \\ Michel Marcus, Nov 02 2018
-
Sage
# returns quasi-fortunate-numbers up to n def generateQFN(n): quasi_fortunate_numbers = [] primorialArray = [] prime = Primes() num_length = n+1 primorial = 1 for i in range(num_length): primorial *= prime[i] primorialArray.append(primorial) for primorials in primorialArray: num = 0 while num < num_length: if is_prime(primorials+prime[num]): quasi_fortunate_numbers.append(prime[num]) break elif is_prime(primorials-prime[num]): quasi_fortunate_numbers.append(prime[num]) break num += 1 return quasi_fortunate_numbers generateQFN(7)
Extensions
More terms from Amiram Eldar, Oct 31 2018
Comments