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”).
%I #22 Nov 14 2016 10:35:39
%S 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,
%T 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,
%U 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
%N 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).
%C Number of primes on row n of A276574, after the initial zero-row.
%C 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).
%C On the other hand, when a(n) is compared to A277488(n), there is no such marked bias.
%H Antti Karttunen, <a href="/A277487/b277487.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) <= A277891(n).
%e 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.
%o (PARI)
%o 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
%o isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7
%o A002828(n)=if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))) \\ From _Charles R Greathouse_ IV, Jul 19 2011
%o 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; };
%o for(n=1, 10000, write("b277487.txt", n, " ", A277487(n)));
%o (Scheme)
%o (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)))))))
%Y Cf. A000290, A002828, A010052, A276574, A277486, A277488, A277890, A277891, A278167 (partial sums).
%Y Cf. A277888.
%K nonn
%O 1,7
%A _Antti Karttunen_, Nov 08 2016