|
|
A082404
|
|
Triangle in which n-th row gives trajectory of n under the map x -> x/2 if x is even, x -> x-1 if x is odd, stopping when we reach 1.
|
|
2
|
|
|
1, 2, 1, 3, 2, 1, 4, 2, 1, 5, 4, 2, 1, 6, 3, 2, 1, 7, 6, 3, 2, 1, 8, 4, 2, 1, 9, 8, 4, 2, 1, 10, 5, 4, 2, 1, 11, 10, 5, 4, 2, 1, 12, 6, 3, 2, 1, 13, 12, 6, 3, 2, 1, 14, 7, 6, 3, 2, 1, 15, 14, 7, 6, 3, 2, 1, 16, 8, 4, 2, 1, 17, 16, 8, 4, 2, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
If you write down 0 when dividing by 2, 1 when subtracting 1, the trajectory gives the binary expansion of n.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
Triangle begins:
1;
2, 1;
3, 2, 1;
4, 2, 1,
5, 4, 2, 1;
6, 3, 2, 1;
7, 6, 3, 2, 1;
8, 4, 2, 1;
9, 8, 4, 2, 1;
...
|
|
MAPLE
|
A082404 := proc(n, k) option remember: if(k = 1)then return n:elif(A082404(n, k-1) mod 2 = 0)then return A082404(n, k-1)/2: else return A082404(n, k-1)-1: fi: end:
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn,tabf
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|