OFFSET
0,3
COMMENTS
a(n) tells in what number we end in n steps, when we start climbing up the infinite trunk of the "binary beanstalk" from its root (zero). The name "beanstalk" is due to Antti Karttunen.
There are many finite sequences such as 0,1,2; 0,1,3,4,7,9; etc. obeying the same condition (see A218254) and as the length increases, so (necessarily) does the similarity to this infinite sequence.
LINKS
Alois P. Heinz and Antti Karttunen, Table of n, a(n) for n = 0..16405 (first 1000 terms from Alois P. Heinz)
Paul Tek, Illustration of the first terms
FORMULA
a(0)=0, a(1)=1, and for n > 1, if n = A218600(A213711(n)) then a(n) = (2^A213711(n)) - 1, and in other cases, a(n) = a(n+1) - A213712(n+1). (This formula is based on Carl White's observation that this iterated/converging path must pass through each (2^n)-1. However, it would be very interesting to know whether the sequence admits more traditional recurrence(s), referring to previous, not to further terms in the sequence in their definition!) - Antti Karttunen, Oct 26 2012
MATHEMATICA
TakeWhile[Reverse@ NestWhileList[# - DigitCount[#, 2, 1] &, 10^3, # > 0 &], # <= 209 &] (* Michael De Vlieger, Sep 12 2016 *)
PROG
(Scheme with Antti Karttunen's Intseq-library for memoizing macro definec):
(definec (A179016 n) (cond ((< n 2) n) ((= (A218600 (A213711 n)) n) (- (expt 2 (A213711 n)) 1)) (else (- (A179016 (+ n 1)) (A213712 (+ n 1)))))) ;; Antti Karttunen, Nov 05 2012
;; Alternatively:
CROSSREFS
Cf. A000120, A010062, A011371, A213710, A213711, A213717, A213730, A213731, A218600, A218616, A218789, A233271, A218602, A054429. First differences: A213712, complement: A213713.
Rows of A218254, when reversed, converge towards this sequence.
KEYWORD
easy,nice,nonn,base
AUTHOR
Carl R. White, Jun 24 2010
EXTENSIONS
Starting offset changed from 1 to 0 by Antti Karttunen, Nov 05 2012
STATUS
approved