|
|
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
|
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:
|
|
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]
];
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,easy,nice
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|