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.

A048411 Squares whose consecutive digits differ by 1.

Original entry on oeis.org

0, 1, 4, 9, 121, 676, 12321, 1234321, 123454321, 12345654321, 1234567654321, 123456787654321, 12345678987654321
Offset: 1

Views

Author

Patrick De Geest, Apr 15 1999

Keywords

Comments

a(14), if it exists, is > 10^34. - Lars Blomberg, Nov 25 2016
Is it true that all terms are palindromes? - Chai Wah Wu, Apr 06 2018
a(14), if it exists, is > 10^52. - Michael S. Branicky, Apr 22 2025

Crossrefs

Cf. A010052; intersection of A033075 and A000290.

Programs

  • Haskell
    a048411 n = a048411_list !! (n-1)
    a048411_list = filter ((== 1) . a010052) a033075_list
    -- Reinhard Zumkeller, Feb 21 2012
    
  • Mathematica
    Select[Range[0, 10^7]^2, Or[# == 0, IntegerLength@ # == 1, Union@ Abs@ Differences@ IntegerDigits@ # == {1}] &] (* Michael De Vlieger, Nov 25 2016 *)
  • Python
    from sympy.ntheory.primetest import is_square
    def gen(d, s=None):
        if d == 0: yield tuple(); return
        if s == None:
            yield from [(i, ) + g for i in range(1, 10) for g in gen(d-1, s=i)]
        else:
            if s > 0: yield from [(s-1, ) + g for g in gen(d-1, s=s-1)]
            if s < 9: yield from [(s+1, ) + g for g in gen(d-1, s=s+1)]
    def afind(maxdigits):
        print(0, end=", ")
        for d in range(1, maxdigits+1):
            for g in gen(d, s=None):
                t = int("".join(map(str, g)))
                if is_square(t): print(t, end=", ")
    afind(17) # Michael S. Branicky, Sep 26 2021

Formula

a(n) = A048412(n)^2.