login
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
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
Peter Luschny, Hopping for primes, SeqFan list, Dec 13 2019.
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
Cf. A000217 (triangular numbers n(n+1)/2), A000096 (n(n+3)/2), A330501 (the final prime reached), A329946 (primes never reached).
Sequence in context: A280544 A078024 A112469 * A368213 A249455 A248967
KEYWORD
nonn
AUTHOR
M. F. Hasler, following an idea by Peter Luschny, Dec 16 2019
STATUS
approved