cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A330261 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 u-v; a(n) gives the number on top of S after processing n.

This page as a plain text file.
%I A330261 #13 Feb 27 2020 23:16:34
%S A330261 1,0,1,-1,1,0,1,-2,1,1,1,-1,1,0,1,-3,1,4,1,0,1,0,1,-2,1,1,1,-1,1,0,1,
%T A330261 -4,1,5,1,7,1,0,1,-1,1,0,1,0,1,0,1,-3,1,2,1,0,1,0,1,-2,1,1,1,-1,1,0,1,
%U A330261 -5,1,5,1,-4,1,0,1,3,1,-3,1,1,1,0,1,-2,1,-2
%N A330261 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 u-v; a(n) gives the number on top of S after processing n.
%C A330261 This sequence is a variant of A308551.
%C A330261 After processing n, S has A268289(n) elements.
%C A330261 Every integer appears infinitely many times in the sequence:
%C A330261 - the effect of the binary string b(0) = "110" is to leave 0 on top of S,
%C A330261 - the effect of the binary string b(1) = "1" is to leave 1 on top of S,
%C A330261 - the effect of the binary string b(-1) = "11100" is to leave -1 on top of S,
%C A330261 - let "|" denote the binary concatenation,
%C A330261 - for any k > 0:
%C A330261    - the effect of b(k+1) = b(-1)|b(k)|"0" is to leave k+1 on top of S,
%C A330261    - the effect of b(-k-1) = b(1)|b(-k)|"0" is to leave -k-1 on top of S,
%C A330261 - for any k, for any n > 0, if the binary representation of n ends with b(k), then a(n) = k, QED,
%C A330261 - see A330264 for the values in order of appearance.
%H A330261 Rémy Sigrist, <a href="/A330261/b330261.txt">Table of n, a(n) for n = 1..8192</a>
%H A330261 Rémy Sigrist, <a href="/A330261/a330261.png">Scatterplot of the first 2^20 terms</a>
%H A330261 Rémy Sigrist, <a href="/A330261/a330261.gp.txt">PARI program for A330261</a>
%F A330261 a(2*k-1) = 1 for any k > 0.
%e A330261 The first terms, alongside the binary representation of n and the evolution of stack S, are:
%e A330261   n   a(n)  bin(n)  S
%e A330261   --  ----  ------  ------------------------------------------------------------
%e A330261    1     1       1  () -> (1)
%e A330261    2     0      10  (1) -> (1,1) -> (0)
%e A330261    3     1      11  (0) -> (0,1) -> (0,1,1)
%e A330261    4    -1     100  (0,1,1) -> (0,1,1,1) -> (0,1,0) -> (0,-1)
%e A330261    5     1     101  (0,-1) -> (0,-1,1) -> (0,2) -> (0,2,1)
%e A330261    6     0     110  (0,2,1) -> (0,2,1,1) -> (0,2,1,1,1) -> (0,2,1,0)
%e A330261    7     1     111  (0,2,1,0) -> (0,2,1,0,1) -> (0,2,1,0,1,1) -> (0,2,1,0,1,1,1)
%o A330261 (PARI) See Links section.
%Y A330261 Cf. A268289, A308551, A330261, A330264.
%K A330261 sign,base
%O A330261 1,8
%A A330261 _Rémy Sigrist_, Dec 07 2019