login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A046851 Numbers n such that n^2 can be obtained from n by inserting internal (but not necessarily contiguous) digits. 8
0, 1, 10, 11, 95, 96, 100, 101, 105, 110, 125, 950, 960, 976, 995, 996, 1000, 1001, 1005, 1006, 1010, 1011, 1021, 1025, 1026, 1036, 1046, 1050, 1100, 1101, 1105, 1201, 1205, 1250, 1276, 1305, 1316, 1376, 1405, 9500, 9505, 9511, 9525, 9600, 9605, 9625 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
Contains A038444. In particular, the sequence is infinite. - Robert Israel, Oct 20 2016
If n is any positive term, then b_n(k) := n*10^k (k >= 0) is an infinite subsequence. - Rick L. Shepherd, Nov 01 2016
From Robert Israel's comment it follows that the subsequence of terms with no trailing zeros is also infinite (contains A000533). - Rick L. Shepherd, Nov 01 2016
LINKS
EXAMPLE
110^2 = 12100 (insert "2" and "0" into "1_1_0").
MAPLE
IsSublist:= proc(a, b)
local i, bp, j;
bp:= b;
for i from 1 to nops(a) do
j:= ListTools:-Search(a[i], bp);
if j = 0 then return false fi;
bp:= bp[j+1..-1];
od;
true
end proc:
filter:= proc(n) local A, B;
A:= convert(n, base, 10);
B:= convert(n^2, base, 10);
if not(A[1] = B[1] and A[-1] = B[-1]) then return false fi;
if nops(A) <= 2 then return true fi;
IsSublist(A[2..-2], B[2..-2])
end proc:
select(filter, [$0..10^4]); # Robert Israel, Oct 20 2016
MATHEMATICA
id[n_]:=IntegerDigits[n];
insQ[n_]:=First[id[n]]==First[id[n^2]]&&Last[id[n]]==Last[id[n^2]];
sort[n_]:=Flatten/@Table[Position[id[n^2], id[n][[i]]], {i, 1, Length[id[n]]}];
takeQ[n_]:=Module[{lst={First[sort[n][[1]]]}},
Do[
Do[
If[Last[lst]<sort[n][[i]][[h]], AppendTo[lst, sort[n][[i]][[h]]]; Break[]],
{h, 1, Length[sort[n][[i]]]}
],
{i, 2, Length[sort[n]]}
];
If[Length[lst]==Length[id[n]]&&lst==Sort[lst], True, False]
];
Select[Range[0, 9625], insQ[#]&&takeQ[#]&] (* Ivan N. Ianakiev, Oct 19 2016 *)
PROG
(Haskell)
import Data.List (isInfixOf)
a046851 n = a046851_list !! (n-1)
a046851_list = filter chi a008851_list where
chi n = (x == y && xs `isSub` ys) where
x:xs = show $ div n 10
y:ys = show $ div (n^2) 10
isSub [] ys = True
isSub _ [] = False
isSub us'@(u:us) (v:vs)
| u == v = isSub us vs
| otherwise = isSub us' vs
-- Reinhard Zumkeller, Jul 27 2011
CROSSREFS
Cf. A045953, A008851, A018834, A038444, A086457 (subsequence).
Sequence in context: A347182 A331604 A086457 * A045953 A136830 A153069
KEYWORD
nonn,base,easy,nice
AUTHOR
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)