|
| |
|
|
A163575
|
|
The changepoint a(n) is the first predecessor from n in a binary tree with: a(n) mod 2 <> n mod 2
|
|
0
| |
|
|
0, 1, 0, 1, 2, 3, 0, 1, 4, 5, 2, 3, 6, 7, 0, 1, 8, 9, 4, 5, 10, 11, 2, 3, 12, 13, 6, 7, 14, 15, 0, 1, 16, 17, 8, 9, 18, 19, 4, 5, 20, 21, 10, 11, 22, 23, 2, 3, 24, 25, 12, 13, 26, 27, 6, 7, 28, 29, 14, 15, 30, 31, 0, 1, 32, 33, 16, 17, 34, 35, 8, 9, 36, 37, 18, 19, 38, 39, 4, 5, 40, 41, 20
(list; graph; refs; listen; history; internal format)
|
|
|
|
OFFSET
| 1,5
|
|
|
COMMENTS
| In a binary tree (node(row,col)=2^(row-1)+(col-1))
__________1________
_____2________3____
____4_5______6_7___
. . . . . . . . . .
has any node 2 successors and one predecessor. a(n) ist the first
predecessor from n (going back, step by step) with another last digit (in binary sight) as n.
the subsequences from a(2^k) to a(2^(k+1) - 1) are permutations from the
natural numbers from 0 to 2^k-1
|
|
|
LINKS
| Wikipedia, Calkin Wilf Tree
Wikipedia, Stern Brocot Tree
|
|
|
EXAMPLE
| A(7) = A(b111) = b0 = 0
A(17) = A(b10001) = b1000 = 8
A(8) = A(b1000) = b1 = 1
|
|
|
PROG
| (Other) FUNCTION CHANGEPOINT
INPUT n
IF EVEN(n)
..WHILE EVEN(n)
....n = n/2
ELSE
..WHILE NOT EVEN(n)
....n = (n-1)/2
OUTPUT n
|
|
|
CROSSREFS
| Sequence in context: A143325 A128888 A168068 * A163465 A004443 A171616
Adjacent sequences: A163572 A163573 A163574 * A163576 A163577 A163578
|
|
|
KEYWORD
| nonn
|
|
|
AUTHOR
| Helmut Kreindl (euler(AT)chello.at), Jul 31 2009
|
| |
|
|