Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #57 Oct 09 2021 01:10:28
%S 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,
%T 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,
%U 6,6,5,3,3,2,16,4,18,4,2,4,5,6,6,1,4,17,17
%N 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.
%C In this sequence, a subsequence is considered ascending for as long as a (3*n + 1) / 2 step is required.
%H Douglas Boffey, <a href="/A346965/b346965.txt">Table of n, a(n) for n = 1..20000</a>
%H Douglas Boffey, <a href="/A346965/a346965.c.txt">Code used for generating b-file</a>
%F a(2^n) = 0.
%F a((2^n*(2*x+1)-1) * 2^y) = a(3^n*(2*x+1)-1) + 1, where x, y >= 0.
%e a(9) = 4, viz.
%e 9->14;
%e 14->7->11->17->26;
%e 26->13->20;
%e 20->10->5->8.
%o (C) /* A007814 */
%o int num_clear_bits(unsigned n) {
%o if (n == 0)
%o return -1;
%o return log2(n & -n);
%o }
%o int A346965(unsigned n) {
%o int x;
%o int result = 0;
%o n >>= num_clear_bits(n);
%o while (n > 1) {
%o x = num_clear_bits(n + 1);
%o n = ((n >> x) + 1) * pow(3, x) - 1;
%o n >>= num_clear_bits(n);
%o ++result;
%o }
%o return result;
%o }
%Y Cf. A070168, A078719, A221469.
%K nonn
%O 1,7
%A _Douglas Boffey_, Aug 09 2021