A244475 5th-largest term in the n-th row of Stern's diatomic triangle A002487.
1, 3, 9, 16, 27, 46, 76, 123, 207, 335, 545, 882, 1428, 2311, 3740, 6051, 9791, 15842, 25633, 41475, 67108, 108583, 175691, 284274, 459965, 744239, 1204204, 1948443, 3152647, 5101090, 8253737
Offset: 3
Links
- Jennifer Lansing, Largest Values for the Stern Sequence, Journal of Integer Sequences, Vol. 17 (2014), Article 14.7.5.
Programs
-
Maple
A002487 := proc(n,k) option remember; if k =0 then 1; elif k = 2^n-1 then n+1 ; elif type(k,'even') then procname(n-1,k/2) ; else procname(n-1,(k-1)/2)+procname(n-1,(k+1)/2) ; end if; end proc: A244475 := proc(n) {seq(A002487(n,k),k=0..2^n-1)} ; sort(%) ; op(-5,%) ; end proc: for n from 3 do print(A244475(n)) ; od: # R. J. Mathar, Oct 25 2014
-
Mathematica
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]]; row[n_] := Table[s[n, k], {k, 0, 2^n-1}]; a[n_] := If[n == 3, 1, Union[row[n]][[-5]]]; Table[Print[n, " ", a[n]]; a[n], {n, 3, 23}] (* Jean-François Alcover, Mar 13 2023, after R. J. Mathar *)
-
Python
from itertools import product from functools import reduce 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
Formula
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
Extensions
a(24)-a(25) from Alois P. Heinz, Jun 19 2022
a(26)-a(33) from Chai Wah Wu, Jun 20 2022