login
A393188
a(n) = u(n) OR (u(n) - 1) where u(n) = n + (n AND -n) assuming a two's complement representation for negative values.
2
3, 7, 7, 15, 7, 15, 15, 31, 11, 15, 15, 31, 15, 31, 31, 63, 19, 23, 23, 31, 23, 31, 31, 63, 27, 31, 31, 63, 31, 63, 63, 127, 35, 39, 39, 47, 39, 47, 47, 63, 43, 47, 47, 63, 47, 63, 63, 127, 51, 55, 55, 63, 55, 63, 63, 127, 59, 63, 63, 127, 63, 127, 127, 255
OFFSET
1,1
COMMENTS
Computed by Wolfram's 2-state 2-symbol Turing machine 2079 when started with n on the tape.
MATHEMATICA
a[n_] := BitOr[#, # - 1] &[n + BitAnd[n, -n]]; Array[a, 64] (* Michael De Vlieger, Feb 06 2026 *)
PROG
(PARI) a(n) = my(u=n + bitand(n, -n)); bitor(u, u-1); \\ Michel Marcus, Feb 07 2026
(Python) def a(n): return n + (n & -n) | (n + (n & -n)) - 1 # Aitzaz Imtiaz, Feb 07 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Sean A. Irvine, Feb 04 2026
STATUS
approved