login
A335426
a(1) = 0; thereafter a(2^(2^k)) = 0 for k > 0, and for other even numbers n, a(n) = 1+a(n/2), and for odd numbers n, a(n) = 2*a(A064989(n)).
2
0, 1, 2, 0, 4, 3, 8, 1, 0, 5, 16, 4, 32, 9, 6, 0, 64, 1, 128, 6, 10, 17, 256, 5, 0, 33, 2, 10, 512, 7, 1024, 1, 18, 65, 12, 2, 2048, 129, 34, 7, 4096, 11, 8192, 18, 8, 257, 16384, 6, 0, 1, 66, 34, 32768, 3, 20, 11, 130, 513, 65536, 8, 131072, 1025, 12, 2, 36, 19, 262144, 66, 258, 13, 524288, 3, 1048576, 2049, 2, 130, 24, 35, 2097152, 8, 0, 4097
OFFSET
1,3
FORMULA
a(1) = 0, and then after, a(2^(2^k)) = 0 for k > 0, and for other even numbers n, a(n) = 1+a(n/2), and for odd numbers n, a(n) = 2*a(A064989(n)).
a(n) = A335427(A225546(n)).
a(A003961(n)) = 2 * a(n).
PROG
(PARI)
A064989(n) = {my(f); f = factor(n); if((n>1 && f[1, 1]==2), f[1, 2] = 0); for (i=1, #f~, f[i, 1] = precprime(f[i, 1]-1)); factorback(f)};
A209229(n) = (n && !bitand(n, n-1));
A335426(n) = if(n<=2, n-1, if(!(n%2), if(A209229(n) && A209229(valuation(n, 2)), 0, 1+A335426(n/2)), 2*A335426(A064989(n))));
\\ Alternatively:
A335426(n) = if(1==n, 0, my(e=isprimepower(n)); if(e>1 && A209229(e), 0, if(!(n%2), 1+A335426(n/2), 2*A335426(A064989(n)))));
CROSSREFS
Cf. A082522 (gives indices of zeros after a(1)=0).
Sequence in context: A345232 A277333 A248663 * A348405 A093443 A366372
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jun 15 2020
STATUS
approved