cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A342121 a(n) is the remainder when the larger of n and its binary reverse is divided by the smaller.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 9, 6, 0, 6, 4, 0, 0, 6, 0, 0, 0, 0, 0, 14, 0, 4, 13, 18, 0, 4, 0, 10, 5, 0, 17, 14, 0, 14, 12, 0, 8, 10, 0, 4, 0, 18, 12, 4, 0, 14, 0, 0, 0, 0, 0, 30, 0, 12, 21, 42, 0, 0, 33, 30, 1, 12, 21, 42, 0
Offset: 1

Views

Author

Rémy Sigrist, Feb 28 2021

Keywords

Comments

The binary reverse of a number is given by A030101.
This sequence is the analog of A061467 for the binary base.

Examples

			For n = 43,
- the binary reverse of 43 ("101011" in binary) is 53 ("110101" in binary),
- so a(43) = 53 mod 43 = 10.
		

Crossrefs

Programs

  • Mathematica
    rbr[n_]:=Module[{r=IntegerReverse[n,2]},If[r>n,Mod[r,n],Mod[n,r]]]; Array[rbr,100] (* Harvey P. Dale, Mar 18 2023 *)
  • PARI
    a(n, base=2) = { my (r=fromdigits(Vecrev(digits(n, base)), base)); max(n, r) % min(n, r) }
    
  • Python
    def A342121(n):
        a, b = sorted([n,int(bin(n)[:1:-1],2)])
        return b % a if n > 0 else 0 # Chai Wah Wu, Mar 01 2021

Formula

a(n) = max(n, A030101(n)) mod min(n, A030101(n)).
a(n) = min(A342122(n), A342123(n)).
a(n) < n.
a(n) = 0 iff n belongs to A057890.

A342123 a(n) is the remainder when n is divided by its binary reverse.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Feb 28 2021

Keywords

Comments

The binary reverse of a number is given by A030101.
This sequence is the analog of A071955 for the binary base.

Examples

			For n = 43,
- the binary reverse of 43 ("101011" in binary) is 53 ("110101" in binary),
- so a(43) = 43 mod 53 = 43.
		

Crossrefs

Programs

  • 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

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.
Showing 1-2 of 2 results.