login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A277487
a(n) = number of primes encountered before reaching (n^2)-1 when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k).
9
1, 0, 1, 0, 0, 1, 2, 1, 1, 0, 2, 1, 2, 0, 3, 2, 0, 3, 0, 2, 0, 1, 4, 2, 3, 2, 4, 2, 0, 3, 3, 2, 5, 3, 4, 3, 3, 3, 2, 4, 2, 2, 4, 3, 3, 3, 6, 3, 1, 3, 4, 2, 6, 3, 3, 2, 5, 5, 5, 5, 4, 3, 7, 4, 4, 6, 4, 2, 4, 6, 5, 5, 5, 4, 7, 4, 4, 7, 4, 0, 5, 6, 7, 4, 4, 9, 4, 5, 2, 6, 6, 7, 11, 3, 6, 4, 9, 5, 7, 7, 7, 6, 8, 8, 7, 6, 4, 6, 5, 7, 8, 5, 9, 8, 8, 5, 12, 7, 5, 6
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
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)
(define (A277487 n) (let ((org_k (- (A000290 (+ 1 n)) 1))) (let loop ((k org_k) (s 0)) (if (and (< k org_k) (= 1 (A010052 (+ 1 k)))) s (loop (- k (A002828 k)) (+ s (A010051 k)))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Nov 08 2016
STATUS
approved