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.

A357195 a(n) is the smallest palindrome of the form k*(2*n+k-1)/2 where k is a positive integer.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 33, 11, 969, 222, 99, 66, 33, 242, 282, 424, 161, 66, 22, 212, 252, 646, 171, 55, 252, 414, 555, 525, 99, 33, 474, 1001, 111, 5005, 77, 484, 1111, 1881, 414, 808, 44, 606, 141, 404, 303, 99, 101, 555, 444, 333, 222, 55, 171, 484
Offset: 1

Views

Author

Gleb Ivanov, Sep 17 2022

Keywords

Crossrefs

Programs

  • PARI
    ispal(p) = my(d=digits(p)); d==Vecrev(d);
    a(n) = my(k=1); while(!ispal(x=k*(2*n+k-1)/2), k++); x; \\ Michel Marcus, Sep 17 2022
  • Python
    pal10 = lambda n: str(n) == str(n)[::-1]
    def seq(n):
        k = 1
        while not pal10(k*(2*n+k-1)//2):k+=1
        return k*(2*n+k-1)//2
    print([seq(n) for n in range(1, 100)])
    
  • Python
    from itertools import count
    def A357195(n): return next(filter(lambda n:(s := str(n))[:(t:=len(s)+1>>1)]==s[:-t-1:-1],(k*((n<<1)+k-1)>>1 for k in count(1)))) # Chai Wah Wu, Oct 29 2022