OFFSET
1,2
COMMENTS
Also, least k such that 2n = A001223(k-1) = prime(k+1) - prime(k), where prime(k) = A001223(n). - Alexander Adamchuk, Jul 30 2006
Also the least number k>0 such that the k-th maximal run of composite numbers has length 2n-1. For example, the 8th such run (24,25,26,27,28) is the first of length 2(3)-1, so a(3) = 8. Also positions of first appearances in A176246 (A046933 without first term). - Gus Wiseman, Jun 12 2024
LINKS
FORMULA
a(n) = A038664(n) - 1. - Filip Zaludek, Nov 19 2016
EXAMPLE
a(3) = 8 because 1+0+2-2+2-2+2+2 = 5 and (5+1)/2 = 3.
MATHEMATICA
NextPrim[n_Integer] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; a = Table[0, {50}]; s = 0; k = 1; p = 0; q = 2; r = 3; While[k < 10^6, p = q; q = r; r = NextPrim[q]; s = s + p + r - 2q; If[s < 101 && a[[(s + 1)/2]] == 0, a[[(s + 1)/2]] = k]; k++ ]; a
PROG
(PARI) a001223(n) = prime(n+1) - prime(n);
a(n) = {my(k = 1); while(2*n != A001223(k+1), k++); k; } \\ Michel Marcus, Nov 20 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert G. Wilson v, Aug 15 2002
STATUS
approved