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.

A342114 Take a(n), reverse it, divide the biggest of the two numbers by the other one and keep only the remainder. The successive remainders, concatenated, reproduce the successive terms of the sequence, concatenated.

Original entry on oeis.org

25, 13, 14, 247, 250, 149, 52, 29, 1, 290, 12, 31, 275, 18, 188, 2, 157, 260, 38, 92, 24, 27, 190, 125, 146, 28, 3, 17, 104, 295, 592, 255, 83, 206, 285, 115, 137, 170, 71, 140, 26, 410, 109, 143, 21, 369, 193, 820, 138, 490, 15, 309, 289, 16, 106, 580, 601, 256, 82, 227, 4, 62, 23, 154, 168, 37, 32
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Feb 28 2021

Keywords

Comments

In reversing a number, leading zeros are erased. Palindromes in base 10 leave 0 as remainder.
This is the lexicographically earliest sequence of distinct positive terms with this property.

Examples

			a(1) = 25, which reversed is 52; 52/25 leaves a remainder 2;
a(2) = 13, which reversed is 31; 31/13 leaves a remainder 5;
a(3) = 14, which reversed is 41; 41/14 leaves a remainder 13;
a(4) = 247, which reversed is 742; 742/247 leaves a remainder 1;
a(5) = 250, which reversed is 52 (leading zeros are erased); 250/52 leaves a remainder 42;
a(6) = 149, which reversed is 941; 941/149 leaves a remainder 47;
a(7) = 52, which reversed is 25; 52/25 leaves a remainder 2; etc.
The successive remainders (concatenated) reproduce the (concatenated) terms of the sequence.
		

Crossrefs

Cf. A061467 (remainder when the larger of n and its reverse is divided by the smaller), A002113 (palindromes in base 10).
Showing 1-2 of 2 results.