|
|
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).
|
|
6
|
|
|
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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
Only 325 cases in range n=1..10000 where a(n) >= A277486(n). See also comments in A277487.
|
|
LINKS
|
|
|
FORMULA
|
For all n >= 1, a(n) <= A277890(n).
|
|
EXAMPLE
|
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.
|
|
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
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; };
for(n=1, 10000, write("b277488.txt", n, " ", A277488(n)));
(Scheme)
(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))))))))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|