login
A337567
Let a(0) = 1, k(0) = 1. For n >= 1; if a(n-1) + k(n-1) is a prime, then a(n) = a(n-1) + k(n-1), k(n) = k(n-1); else a(n) = a(n-1) + k(n-1) + 1, k(n) = k(n-1) + 1.
0
1, 2, 3, 5, 7, 10, 13, 17, 22, 28, 35, 43, 52, 61, 71, 82, 94, 107, 121, 136, 151, 167, 184, 202, 221, 241, 262, 283, 305, 328, 352, 377, 403, 430, 457, 485, 514, 544, 575, 607, 640, 673, 707, 742, 778, 815, 853, 892, 932, 973, 1015, 1058, 1102, 1147, 1193, 1240
OFFSET
0,2
COMMENTS
Empirically a(n) ~ (e*n/4)^2; n-th gap a(n) - a(n-1) = k(n) ~ sqrt(e*n); the number of primes pi(a(n)) = n^(2*e/7).
EXAMPLE
a(0) = 1, k(0) = 1;
1 + 1 = 2 is prime, a(1) = 2, k(1) = 1;
2 + 1 = 3 is prime, a(2) = 3, k(2) = 1;
3 + 1 = 4 is not a prime, a(3) = 3 + 1 + 1 = 5, k(3) = 2;
5 + 2 = 7 is prime, a(4) = 7, k(4) = 2;
7 + 2 = 9 is not a prime, a(5) = 7 + 2 + 1 = 10, k(5) = 3;
and so on.
MATHEMATICA
a[0] = {1, 1}; a[n_] := a[n] = If[PrimeQ[(s = Plus @@ a[n - 1])], {s, a[n - 1][[2]]}, {s, a[n - 1][[2]]} + 1]; First /@ Array[a, 50, 0] (* Amiram Eldar, Sep 03 2020 *)
PROG
(PARI) lista(nn) = {my(a = 1, k = 1, list = List()); for (n=1, nn, listput(list, a); if (isprime(a+k), a += k, a += k+1; k++); ); Vec(list); } \\ Michel Marcus, Sep 01 2020
CROSSREFS
Cf. A000040.
Sequence in context: A177337 A117143 A253170 * A177332 A318155 A282569
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Sep 01 2020
EXTENSIONS
More terms from Michel Marcus, Sep 01 2020
STATUS
approved