OFFSET
1,7
COMMENTS
Number of primes on row n of A276574, after the initial zero-row.
Note how for the most n in range 1..10000, a(n) < A277486(n), even though for the most n in the same range A277890(n) < A277891(n). In range n=1..10000, there are only 209 cases where a(n) >= A277486(n).
On the other hand, when a(n) is compared to A277488(n), there is no such marked bias.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
FORMULA
a(n) <= A277891(n).
EXAMPLE
For n=3, starting from k = ((3+1)^2)-1, and iterating k -> A255131(k), yields 15 -> 11 -> 8, where the iteration stops as the next lower number one less than a square has been reached. Of these numbers only 11 is a prime, thus a(3) = 1.
PROG
(PARI)
istwo(n:int)=my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1
isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7
A002828(n)=if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))) \\ From _Charles R Greathouse_ IV, Jul 19 2011
A277487(n) = { my(orgk = ((n+1)^2)-1); my(k = orgk, s = 0); while(((k == orgk) || !issquare(1+k)), s = s + if(isprime(k), 1, 0); k = k - A002828(k)); s; };
for(n=1, 10000, write("b277487.txt", n, " ", A277487(n)));
(Scheme)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 08 2016
STATUS
approved