OFFSET
0,1
COMMENTS
A mathematical game for kids suggested by Peter Luschny on the SeqFan list:
Start with n and then (cumulatively) add m = n, n+1, n+2, ... until a prime p = T(m) - n(n-3)/2 is reached. The only n which never yields a prime is n = 3.
LINKS
M. F. Hasler, Table of n, a(n) for n = 0..9999
Peter Luschny, Hopping for primes, SeqFan list, Dec 13 2019.
EXAMPLE
Starting with n = 0, we add 0: sum = 0, not prime, then 1: sum = 1, not prime, then 2: sum = 3, a prime, so a(0) = 3.
Starting with n = 1, we add 1: sum = 2, a prime, so a(1) = 2.
Starting with n = 2, we add 2: sum = 4, not prime, then 3: sum = 7, a prime, so a(2) = 7.
Starting with n = 3 = T(2) = 2(2+1)/2 (triangular number, cf. A000217), we add 3 to get T(2) + 3 = T(3) = 6, then 4 to get T(3) + 4 = T(4) = 10, and so on. A triangular number T(n) = n(n+1)/2 > 3 is never prime, since either product of n and (n+1)/2, or product of n/2 and n+1. So a(3) = 0.
MATHEMATICA
Array[If[# == 3, 0, Block[{m = #, p}, While[! PrimeQ[Set[p, m (m + 1)/2 - # (# - 3)/2]], m++]; p]] &, 64, 0] (* Michael De Vlieger, Dec 16 2019 *)
PROG
(PARI) apply( {A330501(n, p=n)=if(n!=3, while(!isprime(p+=n), n++); p)}, [0..399])
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler, following an idea of Peter Luschny, Dec 16 2019
STATUS
approved