login
A249626
a(0) = 0, a(n+1) = smallest number, not occurring earlier, containing the smallest of the least frequently occurring digits in all preceding terms.
3
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 34, 35, 36, 37, 38, 39, 40, 45, 46, 47, 48, 49, 50, 56, 57, 58, 59, 60, 67, 68, 69, 70, 78, 79, 80, 89, 90, 100, 21, 31, 41, 51, 61, 71, 81, 91, 22, 32, 42
OFFSET
0,3
COMMENTS
a(n) = A102823(n) for n <= 55;
not all numbers occur: all repunits (A002275) greater than 1 are missing; idea of proof: for n > 1 the digit 1 will never again be the smallest of least frequently occurring digits;
A249648 gives positions of terms containing a zero.
LINKS
EXAMPLE
n = 11: digits 0 and 1 occur twice in {a(k): k=0..10}, all other digits exactly once, where 2 is the smallest; therefore a(11) must contain digit 2, and 12 is the smallest unused number containing 2, hence a(11) = 12.
n = 55: digits 0..9 occur exactly 10 times in {a(k): k=0..54}; therefore a(55) must contain digit 0, the smallest digit; a(55) = 100, as 100 is the smallest unused number containing 0;
n = 56: least occurring digits in {a(k): k=0..10} are 2..9 and 2 is the smallest; therefore a(56) must contain digit 2, and 21 is the smallest unused number containing 2, hence a(56) = 21.
PROG
(Haskell)
import Data.List (delete, group, sortBy); import Data.Function (on)
a249626 n = a249626_list !! n
a249626_list = f (zip [0, 0..] [0..9]) a031298_tabf where
f acds@((_, dig):_) zss = g zss where
g (ys:yss) = if dig `elem` ys
then y : f acds' (delete ys zss) else g yss
where y = foldr (\d v -> 10 * v + d) 0 ys
acds' = sortBy (compare `on` fst) $
addd (sortBy (compare `on` snd) acds)
(sortBy (compare `on` snd) $
zip (map length gss) (map head gss))
addd cds [] = cds
addd [] _ = []
addd ((c, d) : cds) yys'@((cy, dy) : yys)
| d == dy = (c + cy, d) : addd cds yys
| otherwise = (c, d) : addd cds yys'
gss = sortBy compare $ group ys
CROSSREFS
KEYWORD
nonn,look,base
AUTHOR
Reinhard Zumkeller, Nov 03 2014
STATUS
approved