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-3 of 3 results.

A358986 a(n) is the number of numbers of the form k + reverse(k) for at least one number k < 10^n.

Original entry on oeis.org

10, 28, 207, 548, 3966, 10462, 75435, 198890, 1433489, 3779246
Offset: 1

Views

Author

Jon E. Schoenfield, Dec 08 2022

Keywords

Comments

This sequence differs from the partial sums of A358985; see the Example section.

Examples

			There are 10 numbers of the form k + reverse(k) for 1-digit numbers k -- 0, 2, 4, 6, 8, 10, 12, 14, 16, and 18 -- so a(1) = 10.
There are 18 numbers of the form k + reverse(k) for 2-digit numbers k -- 11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, and 198 -- and none of these 18 numbers are among the 10 numbers counted in a(1), so a(2) = 10 + 18 = 28.
There are 180 numbers of the form k + reverse(k) for 3-digit numbers k, but exactly one of those -- 121 = 110 + reverse(110) = 110 + 11 -- is also a number of the form k + reverse(k) for a 2-digit number k: e.g., 29 + reverse(29) = 29 + 92 = 121. So a(3) = 10 + 18 + 180 - 1 = 207.
		

Crossrefs

Programs

  • Python
    def A358986(n):
        kset = set()
        for i in range(1,10**(n-1)):
            for j in range(int((s:=str(i))[0])+1):
                kset.add(10*i+j+int(str(j)+s[::-1]))
        return 10+len(kset) # Chai Wah Wu, Dec 09 2022

Extensions

a(8)-a(10) from Chai Wah Wu, Dec 09 2022

A371031 Number of distinct integers resulting from adding an n-digit non-multiple of 10 and its reverse.

Original entry on oeis.org

9, 17, 170, 323, 3230, 6137, 61370, 116603, 1166030, 2215457
Offset: 1

Views

Author

César Eliud Lozada, Mar 08 2024

Keywords

Examples

			For n=2 there are 81 2-digit numbers not ending with 0: {11, 12, 13, ..., 99}. There are 17 distinct results when adding each of these to their reversal: {22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143, 154, 165, 176, 187, 198}. Therefore a(2) = 17.
		

Crossrefs

Programs

  • Mathematica
    A371031[n_] :=
    Module[{nn, ss},
      nn = Select[Range[If[n == 1, 1, 10^(n - 1) + 1], 10^n - 1], Mod[#, 10] > 0 &];
      ss = Map[# + FromDigits[Reverse[IntegerDigits[#]]] &, nn];
      Return[CountDistinct[ss]]
    ];
    Map[A371031[#]&, Range[7]]

Formula

For n > 1, empirically a(n+1) = 10 a(n) if n even, 19 a(n) / 10 if n odd, and thus a(n+2) = 19 a(n). - Michael S. Branicky, Mar 31 2024

Extensions

a(9)-a(10) from Michael S. Branicky, Mar 30 2024

A359097 Number of distinct primes of type k + reverse(k) when k is a (2n - 1)-digit number.

Original entry on oeis.org

1, 25, 304, 3909, 58299, 907721
Offset: 1

Views

Author

Jean-Marc Rebert, Dec 16 2022

Keywords

Examples

			1 + reverse(1) = 2  is prime and for no other 1-digit number k, k + reverse(k) = 2k is prime, thus a(2*1-1) = a(1) = 1.
		

Crossrefs

Programs

  • PARI
    R(k)=fromdigits(Vecrev(digits(k)))
    a(n)=my(m=2*n-1,u=Set([]),mmin=10^(m-1),mmax=10^m-1,card=0);for(m=mmin,mmax,y=m+R(m);if(isprime(y)&&!setsearch(u,y),u=Set(concat(u,y));card++));card
Showing 1-3 of 3 results.