login
Record values in A002487.
6

%I #30 Sep 24 2024 06:06:34

%S 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,

%T 55,60,67,69,76,79,89,97,108,109,123,128,129,131,144,157,175,178,181,

%U 199,207,208,233,254,257,283,287,322,335,337,338,343,377,411,458,465,467,474

%N Record values in A002487.

%C Distinct elements of A270362. - _Jeffrey Shallit_, Mar 16 2016.

%H Charles R Greathouse IV, <a href="/A212289/b212289.txt">Table of n, a(n) for n = 1..646</a>

%H Ali Keramatipour and Jeffrey Shallit, <a href="https://arxiv.org/abs/2205.06223">Record-Setters in the Stern Sequence</a>, arXiv:2205.06223 [math.CO], 2022.

%F a(n) = fusc(A212288(n)).

%t 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 *)

%o (PARI) fusc(n)=my(a=1, b=0); while(n, if(n%2, b+=a, a+=b); n>>=1); b

%o r=-1;for(n=0,1e5,t=fusc(n); if(t>r,r=t;print1(t", ")))

%o (Python)

%o from itertools import count, islice

%o from functools import reduce

%o def A212289_gen(): # generator of terms

%o yield (c:= 0)

%o for n in count(1):

%o 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)))

%o if m>c: yield (c:=m)

%o A212289_list = list(islice(A212289_gen(),30)) # _Chai Wah Wu_, Sep 23 2024

%Y Cf. A002487, A212288.

%K nonn

%O 1,3

%A _Charles R Greathouse IV_, Jun 13 2012

%E a(1)=0 prepended in terms, b-file and programs by _Georg Fischer_, Jun 24 2020