OFFSET
1,6
COMMENTS
LINKS
EXAMPLE
For n = 43,
- the binary reverse of 43 ("101011" in binary) is 53 ("110101" in binary),
- so a(43) = 53 mod 43 = 10.
MATHEMATICA
Table[Mod[FromDigits[Reverse[IntegerDigits[n, 2]], 2], n], {n, 80}] (* Harvey P. Dale, Mar 01 2023 *)
PROG
(PARI) a(n, base=2) = { my (r=fromdigits(Vecrev(digits(n, base)), base)); r%n }
(Python)
def A342122(n): return int(bin(n)[:1:-1], 2) % n if n > 0 else 0 # Chai Wah Wu, Mar 01 2021
CROSSREFS
KEYWORD
AUTHOR
Rémy Sigrist, Feb 28 2021
STATUS
approved