login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A277891 a(n) = number of odd numbers encountered before reaching (n^2)-1 when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k). 5

%I #20 Nov 14 2016 10:36:40

%S 1,0,2,1,2,2,4,2,4,3,4,4,6,5,7,6,5,6,7,7,6,6,11,9,9,9,12,9,10,9,11,11,

%T 12,11,14,13,15,12,14,14,16,14,15,13,15,17,18,17,14,17,19,18,20,17,22,

%U 19,22,20,20,22,20,22,23,22,24,25,22,22,25,26,26,25,28,24,30,26,28,29,27,27,28,32,29,28,32,32,29,31,30,29,35,33,32,32,35,34,35,36

%N a(n) = number of odd numbers encountered before reaching (n^2)-1 when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k).

%C The starting point ((n+1)^2)-1 of the iteration is included if it is odd, but the ending point (n^2)-1 is never included in the count.

%C a(n) = number of odd numbers on row n of A276574, after the initial zero-row.

%C On the average, the odd terms in A276573 (A276574) seem to occur more frequently than the even terms. (The last point in range 1..10000 where a(n) <= A277890(n) is n=862). See also comments in A277487 and the plot of ratio a(n)/A277890(n), also the plot of A277889.

%H Antti Karttunen, <a href="/A277891/b277891.txt">Table of n, a(n) for n = 1..10000</a>

%H A. Karttunen, <a href="https://oeis.org/plot2a?name1=A277891&amp;name2=A277890&amp;tform1=untransformed&amp;tform2=untransformed&amp;shift=0&amp;radiop1=ratio&amp;drawlines=true">Ratio a(n)/A277890(n) drawn with OEIS Plot 2 tool</a>

%F a(n) + A277890(n) = A260734(n).

%F a(n) >= A277487(n).

%e For n=6, we start iterating from k = ((6+1)^2)-1 = 48, with k -> k - A002828(k), to obtain 48 -> 45 -> 43 -> 40 -> 38 before reaching 35 (which is 6^2 - 1, an ending point and thus not included in the count), and the only odd numbers before that were 45 and 43, thus a(6) = 2.

%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 A277891(n) = { my(orgk = ((n+1)^2)-1); my(k = orgk, s = 0); while(((k == orgk) || !issquare(1+k)), s = s + (k%2); k = k - A002828(k)); s; };

%o for(n=1, 10000, write("b277891.txt", n, " ", A277891(n)));

%o (Scheme)

%o (define (A277891 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 (A000035 k)))))))

%Y Cf. A000035, A000290, A002828, A010052, A077773, A260733, A260734, A276574, A277191, A277192, A277487, A277889, A277890.

%K nonn

%O 1,3

%A _Antti Karttunen_, Nov 08 2016

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 05:19 EDT 2024. Contains 371918 sequences. (Running on oeis4.)