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!)
A240388 A sequence related to the Stern sequence s(n) (A002487), defined by w(n) = s(3n)/2. 2

%I #49 Jan 25 2024 05:22:45

%S 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 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 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 A sequence related to the Stern sequence s(n) (A002487), defined by w(n) = s(3n)/2.

%C The even terms in the Stern sequence, divided by 2.

%H Alois P. Heinz, <a href="/A240388/b240388.txt">Table of n, a(n) for n = 0..16384</a>

%H 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 Jennifer Lansing, <a href="/A240388/a240388.pdf">Dissertation: On the Stern sequence and a related sequence</a>, PhD dissertation, University of Illinois, 2014.

%H 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 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 a(n) = A002487(3*n) / 2. - _Joerg Arndt_, Jun 20 2022

%e w(7) = w(8-1) = w(3)+2w(1) = 2+2 = 4.

%e w(11) = w(8+3) = w(4+1)+w(2+1)-w(1)=w(5)+w(3)-w(1) = 2+2-1 = 3.

%e Comment from _N. J. A. Sloane_, Jul 01 2014: (Start)

%e May be arranged as a triangle:

%e 0

%e 1

%e 1

%e 2 1 2

%e 2 4 1 4 2

%e 3 2 5 4 6 1 6 4 5 2 3

%e 3 7 2 9 5 7 4 9 6 8 1 8 6 9 4 7 5 9 2 7 3

%e ... (End)

%p A240388 := proc(n)

%p option remember;

%p local nloc;

%p if n <=1 then

%p n;

%p elif n = 3 then

%p 2;

%p elif type(n,'even') then

%p procname(n/2) ;

%p elif modp(n,8) = 1 then

%p nloc := (n-1)/8 ;

%p procname(4*nloc+1)+2*procname(nloc) ;

%p elif modp(n,8) = 7 then

%p nloc := (n+1)/8 ;

%p procname(4*nloc-1)+2*procname(nloc) ;

%p elif modp(n,8) = 3 then

%p nloc := (n-3)/8 ;

%p procname(4*nloc+1)+procname(2*nloc+1)-procname(nloc) ;

%p else

%p nloc := (n+3)/8 ;

%p procname(4*nloc-1)+procname(2*nloc-1)-procname(nloc) ;

%p end if;

%p end proc: # _R. J. Mathar_, Jul 05 2014

%p # second Maple program:

%p b:= proc(n) option remember; `if`(n<2, n,

%p (q-> b(q)+(n-2*q)*b(n-q))(iquo(n, 2)))

%p end:

%p a:= n-> b(3*n)/2:

%p seq(a(n), n=0..128); # _Alois P. Heinz_, Jun 20 2022

%t Clear[s]; s[0] = 0; s[1] = 1; s[n_?EvenQ] := s[n] = s[n/2];

%t s[n_?OddQ] :=

%t s[n] = s[(n + 1)/2] + s[(n - 1)/2] (* For the Stern sequence *)

%t Clear[w]; w[n_] = 1/2 s[3 n]

%o (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 (Python)

%o from functools import reduce

%o 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 Cf. A002487.

%K nonn,look,easy

%O 0,4

%A _Jennifer Lansing_, Apr 04 2014

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 23 20:33 EDT 2024. Contains 371916 sequences. (Running on oeis4.)