%I #26 Nov 07 2022 20:27:30
%S 1,0,2,0,0,0,5,6,4,0,5,16,2,4,0,0,14,4,9,20,16,26,13,6,25,22,34,4,14,
%T 0,17,28,42,22,20,24,31,44,36,0,15,24,2,8,20,36,8,16,32,50,35,6,47,58,
%U 40,16,4,26,12,40,51,52,38,4,5,12,74,56,2,20,11,68,44,58,75,24,7,38,87,20
%N a(n) is the smallest number such that the concatenation of a(1)a(2)a(3)...a(n) is divisible by n.
%D A. Murthy, Exploring some new ideas on Smarandache type sets, functions and sequences, Smarandache Notions Journal Vol. 11, N 1-2-3 Spring 2000
%H Paul Tek, <a href="/A051883/b051883.txt">Table of n, a(n) for n = 1..10000</a>
%e For example the third term is 2 because 102 is divisible by 3.
%t nxt[{n_,c_,a_}]:=Module[{k=0},While[!Divisible[FromDigits[Flatten[ Join[ IntegerDigits[ c],IntegerDigits[ k]]]],n+1],k++];{n+1,FromDigits[ Flatten[ Join[IntegerDigits[c],IntegerDigits[k]]]],k}]; NestList[nxt,{1,1,1},80][[All,3]] (* _Harvey P. Dale_, Jul 17 2020 *)
%o (Haskell)
%o import Data.List (findIndex)
%o import Data.Maybe (fromJust)
%o a051883 n = a051883_list !! (n-1)
%o a051883_list = 1 : f 2 "1" where
%o f :: Integer -> String -> [Int]
%o f x zs = y : f (x + 1) (zs ++ show y) where
%o y = fromJust $ findIndex
%o ((== 0) . (`mod` x) . read . (zs ++)) $ map show [0..]
%o -- _Reinhard Zumkeller_, May 26 2013
%o (Python)
%o from itertools import count, islice
%o def agen():
%o b, an = 1, 1
%o for n in count(2):
%o yield an
%o b, pow10 = b*10, 10
%o r, an = b%n, 0
%o if r == 0: continue
%o for d in count(1):
%o an = (n - r)
%o while an < pow10//10: an += n
%o if an < pow10: break
%o b, pow10 = b*10, pow10*10
%o r = b%n
%o b += an
%o print(list(islice(agen(), 80))) # _Michael S. Branicky_, Nov 07 2022
%Y See A082399 for another version.
%Y Cf. A336399.
%K nonn,easy,nice,base
%O 1,3
%A _Felice Russo_, Dec 15 1999
%E Expanded and corrected from the Murthy paper.
%E More terms from Michael Lugo (mlugo(AT)thelabelguy.com), Dec 22 1999
%E Further terms from _David Wasserman_, Mar 05 2002