A051883 a(n) is the smallest number such that the concatenation of a(1)a(2)a(3)...a(n) is divisible by n.
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, 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, 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
Offset: 1
Examples
For example the third term is 2 because 102 is divisible by 3.
References
- A. Murthy, Exploring some new ideas on Smarandache type sets, functions and sequences, Smarandache Notions Journal Vol. 11, N 1-2-3 Spring 2000
Links
- Paul Tek, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
import Data.List (findIndex) import Data.Maybe (fromJust) a051883 n = a051883_list !! (n-1) a051883_list = 1 : f 2 "1" where f :: Integer -> String -> [Int] f x zs = y : f (x + 1) (zs ++ show y) where y = fromJust $ findIndex ((== 0) . (`mod` x) . read . (zs ++)) $ map show [0..] -- Reinhard Zumkeller, May 26 2013
-
Mathematica
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 *)
-
Python
from itertools import count, islice def agen(): b, an = 1, 1 for n in count(2): yield an b, pow10 = b*10, 10 r, an = b%n, 0 if r == 0: continue for d in count(1): an = (n - r) while an < pow10//10: an += n if an < pow10: break b, pow10 = b*10, pow10*10 r = b%n b += an print(list(islice(agen(), 80))) # Michael S. Branicky, Nov 07 2022
Extensions
Expanded and corrected from the Murthy paper.
More terms from Michael Lugo (mlugo(AT)thelabelguy.com), Dec 22 1999
Further terms from David Wasserman, Mar 05 2002