OFFSET
1,1
COMMENTS
Since it is known that the first 2000 terms of A005235 are primes, and the first 1000 terms of A055211 are primes, then the first 1000 terms of this sequence are also the least m > 1 such that prime(n)# - m is prime or prime(n)# + m is prime. - Amiram Eldar, Nov 02 2018
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
EXAMPLE
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.
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 *)
PROG
(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)
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
David Nicolas Lopez, May 22 2018
EXTENSIONS
More terms from Amiram Eldar, Oct 31 2018
STATUS
approved