|
|
A325402
|
|
maxflip(n) = max(n, r(n)) where r(n) is the binary reverse of n.
|
|
2
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 13, 12, 13, 14, 15, 16, 17, 18, 25, 20, 21, 22, 29, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 49, 36, 41, 38, 57, 40, 41, 42, 53, 44, 45, 46, 61, 48, 49, 50, 51, 52, 53, 54, 59, 56, 57, 58, 59, 60, 61, 62, 63
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(10) = max(10, r(10))
= max(10, b'0101')
= max(10, 5)
= 10.
a(11) = max(11, r(11))
= max(11, b'1101')
= max(11, 13)
= 13.
|
|
MAPLE
|
a:= proc(n) local m, r; m:=n; r:=0;
while m>0 do r:=r*2+irem(m, 2, 'm') od;
max(n, r)
end:
|
|
PROG
|
(PARI) a(n) = max(n, fromdigits(Vecrev(binary(n)), 2)); \\ Michel Marcus, Apr 24 2019
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|