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.

A068165 Smallest square formed from n by inserting zero or more decimal digits.

Original entry on oeis.org

1, 25, 36, 4, 25, 16, 576, 81, 9, 100, 121, 121, 1369, 144, 1156, 16, 1764, 1089, 169, 2025, 121, 225, 2304, 324, 25, 256, 2704, 289, 289, 2304, 361, 324, 3136, 324, 3025, 36, 3721, 3481, 1369, 400, 441, 4225, 4356, 144, 4225, 4096, 4761, 484, 49, 2500
Offset: 1

Views

Author

Amarnath Murthy, Feb 25 2002

Keywords

Comments

The digits may be added before, in the middle of, or after the digits of n.
If n is a square then a(n) = n. - Zak Seidov, Nov 13 2014

Examples

			Smallest square formed from 20 is 2025, by placing 25 on the right side. Smallest square formed from 33 is 3136, by inserting a 1 between 3's and placing a 6.
		

Crossrefs

A091873 gives square roots. Cf. A038690, A029944, A068164.

Programs

  • Maple
    A068165 := proc(n)
            local b,pdigs,plen,dmas,dmasdigs,i,j;
            for b from 1 do
                    pdigs := convert(b^2,base,10) ;
                    plen := nops(pdigs) ;
                    for dmas from 2^plen-1 to 0 by -1 do
                            dmasdigs := convert(dmas,base,2) ;
                            pdel := [] ;
                            for i from 1 to nops(dmasdigs) do
                                    if op(i,dmasdigs) = 1 then
                                            pdel := [op(pdel),op(i,pdigs)] ;
                                    end if;
                            end do:
                            if n = add(op(j,pdel)*10^(j-1),j=1..nops(pdel)) then
                                    return b^2;
                            end if;
                    end do:
            end do:
    end proc:
    seq(A068165(n),n=1..133) ; # R. J. Mathar, Nov 14 2014
  • Python
    from math import isqrt
    from itertools import count
    def dmo(n, t):
        if t < n: return False
        while n and t:
            if n%10 == t%10:
                n //= 10
            t //= 10
        return n == 0
    def a(n):
        return next(t for t in (i*i for i in count(isqrt(n))) if dmo(n, t))
    print([a(n) for n in range(1, 77)]) # Michael S. Branicky, Jan 21 2023

Extensions

Corrected and extended by Ray Chandler, Oct 11 2003

A038690 a(n)^2 is smallest square containing the string 'n'.

Original entry on oeis.org

0, 1, 5, 6, 2, 5, 4, 24, 9, 3, 10, 34, 11, 37, 12, 34, 4, 42, 43, 14, 45, 11, 15, 48, 18, 5, 51, 52, 17, 23, 48, 56, 18, 58, 59, 66, 6, 61, 62, 63, 20, 21, 65, 66, 12, 116, 68, 69, 22, 7, 50, 72, 23, 73, 74, 166, 16, 24, 126, 77, 40, 19, 25, 128, 8, 81, 108, 26, 41, 13, 52, 131
Offset: 0

Views

Author

Keywords

Comments

"Containment" implies here that the digits of n are consecutive digits in the square; see A091873 for a relaxed alternative. [R. J. Mathar, Dec 09 2008]

Crossrefs

Programs

  • Mathematica
    Table[ i=0; While[ StringPosition[ ToString[ i^2 ], ToString[ n ] ]=={}, i++ ]; i, {n, 0, 80} ]

A286300 Square root of smallest square formed from n by incorporating all the digits of n in a new decimal number.

Original entry on oeis.org

1, 5, 6, 2, 5, 4, 24, 9, 3, 10, 11, 11, 19, 12, 34, 4, 42, 9, 13, 32, 11, 15, 18, 18, 5, 16, 27, 17, 17, 48, 19, 18, 56, 18, 55, 6, 61, 59, 37, 20, 12, 18, 18, 12, 65, 8, 28, 22, 7, 45, 34, 15, 55, 65, 75, 16, 24, 72, 23, 40, 13, 16, 19, 8, 16, 26, 24, 41, 13
Offset: 1

Views

Author

Michael De Vlieger, May 05 2017

Keywords

Comments

Square root of less restrictive version of A091873: a(n) <= A091873(n).
First difference between a(n) and A091873(n) is for n=13. a(13) = sqrt(361) = 19, while A091873(13) = sqrt(1369) = 37.
If n is square then a(n) = sqrt(n).

Examples

			a(4) = 2 since 4 = 2^2.
Table of the first 20 terms of related sequences:
   n  A068165  A091873  a(n)^2  a(n)
   1:       1        1       1     1
   2:      25        5      25     5
   3:      36        6      36     6
   4:       4        2       4     2
   5:      25        5      25     5
   6:      16        4      16     4
   7:     576       24     576    24
   8:      81        9      81     9
   9:       9        3       9     3
  10:     100       10     100    10
  11:     121       11     121    11
  12:     121       11     121    11
  13:    1369       37     361    19
  14:     144       12     144    12
  15:    1156       34    1156    34
  16:      16        4      16     4
  17:    1764       42    1764    42
  18:    1089       33      81     9
  19:     169       13     169    13
  20:    2025       45    1024    32
...
		

Crossrefs

Programs

  • Mathematica
    Table[If[IntegerQ@ Sqrt@ n, Sqrt@ n, k = Floor@ Sqrt@ n; Function[t, While[Function[w, Times @@ Boole@ Map[w[[#1]] >= #2 & @@ # &, #] < 1]@ DigitCount[k^2] &@ Apply[Join, Map[Lookup[t, #] /. d_ /; IntegerQ@ d :> If[d > 0, {d, #}, {10, #}] &, Keys@ t]], k++]]@ KeyDrop[PositionIndex@ DigitCount@ n, 0]; k], {n, 69}] (* Michael De Vlieger, May 05 2017, Version 10.1 *)
Showing 1-3 of 3 results.