login
A038528
If n has decimal expansion abc...d, with k digits, let f(n) be obtained by deleting all k's from abc...d, closing up and deleting initial 0's; sequence gives n such that f(f(f(...(n)))) = 0 or empty.
3
1, 12, 20, 21, 22, 123, 132, 133, 203, 213, 223, 230, 231, 232, 300, 301, 303, 312, 313, 320, 321, 322, 330, 331, 333, 1234, 1243, 1244, 1324, 1334, 1342, 1343, 1423, 1424, 1432, 1433, 1442, 1444, 2034, 2043, 2044, 2134, 2143, 2144, 2234
OFFSET
1,2
COMMENTS
The sequence has exactly 14174521 terms, 999999999 is the last and largest. - Reinhard Zumkeller, Jul 04 2012
LINKS
FORMULA
A054055(a(n)) = A055642(a(n)). - Reinhard Zumkeller, Jul 04 2012
EXAMPLE
If n=22 (2 digits), f(n) = empty. If n=230 (3 digits), f(n)=20, f(f(n))=0. If n=301 (3 digits), f(n)=1 (1 digit), f(f(n))=empty.
The last 12 terms are: 999999333, 999999900, 999999901, 999999909, 999999912, 999999919, 999999920, 999999921, 999999922, 999999990, 999999991, 999999999.
MATHEMATICA
zeroQ[n_] := FixedPoint[ Function[{k}, DeleteCases[id = IntegerDigits[k], Length[id]] // FromDigits[#, 10]&], n] == 0; Select[Range[10^4], zeroQ] (* Jean-François Alcover, Dec 10 2014 *)
PROG
(Haskell)
import Data.List ((\\))
a038528 n = a038528_list !! (n-1)
a038528_list = gen ([1], 1) where
gen (_, 10) = []
gen (ds, len)
| len `elem` ds && chi ds
= foldr (\u v -> u + 10*v) 0 ds : gen (succ (ds, len))
| otherwise = gen (succ (ds, len))
chi xs = null ys || ys /= xs && chi ys where
ys = tr $ filter (/= length xs) xs
tr zs = if null zs || last zs > 0 then zs else tr $ init zs
succ ([], len) = ([1], len + 1)
succ (d : ds, len)
| d < len = (head (dropWhile (<= d) a002024_list \\ ds) : ds, len)
| otherwise = (0 : ds', len') where (ds', len') = succ (ds, len)
-- Reinhard Zumkeller, Jul 04 2012
CROSSREFS
Cf. A038527.
Cf. A002024, A055642, A031298, subsequence of A138166.
Sequence in context: A046418 A171795 A170806 * A052020 A075078 A050421
KEYWORD
easy,fini,nonn,base,nice
STATUS
approved