login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A248025
Lexicographically earliest permutation of the positive integers such that the first digit of a(n+1) is the digital root of a(n).
6
1, 10, 11, 2, 20, 21, 3, 30, 31, 4, 40, 41, 5, 50, 51, 6, 60, 61, 7, 70, 71, 8, 80, 81, 9, 90, 91, 12, 32, 52, 72, 92, 22, 42, 62, 82, 13, 43, 73, 14, 53, 83, 23, 54, 93, 33, 63, 94, 44, 84, 34, 74, 24, 64, 15, 65, 25, 75, 35, 85, 45, 95, 55, 16, 76, 46, 17, 86, 56, 26, 87, 66, 36, 96
OFFSET
1,2
MATHEMATICA
Nest[Append[#, Block[{k = 1, r = Mod[#[[-1]], 9] + 9 Boole[Mod[#[[-1]], 9] == 0]}, While[Nand[FreeQ[#, k], IntegerDigits[k][[1]] == r], k++]; k]] &, {1}, 73] (* Michael De Vlieger, Oct 15 2020 *)
PROG
(PARI) a(n, S=1, u=2)={for(i=1, n, print1(S", "); S=(S-1)%9+1; for(k=1, 9e9, bittest(u, k)&&next; S==digits(k)[1]||next; u+=1<<S=k; break)); S}
(Haskell)
import Data.List (delete)
a248025 n = a248025_list !! (n-1)
a248025_list = 1 : f 1 [2..] where
f x zs = g zs where
g (y:ys) = if a000030 y == a010888 x
then y : f y (delete y zs) else g ys
-- Reinhard Zumkeller, Sep 30 2014
CROSSREFS
Cf. A010888 (digital root); similar sequences: A248024,...
Cf. A247879 (inverse), A000030.
Sequence in context: A328752 A173821 A101807 * A303501 A368347 A289985
KEYWORD
nonn,base
AUTHOR
Eric Angelini and M. F. Hasler, Sep 29 2014
STATUS
approved