A212289 Record values in A002487.
0, 1, 2, 3, 4, 5, 7, 8, 9, 11, 13, 14, 15, 18, 19, 21, 23, 26, 29, 30, 34, 37, 41, 47, 49, 50, 55, 60, 67, 69, 76, 79, 89, 97, 108, 109, 123, 128, 129, 131, 144, 157, 175, 178, 181, 199, 207, 208, 233, 254, 257, 283, 287, 322, 335, 337, 338, 343, 377, 411, 458, 465, 467, 474
Offset: 1
Keywords
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..646
- Ali Keramatipour and Jeffrey Shallit, Record-Setters in the Stern Sequence, arXiv:2205.06223 [math.CO], 2022.
Programs
-
Mathematica
Union@ FoldList[Max, Nest[Append[#1, If[OddQ[#2], #1[[(#2 + 1)/2]], #1[[#2/2]] + #1[[(#2 + 2)/2]] ]] & @@ {#, Length@ # + 1} &, {0, 1}, 10^4]] (* Michael De Vlieger, Jul 10 2019 *)
-
PARI
fusc(n)=my(a=1, b=0); while(n, if(n%2, b+=a, a+=b); n>>=1); b r=-1;for(n=0,1e5,t=fusc(n); if(t>r,r=t;print1(t", ")))
-
Python
from itertools import count, islice from functools import reduce def A212289_gen(): # generator of terms yield (c:= 0) for n in count(1): m = sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0))) if m>c: yield (c:=m) A212289_list = list(islice(A212289_gen(),30)) # Chai Wah Wu, Sep 23 2024
Formula
a(n) = fusc(A212288(n)).
Extensions
a(1)=0 prepended in terms, b-file and programs by Georg Fischer, Jun 24 2020
Comments