login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Start with an empty stack S; for n = 1, 2, 3, ..., interpret the binary representation of n from left to right as follows: in case of bit 1, push the number 1 on top of S, in case of bit 0, replace the two numbers on top of S, say u on top of v, with v-u; a(n) gives the number on top of S after processing n.
2

%I #11 Feb 27 2020 23:16:02

%S 1,0,1,1,1,0,1,0,1,-1,1,1,1,0,1,1,1,0,1,2,1,0,1,0,1,-1,1,1,1,0,1,0,1,

%T -1,1,-1,1,0,1,-1,1,-2,1,0,1,0,1,1,1,0,1,2,1,0,1,0,1,-1,1,1,1,0,1,1,1,

%U -1,1,0,1,0,1,-3,1,-3,1,1,1,0,1,2,1,-2,1

%N Start with an empty stack S; for n = 1, 2, 3, ..., interpret the binary representation of n from left to right as follows: in case of bit 1, push the number 1 on top of S, in case of bit 0, replace the two numbers on top of S, say u on top of v, with v-u; a(n) gives the number on top of S after processing n.

%C This sequence is a variant of A330261.

%C After processing n, S has A268289(n) elements.

%C Every integer appears infinitely many times in the sequence:

%C - the proof is similar to that found in A330261,

%C - see A330265 for the values in order of appearance.

%H Rémy Sigrist, <a href="/A330262/b330262.txt">Table of n, a(n) for n = 1..8192</a>

%H Rémy Sigrist, <a href="/A330262/a330262.png">Scatterplot of the first 2^20 terms</a>

%H Rémy Sigrist, <a href="/A330262/a330262.gp.txt">PARI program for A330262</a>

%e The first terms, alongside the binary representation of n and the evolution of stack S, are:

%e n a(n) bin(n) S

%e - ---- ------ ------------------------------------------------------------

%e 1 1 1 () -> (1)

%e 2 0 10 (1) -> (1,1) -> (0)

%e 3 1 11 (0) -> (0,1) -> (0,1,1)

%e 4 1 100 (0,1,1) -> (0,1,1,1) -> (0,1,0) -> (0,1)

%e 5 1 101 (0,1) -> (0,1,1) -> (0,0) -> (0,0,1)

%e 6 0 110 (0,0,1) -> (0,0,1,1) -> (0,0,1,1,1) -> (0,0,1,0)

%e 7 1 111 (0,0,1,0) -> (0,0,1,0,1) -> (0,0,1,0,1,1) -> (0,0,1,0,1,1,1)

%o (PARI) See Links section.

%Y Cf. A268289, A308551, A330261, A330265.

%K sign,base

%O 1,20

%A _Rémy Sigrist_, Dec 07 2019