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!)
A244475 5th-largest term in the n-th row of Stern's diatomic triangle A002487. 4

%I #29 Mar 13 2023 06:27:22

%S 1,3,9,16,27,46,76,123,207,335,545,882,1428,2311,3740,6051,9791,15842,

%T 25633,41475,67108,108583,175691,284274,459965,744239,1204204,1948443,

%U 3152647,5101090,8253737

%N 5th-largest term in the n-th row of Stern's diatomic triangle A002487.

%H Jennifer Lansing, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL17/Lansing/lansing2.html">Largest Values for the Stern Sequence</a>, Journal of Integer Sequences, Vol. 17 (2014), Article 14.7.5.

%F Conjectured g.f.: -x^3*(x^14+ x^13+ x^12+ 2*x^11 +3*x^10 +5*x^9 +8*x^8 +x^7 +3*x^6 +3*x^5 +2*x^4 +4*x^3 +5*x^2 +2*x +1) / (x^2+x-1). - _Alois P. Heinz_, Jun 20 2022

%p A002487 := proc(n,k)

%p option remember;

%p if k =0 then

%p 1;

%p elif k = 2^n-1 then

%p n+1 ;

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

%p procname(n-1,k/2) ;

%p else

%p procname(n-1,(k-1)/2)+procname(n-1,(k+1)/2) ;

%p end if;

%p end proc:

%p A244475 := proc(n)

%p {seq(A002487(n,k),k=0..2^n-1)} ;

%p sort(%) ;

%p op(-5,%) ;

%p end proc:

%p for n from 3 do

%p print(A244475(n)) ;

%p od: # _R. J. Mathar_, Oct 25 2014

%t s[n_, k_] := s[n, k] = Which[k == 0, 1, k == 2^n-1, n+1, EvenQ[k], s[n-1, k/2], True, s[n-1, (k-1)/2] + s[n-1, (k+1)/2]];

%t row[n_] := Table[s[n, k], {k, 0, 2^n-1}];

%t a[n_] := If[n == 3, 1, Union[row[n]][[-5]]];

%t Table[Print[n, " ", a[n]]; a[n], {n, 3, 23}] (* _Jean-François Alcover_, Mar 13 2023, after _R. J. Mathar_ *)

%o (Python)

%o from itertools import product

%o from functools import reduce

%o def A244475(n): return sorted(set(sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if y else (x[0]+x[1],x[1]),k,(1,0))) for k in product((False,True),repeat=n)),reverse=True)[4] # _Chai Wah Wu_, Jun 19 2022

%Y Cf. A002487, A244472, A244473, A244474, A244476.

%K nonn,more

%O 3,2

%A _N. J. A. Sloane_, Jul 01 2014

%E a(24)-a(25) from _Alois P. Heinz_, Jun 19 2022

%E a(26)-a(33) from _Chai Wah Wu_, Jun 20 2022

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 19 14:10 EDT 2024. Contains 371792 sequences. (Running on oeis4.)