|
|
A330502
|
|
Least m >= n such that m(m+1)/2 - n(n-3)/2 is prime, or 0 if no such m exists.
|
|
4
|
|
|
2, 1, 3, 0, 5, 7, 7, 9, 13, 16, 11, 13, 13, 16, 15, 22, 18, 19, 28, 21, 21, 31, 23, 33, 25, 27, 27, 34, 33, 32, 43, 33, 33, 52, 35, 38, 37, 39, 43, 46, 42, 43, 43, 53, 46, 52, 47, 49, 58, 51, 51, 58, 53, 56, 55, 57, 58, 64, 63, 61, 61, 64, 64, 73, 65, 67, 67, 69, 73, 79, 71, 81
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
a(n) - n + 1 is the number of steps to reach a prime in the game described by Peter Luschny on the SeqFan list (cf. link): Start with n, then add m = n, n+1, n+2,... until a prime is reached.
See A330501 for the resulting prime, A329946 for the primes never reached.
|
|
LINKS
|
|
|
MATHEMATICA
|
Array[If[# == 3, 0, Block[{m = #}, While[! PrimeQ[m (m + 1)/2 - # (# - 3)/2], m++]; m]] &, 72, 0] (* Michael De Vlieger, Dec 16 2019 *)
|
|
PROG
|
(PARI) apply( {A330502(n, p=n)=if(n!=3, while(!isprime(p+=n), n++); n)}, [0..199])
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|