A253719 Least k>0 such that n AND (n^k) <= 1, where AND denotes the bitwise AND operator.
1, 1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 4, 2, 4, 4, 2, 2, 2, 2, 2, 3, 6, 5, 4, 2, 4, 2, 8, 3, 8, 5, 2, 2, 2, 2, 2, 2, 2, 3, 6, 2, 2, 4, 12, 2, 4, 4, 4, 2, 4, 2, 10, 3, 14, 6, 8, 2, 8, 6, 16, 3, 16, 6, 2, 2, 2, 2, 2, 2, 2, 4, 2, 3, 4, 4, 4, 2, 4, 4, 6, 2, 2, 5, 8, 4
Offset: 0
Examples
11 AND (11^1) = 11, 11 AND (11^2) = 9, 11 AND (11^3) = 3, 11 AND (11^4) = 1, hence a(11)=4.
Links
- Paul Tek, Table of n, a(n) for n = 0..100000
Crossrefs
Cf. A224694.
Programs
-
PARI
a(n) = my(k=1, nk=n); while (bitand(n, nk)>1, k=k+1; nk=nk*n); return (k)
Comments