This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A277488 #9 Nov 14 2016 10:35:46 %S A277488 0,1,0,2,1,1,0,3,2,3,2,1,1,2,1,3,2,3,1,2,4,4,1,2,3,2,2,3,4,3,3,4,3,4, %T A277488 3,2,4,5,5,4,4,3,4,5,4,4,3,4,6,4,6,8,4,4,3,5,7,3,7,2,6,6,4,7,7,4,5,7, %U A277488 4,8,6,4,4,3,6,11,4,5,5,9,6,3,6,7,6,9,9,8,11,6,5,5,7,8,7,7,5,8,9,5,7,6,5,6,7,6,8,9,6,9,6,15,8,10,9,7,10,6,6,10 %N A277488 a(n) = number of integers one less than a prime encountered before reaching (n^2)-1 when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k). %C A277488 Only 325 cases in range n=1..10000 where a(n) >= A277486(n). See also comments in A277487. %H A277488 Antti Karttunen, <a href="/A277488/b277488.txt">Table of n, a(n) for n = 1..10000</a> %F A277488 For all n >= 1, a(n) <= A277890(n). %e A277488 For n=6, we start iterating from k = ((6+1)^2)-1 = 48, and then 48 - A002828(48) = 45, 45 - A002828(45) = 43, 43 - A002828(43) = 40, 40 - A002828(40) = 38, and 38 - A002828(38) = 35 (which is 6^2 - 1), and when we add one to each, only 41 is prime, thus a(6) = 1. %o A277488 (PARI) %o A277488 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 A277488 isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7 %o A277488 A002828(n)=if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))) \\ From _Charles R Greathouse_ IV, Jul 19 2011 %o A277488 A277488(n) = { my(orgk = ((n+1)^2)-1); my(k = orgk, s = 0); while(((k == orgk) || !issquare(1+k)), s = s + if(isprime(1+k),1,0); k = k - A002828(k)); s; }; %o A277488 for(n=1, 10000, write("b277488.txt", n, " ", A277488(n))); %o A277488 (Scheme) %o A277488 (define (A277488 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 (+ 1 k)))))))) %Y A277488 Cf. A000290, A010051, A010052, A276574, A277486, A277487, A277890, A278168 (partial sums). %K A277488 nonn %O A277488 1,4 %A A277488 _Antti Karttunen_, Nov 08 2016