login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A342122 a(n) is the remainder when the binary reverse of n is divided by n. 3
0, 1, 0, 1, 0, 3, 0, 1, 0, 5, 2, 3, 11, 7, 0, 1, 0, 9, 6, 5, 0, 13, 6, 3, 19, 11, 0, 7, 23, 15, 0, 1, 0, 17, 14, 9, 4, 25, 18, 5, 37, 21, 10, 13, 0, 29, 14, 3, 35, 19, 0, 11, 43, 27, 4, 7, 39, 23, 55, 15, 47, 31, 0, 1, 0, 33, 30, 17, 12, 49, 42, 9, 0, 41, 30 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,6
COMMENTS
The binary reverse of a number is given by A030101.
This sequence is the analog of A103168 for the binary base.
LINKS
FORMULA
a(n) = A030101(n) mod n.
a(n) < n.
a(n) = 0 iff n is a binary palindrome (A006995).
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
Sequence in context: A178921 A046665 A100574 * A056100 A141665 A136689
KEYWORD
nonn,base,look,easy
AUTHOR
Rémy Sigrist, Feb 28 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 11:31 EDT 2024. Contains 371792 sequences. (Running on oeis4.)