cp's OEIS Frontend

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.

A244474 4th-largest term in n-th row of Stern's diatomic triangle A002487.

This page as a plain text file.
%I A244474 #17 Mar 12 2023 10:45:00
%S A244474 2,4,10,17,29,47,79,128,208,337,546,883,1429,2312,3741,6053,9794,
%T A244474 15847,25641,41488,67129,108617
%N A244474 4th-largest term in n-th row of Stern's diatomic triangle A002487.
%H A244474 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 A244474 G.f.: (-2-2*x-4*x^2-3*x^3-2*x^4-x^5-3*x^6-2*x^7-x^8-x^9-x^10)/(-1+x+x^2) (conjectured) - _Jean-François Alcover_, Mar 12 2023
%p A244474 A002487 := proc(n,k)
%p A244474     option remember;
%p A244474     if k =0 then
%p A244474         1;
%p A244474     elif k = 2^n-1 then
%p A244474         n+1 ;
%p A244474     elif type(k,'even') then
%p A244474         procname(n-1,k/2) ;
%p A244474     else
%p A244474         procname(n-1,(k-1)/2)+procname(n-1,(k+1)/2) ;
%p A244474     end if;
%p A244474 end proc:
%p A244474 A244474 := proc(n)
%p A244474     {seq(A002487(n,k),k=0..2^n-1)} ;
%p A244474     sort(%) ;
%p A244474     op(-4,%) ;
%p A244474 end proc:
%p A244474 for n from 3 do
%p A244474     print(A244474(n)) ;
%p A244474 od: # _R. J. Mathar_, Oct 25 2014
%t A244474 s[n_] := s[n] = Switch[n, 0, 0, 1, 1, _, If[EvenQ[n], s[n/2], s[(n - 1)/2] + s[(n - 1)/2 + 1]]];
%t A244474 T = Table[s[n], {n, 0, 2^25}] // Flatten // SplitBy[#, If[# == 1, 1, 0]&]& // DeleteCases[#, {1}]&;
%t A244474 Union[#][[-4]]& /@ T[[5 ;;]] (* _Jean-François Alcover_, Mar 12 2023 *)
%o A244474 (Python)
%o A244474 from itertools import product
%o A244474 from functools import reduce
%o A244474 def A244474(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)[3] # _Chai Wah Wu_, Jun 20 2022
%Y A244474 Cf. A002487, A244472, A244473, A244475, A244476.
%K A244474 nonn,more
%O A244474 3,1
%A A244474 _N. J. A. Sloane_, Jul 01 2014
%E A244474 a(24) from _Jean-François Alcover_, Mar 12 2023