OFFSET
1,3
EXAMPLE
a(16) = 4 because prime(16) = 53 is involved in exactly four cases in A120627:
firstly, as prime(10) + 2k = 29 + 2*12 = 53, where k = A120627(10) = 12;
secondly, as prime(13) + 2k = 41 + 2*6 = 53, where k = A120627(13) = 6;
thirdly, as prime(15) + k = 47 + 6 = 53, where k = A120627(15) = 6;
and fourthly, as prime(16) = 53 itself, in front of a progression with k = A120627(16) = 18.
Visualization of the ranges of the four progressions:
29 31 37 41 43 47 53 59 61 67 71 73 79 83 89
k = 12 |___________|___________|
k = 6 |_______|___|
k = 6 |___|___|
k = 18 |_______________|_______________|
^
|
prime(16) = 53
in a(16) = 4
progressions
in A120627
PROG
(PARI)
a(max_n) = { my(mp=prime(max_n), v=vector(mp), vv=vector(max_n)); for(n=0, max_n, if(n<2, 0, my(p=prime(n), k); while(!isprime(p+k++)||!isprime(p+2*k), ); if(p+k<=mp, v[p+k]++); if(p<=mp, v[p]++); if(p+2*k<=mp, v[p+2*k]++))); for(n=1, max_n, vv[n]=v[prime(n)]); vv } \\ Thomas Scheuerle, Dec 05 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Tamas Sandor Nagy, Dec 03 2024
STATUS
approved