OFFSET
0,1
COMMENTS
In other words, a(n) = smallest k >= 1 such that n + k(k+1)/2 is a prime. - N. J. A. Sloane, Oct 20 2014
Do we know that a(n) always exists? - N. J. A. Sloane, Oct 20 2014
Conjecturally (Hardy & Littlewood conjecture F), a(n) exists for all n. - Charles R Greathouse IV, Oct 21 2014
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
EXAMPLE
a(1)=1 because 1+[1]=2 which is prime.
a(2)=1 because 2+[1] =3 which is prime.
a(3)=4 because 3+[1+2+3+4]=13 which is prime, and intermediate sums are composite.
MATHEMATICA
lst = {}; Do[k = 1; While[! PrimeQ[n + k (k + 1)/2], k++]; AppendTo[lst, k], {n, 0, 100}]; lst (* Ivan N. Ianakiev, Oct 21 2014 *)
PROG
(PARI) a(n) = {k=1; while (!isprime(n + k*(k+1)/2), k++); k; } \\ Michel Marcus, Oct 21 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gil Broussard, Oct 20 2014
EXTENSIONS
Definition edited by N. J. A. Sloane, Oct 20 2014
Mathematica code adapted to the offset by Vincenzo Librandi Oct 21 2014
STATUS
approved