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.

A030666 Smallest nontrivial extension of n which is a square.

Original entry on oeis.org

16, 25, 36, 49, 529, 64, 729, 81, 900, 100, 1156, 121, 1369, 144, 1521, 169, 1764, 1849, 196, 2025, 2116, 225, 2304, 2401, 256, 2601, 2704, 289, 2916, 3025, 3136, 324, 3364, 3481, 35344, 361, 3721, 3844, 3969, 400, 41209, 4225, 4356, 441
Offset: 1

Views

Author

Keywords

Comments

A trivial extension would mean appending no digits at all when n is already a square. With trivial extensions allowed, this sequence becomes A018796.

Examples

			80 is not a perfect square, but 81 = 9^2, so a(8) = 81.
Although 9 is already a square, we need to append at least one digit. However, none of 90, 91, 92, ..., 99 are squares. Then we try 900 = 30^2, so a(9) = 900.
		

Crossrefs

See A264604 for another version (first differs at a(9)).

Programs

  • Maple
    # Program which computes 20000 terms, from N. J. A. Sloane, Nov 24 2015
    for b from 1 to 20000 do
    sw1:=-1:
    for p from 1 to 6 do
    bp:=b*10^p;
    for i from 0 to 10^p-1 do
    if issqr(bp+i) then lprint(b,bp+i); sw1:=1; break; fi;
                           od:
    if sw1 > 0 then break; fi;
                     od:
    if sw1 < 0 then lprint("failed at b = ",b); fi;
                          od:
  • Python
    from gmpy2 import isqrt
    def A030666(n):
        d, nd = 10, 10*n
        while True:
            x = (isqrt(nd-1)+1)**2
            if x < nd+d:
                return int(x)
            d *= 10
            nd *= 10 # Chai Wah Wu, May 24 2016

Formula

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