login
A342123
a(n) is the remainder when n is divided by its binary reverse.
3
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 2, 0, 0, 0, 0, 0, 19, 0, 0, 9, 23, 0, 6, 4, 0, 0, 6, 0, 0, 0, 0, 0, 35, 0, 37, 13, 39, 0, 4, 0, 43, 5, 0, 17, 47, 0, 14, 12, 0, 8, 10, 0, 55, 0, 18, 12, 4, 0, 14, 0, 0, 0, 0, 0, 67, 0, 69, 21, 71, 0, 0, 33, 75, 1, 77, 21
OFFSET
1,11
COMMENTS
The binary reverse of a number is given by A030101.
This sequence is the analog of A071955 for the binary base.
FORMULA
a(n) = n mod A030101(n).
a(n) <= n with equality iff n belongs to A161601.
a(n) = 0 iff n belongs to A057890.
EXAMPLE
For n = 43,
- the binary reverse of 43 ("101011" in binary) is 53 ("110101" in binary),
- so a(43) = 43 mod 53 = 43.
PROG
(PARI) a(n, base=2) = { my (r=fromdigits(Vecrev(digits(n, base)), base)); n%r }
(Python)
def A342123(n): return n % int(bin(n)[:1:-1], 2) if n > 0 else 0 # Chai Wah Wu, Mar 01 2021
CROSSREFS
KEYWORD
nonn,base,look,easy
AUTHOR
Rémy Sigrist, Feb 28 2021
STATUS
approved