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 A240388 #49 Jan 25 2024 05:22:45 %S A240388 0,1,1,2,1,2,2,4,1,4,2,3,2,5,4,6,1,6,4,5,2,3,3,7,2,9,5,7,4,9,6,8,1,8, %T A240388 6,9,4,7,5,9,2,7,3,4,3,8,7,11,2,13,9,12,5,8,7,15,4,17,9,11,6,13,8,10, %U A240388 1,10,8,13,6,11,9,17,4,15,7,8,5,12,9,13,2,11,7,8,3,4,4,10,3,14,8,12,7,16,11,15,2,17,13,20,9,16,12,22,5,18,8,10,7,18,15,23,4,25,17,22,9,14,11,23,6,25,13,15,8,17,10,12,1 %N A240388 A sequence related to the Stern sequence s(n) (A002487), defined by w(n) = s(3n)/2. %C A240388 The even terms in the Stern sequence, divided by 2. %H A240388 Alois P. Heinz, <a href="/A240388/b240388.txt">Table of n, a(n) for n = 0..16384</a> %H A240388 Jennifer Lansing, <a href="http://jointmathematicsmeetings.org/amsmtgs/2160_abstracts/1096-11-1220.pdf">On the Stern sequence and a related sequence</a>, Joint Mathematics Meetings, Baltimore, 2014. %H A240388 Jennifer Lansing, <a href="/A240388/a240388.pdf">Dissertation: On the Stern sequence and a related sequence</a>, PhD dissertation, University of Illinois, 2014. %H A240388 Jennifer Lansing, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL17/Lansing/lansing2.html">Largest Values for the Stern Sequence</a>, J. Integer Seqs., 17 (2014), #14.7.5. %F A240388 w(0)=0, w(1)=1, and w(3)=2. For n >= 1, w(n) satisfies the recurrences w(2n)=w(n), w(8n +/- 1)=w(4n +/- 1) + 2w(n), w(8n +/- 3)=w(4n +/- 1) + w(2n +/- 1) -w(n). %F A240388 a(n) = A002487(3*n) / 2. - _Joerg Arndt_, Jun 20 2022 %e A240388 w(7) = w(8-1) = w(3)+2w(1) = 2+2 = 4. %e A240388 w(11) = w(8+3) = w(4+1)+w(2+1)-w(1)=w(5)+w(3)-w(1) = 2+2-1 = 3. %e A240388 Comment from _N. J. A. Sloane_, Jul 01 2014: (Start) %e A240388 May be arranged as a triangle: %e A240388 0 %e A240388 1 %e A240388 1 %e A240388 2 1 2 %e A240388 2 4 1 4 2 %e A240388 3 2 5 4 6 1 6 4 5 2 3 %e A240388 3 7 2 9 5 7 4 9 6 8 1 8 6 9 4 7 5 9 2 7 3 %e A240388 ... (End) %p A240388 A240388 := proc(n) %p A240388 option remember; %p A240388 local nloc; %p A240388 if n <=1 then %p A240388 n; %p A240388 elif n = 3 then %p A240388 2; %p A240388 elif type(n,'even') then %p A240388 procname(n/2) ; %p A240388 elif modp(n,8) = 1 then %p A240388 nloc := (n-1)/8 ; %p A240388 procname(4*nloc+1)+2*procname(nloc) ; %p A240388 elif modp(n,8) = 7 then %p A240388 nloc := (n+1)/8 ; %p A240388 procname(4*nloc-1)+2*procname(nloc) ; %p A240388 elif modp(n,8) = 3 then %p A240388 nloc := (n-3)/8 ; %p A240388 procname(4*nloc+1)+procname(2*nloc+1)-procname(nloc) ; %p A240388 else %p A240388 nloc := (n+3)/8 ; %p A240388 procname(4*nloc-1)+procname(2*nloc-1)-procname(nloc) ; %p A240388 end if; %p A240388 end proc: # _R. J. Mathar_, Jul 05 2014 %p A240388 # second Maple program: %p A240388 b:= proc(n) option remember; `if`(n<2, n, %p A240388 (q-> b(q)+(n-2*q)*b(n-q))(iquo(n, 2))) %p A240388 end: %p A240388 a:= n-> b(3*n)/2: %p A240388 seq(a(n), n=0..128); # _Alois P. Heinz_, Jun 20 2022 %t A240388 Clear[s]; s[0] = 0; s[1] = 1; s[n_?EvenQ] := s[n] = s[n/2]; %t A240388 s[n_?OddQ] := %t A240388 s[n] = s[(n + 1)/2] + s[(n - 1)/2] (* For the Stern sequence *) %t A240388 Clear[w]; w[n_] = 1/2 s[3 n] %o A240388 (PARI) a(n)=my(a=1, b=0); n*=3; while(n>0, if(n%2, b+=a, a+=b); n>>=1); b/2 \\ _Charles R Greathouse IV_, May 27 2014 %o A240388 (Python) %o A240388 from functools import reduce %o A240388 def A240388(n): return sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(3*n)[-1:2:-1],(1,0)))//2 # _Chai Wah Wu_, Jun 20 2022 %Y A240388 Cf. A002487. %K A240388 nonn,look,easy %O A240388 0,4 %A A240388 _Jennifer Lansing_, Apr 04 2014