A330569 a(n) = 1 if n is odd, otherwise a(n) = 2^(v-1)+1 where v is the 2-adic valuation of n (A007814(n)).
1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 9, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 17, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 9, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 33, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 9, 1, 2, 1, 3, 1
Offset: 1
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[n_] := If[OddQ[n], 1, 1 + 2^(IntegerExponent[n, 2] - 1)]; Array[a, 100] (* Amiram Eldar, Aug 30 2024 *)
-
PARI
a(n) = if(n % 2, 1, 1 + 1 << (valuation(n, 2) - 1)); \\ Amiram Eldar, Aug 30 2024
-
Python
def A330569(n): return 1+(0 if n&1 else 1<<(~n & n-1).bit_length()-1) # Chai Wah Wu, Jul 01 2022
Comments