OFFSET
0,4
COMMENTS
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
MATHEMATICA
a[n_] := Module[{k}, For[k = 0, True, k++,
If[BitXor[n, n*2^k] == n*(2^k+1), Return[k]]]];
Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Nov 19 2021 *)
PROG
(PARI) a(n)=my(k); while(bitxor(n, n<<k)-n!=n<<k, k++); k \\ Charles R Greathouse IV, Mar 07 2013
(Python)
from itertools import count
def A116361(n): return next(k for k in count(0) if n^(m:=n<<k)==m+n) # Chai Wah Wu, Jul 19 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Feb 04 2006
EXTENSIONS
Offset corrected by Charles R Greathouse IV, Mar 07 2013
STATUS
approved