login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A068165 Smallest square formed from n by inserting zero or more decimal digits. 9
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

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

LINKS

Michael De Vlieger, Table of n, a(n) for n = 1..10000

EXAMPLE

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.

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

MATHEMATICA

Table[If[IntegerQ@ Sqrt@ n, n, k = 1;

  Function[a,

    Function[t,

      While[Function[b,

           Function[w,

             Nand[Times @@ Boole@ Map[w[[#1]] >= #2 & @@ # &, #] == 1,

              Length@SequencePosition[

                 Select[b,

                  Function[d, MemberQ[#[[All, 1]], d /. 0 -> 10]]],

                 a] > 0]]@ RotateLeft@ BinCounts[b, {0, 10, 1}]]@

          IntegerDigits[Set[s, k^2]] &@

        Apply[Join,

         Map[Lookup[t, #] /.

            d_ /; IntegerQ@ d :> If[d > 0, {d, #}, {10, #}] &,

          Keys@ t]], k++]]@

     KeyDrop[PositionIndex@ RotateLeft@ BinCounts[a, {0, 10, 1}], 0]]@

   IntegerDigits@ n; s], {n, 50}] (* Michael De Vlieger, May 05 2017, Version 10.1 *)

CROSSREFS

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

Sequence in context: A039457 A243749 A031366 * A086935 A077689 A018796

Adjacent sequences:  A068162 A068163 A068164 * A068166 A068167 A068168

KEYWORD

base,easy,nonn

AUTHOR

Amarnath Murthy, Feb 25 2002

EXTENSIONS

Corrected and extended by Ray Chandler, Oct 11 2003

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified October 21 11:34 EDT 2017. Contains 293693 sequences.