login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A334820 Sequence is limit_{t->oo} s_t, where s_k = s_{k-1},s_{k-1}[k-1..end] starting with s_0 = s_0[0..1] = 0,1. 2

%I #54 Aug 22 2021 13:27:42

%S 0,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,

%T 1,1,0,1,0,1,0,1,1,0,1,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,1,

%U 1,0,1,1,0,1,1,0,1,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,1,1,0,1,0,1

%N Sequence is limit_{t->oo} s_t, where s_k = s_{k-1},s_{k-1}[k-1..end] starting with s_0 = s_0[0..1] = 0,1.

%C A nonperiodic sequence of 0 and 1.

%H Kevin Ryde, <a href="http://user42.tuxfamily.org/seq-A334820/index.html">PARI/GP code and explanation</a>.

%p s:= proc(n) option remember; `if`(n=0, [0, 1][],

%p (l-> [l[], l[n..-1][]][])([s(n-1)]))

%p end:

%p s(10); # gives 1035 = A005126(10) terms; # _Alois P. Heinz_, May 12 2020

%t a[n_] := If[n<2, n, Module[{k = Floor@Log[2, n], m = n}, m-=k+1; While[k >= 0, If[BitGet[m, k]==0, m++; If[BitGet[m, k]==1, Return[1]]]; k--]]; 0];

%t a /@ Range[0, 104] (* _Jean-François Alcover_, Nov 16 2020, after _Kevin Ryde_ *)

%o (PARI) a(n) = { if(n, my(k=logint(n,2)); n-=k+1; while(k>=0, if(!bittest(n,k), n++; if(bittest(n,k), return(1))); k--)); 0; } \\ _Kevin Ryde_, Jun 26 2020

%Y Cf. A005126 (s lengths), A057215.

%K nonn

%O 0,1

%A _Richard Aime Blavy_, May 12 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 18:49 EDT 2024. Contains 371781 sequences. (Running on oeis4.)