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.

A320170 Every pair of consecutive numbers sums to a palindrome, starting with a(0)=1; a(1)=10, and taking a(n) = smallest number > a(n-2).

Original entry on oeis.org

1, 10, 12, 21, 23, 32, 34, 43, 45, 54, 47, 64, 57, 74, 67, 84, 77, 94, 87, 104, 98, 114, 108, 124, 118, 134, 128, 144, 138, 154, 149, 164, 159, 174, 169, 184, 179, 194, 189, 204, 200, 214, 210, 224, 220, 234, 230, 244, 240, 254, 251, 264, 261, 274, 271
Offset: 0

Views

Author

Jim Singh, Oct 07 2018

Keywords

Crossrefs

Cf. A062932.
For n < 10, equals A061870 and A175885.

Programs

  • Mathematica
    Nest[Append[#, Block[{k = #[[-2]] + 1}, While[! PalindromeQ[#[[-1]] + k], k++]; k]] &, {1, 10}, 53] (* Michael De Vlieger, Oct 10 2018 *)
  • Python
    CurrentNum=10
    PreviousNum=1
    NewNum=0
    def NextPalindrome(StartNum):
        FoundNext=0
        t=0
        n=0
        Number=0
        Lastdigit=0
        while FoundNext<=PreviousNum:
            n=n+1
            t=StartNum+n
            Number=t
            Reverse=0
            while Number>0:
                Lastdigit=Number%10
                Reverse=(Reverse*10)+Lastdigit
                Number=Number//10
            if t==Reverse:
                FoundNext=n
        return n
    print(1)
    print(10)
    for x in range(50):
        NewNum=NextPalindrome(CurrentNum)
        print(NewNum)
        PreviousNum=CurrentNum
        CurrentNum=NewNum