OFFSET
1,2
COMMENTS
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..8192
Sean A. Irvine, Java program (github)
Rémy Sigrist, PARI program
Wikipedia, Stack (abstract data type)
FORMULA
a(n) = 1 iff n is odd.
a(A020989(k)) = k + 1 for any k >= 0.
EXAMPLE
The first terms, alongside the binary representation of n and the evolution of stack S, are:
n a(n) bin(n) S
- ---- ------ -------------------------------------------------
1 1 1 () -> (1)
2 2 10 (1) -> (1,1) -> (2)
3 1 11 (2) -> (2,1) -> (2,1,1)
4 3 100 (2,1,1) -> (2,1,1,1) -> (2,1,2) -> (2,3)
5 1 101 (2,3) -> (2,3,1) -> (2,4) -> (2,4,1)
6 2 110 (2,4,1) -> (2,4,1,1) -> (2,4,1,1,1) -> (2,4,1,2)
PROG
(Java) See Links section.
(PARI) See Links section.
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Jun 07 2019
STATUS
approved