|
|
A346965
|
|
a(n) is the number of ascending subsequences in reducing n to 1 using the Collatz reduction, or -1 if n refutes the Collatz conjecture.
|
|
1
|
|
|
0, 0, 1, 0, 1, 1, 3, 0, 4, 1, 3, 1, 2, 3, 2, 0, 3, 4, 4, 1, 1, 3, 2, 1, 5, 2, 17, 3, 4, 2, 16, 0, 6, 3, 2, 4, 4, 4, 6, 1, 17, 1, 6, 3, 4, 2, 16, 1, 5, 5, 5, 2, 2, 17, 17, 3, 7, 4, 6, 2, 3, 16, 15, 0, 6, 6, 5, 3, 3, 2, 16, 4, 18, 4, 2, 4, 5, 6, 6, 1, 4, 17, 17
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,7
|
|
COMMENTS
|
In this sequence, a subsequence is considered ascending for as long as a (3*n + 1) / 2 step is required.
|
|
LINKS
|
|
|
FORMULA
|
a(2^n) = 0.
a((2^n*(2*x+1)-1) * 2^y) = a(3^n*(2*x+1)-1) + 1, where x, y >= 0.
|
|
EXAMPLE
|
a(9) = 4, viz.
9->14;
14->7->11->17->26;
26->13->20;
20->10->5->8.
|
|
PROG
|
int num_clear_bits(unsigned n) {
if (n == 0)
return -1;
return log2(n & -n);
}
int x;
int result = 0;
n >>= num_clear_bits(n);
while (n > 1) {
x = num_clear_bits(n + 1);
n = ((n >> x) + 1) * pow(3, x) - 1;
n >>= num_clear_bits(n);
++result;
}
return result;
}
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|