|
|
A244474
|
|
4th-largest term in n-th row of Stern's diatomic triangle A002487.
|
|
4
|
|
|
2, 4, 10, 17, 29, 47, 79, 128, 208, 337, 546, 883, 1429, 2312, 3741, 6053, 9794, 15847, 25641, 41488, 67129, 108617
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
3,1
|
|
LINKS
|
|
|
FORMULA
|
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
|
|
MAPLE
|
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:
sort(%) ;
op(-4, %) ;
end proc:
for n from 3 do
|
|
MATHEMATICA
|
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 = Table[s[n], {n, 0, 2^25}] // Flatten // SplitBy[#, If[# == 1, 1, 0]&]& // DeleteCases[#, {1}]&;
|
|
PROG
|
(Python)
from itertools import product
from functools import reduce
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|