login
A045541
Square previous term and then delete digits of previous term.
2
2, 4, 16, 25, 6, 3, 9, 81, 656, 43033, 18518989, 3422322, 11718787168, 33299240224, 118856557176, 42330949, 17161, 29449992, 867300880006, 522114591215, 760366360676, 5815244491919, 3370600766306, 11949525822594424885
OFFSET
0,1
COMMENTS
After 100 steps enters a cycle of length 307: a(n+307)=a(n) for n>100; a(167) = 88703778700083013187738001 is the largest term. - Reinhard Zumkeller, Sep 15 2011
LINKS
Reinhard Zumkeller and Chai Wah Wu, Table of n, a(n) for n = 0..10000 First 1001 terms from Reinhard Zumkeller.
EXAMPLE
a(100)^2 = 46629^2 = 2174263641 --> 1731 = a(301);
a(407)^2 = 646^2 = 417316 --> 1731 = a(408) = a(301+307).
MATHEMATICA
nxt[n_]:=Module[{idn=IntegerDigits[n], idn2=IntegerDigits[n^2]}, Table[ idn2= DeleteCases[ idn2, idn[[i]]], {i, Length[idn]}]; FromDigits[idn2]]; NestList[nxt, 2, 30] (* Harvey P. Dale, Oct 29 2011 *)
PROG
(Haskell)
a045541 n = a045541_list !! n
a045541_list = 2 : f 2 where
f x = x' : f x'
where x' = read $ filter (`notElem` show x) $ show (x^2)
-- Reinhard Zumkeller, Sep 15 2011
(Python)
A045541_list, l = [2], 2
for _ in range(10**4):
....l = int(''.join(d for d in str(l**2) if not d in set(str(l))))
....A045541_list.append(l) # Chai Wah Wu, Jan 03 2015
(PARI) deldig(n, m)=my(s=Set(digits(m))); fromdigits(select(k->!setsearch(s, k), digits(n)))
a(n)=if(n, my(k=a(n-1)); deldig(k^2, k), 2) \\ Charles R Greathouse IV, Jun 16 2015
CROSSREFS
Sequence in context: A059622 A131475 A239363 * A372898 A234639 A358000
KEYWORD
base,nonn,nice,look,easy
STATUS
approved