login
Remainder when concatenation 1,2,3,...up to (n-1) is divided by n.
4

%I #20 May 21 2024 17:00:00

%S 0,1,0,3,4,3,4,7,0,9,4,3,12,9,9,7,1,9,7,19,12,15,18,15,24,9,0,11,27,9,

%T 7,7,15,9,9,27,29,21,21,39,22,33,5,15,9,39,45,39,39,49,27,51,33,27,4,

%U 23,15,49,49,39,32,13,54,7,9,15,41,59,0,39,47,63,41,17,24,23,37,21,75,39

%N Remainder when concatenation 1,2,3,...up to (n-1) is divided by n.

%H Michael S. Branicky, <a href="/A094151/b094151.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A007908(n-1) mod n for n>1. - _Michel Marcus_, Nov 21 2022

%e a(5) = 15 hence a(6) = least integer multiple of 15/6 = 5.

%t Table[st = ""; For[i = 0, i <= n - 1, i++, st = st <> ToString[i]]; Mod[ ToExpression[st], n], {n, 1, 100}] (* Sam Handler (sam_5_5_5_0(AT)yahoo.com), Nov 12 2004 *)

%t Table[Mod[FromDigits[Flatten[IntegerDigits/@Range[n-1]]],n],{n,100}] (* _Harvey P. Dale_, May 21 2024 *)

%o (Python)

%o from itertools import count, islice

%o def agen():

%o s = "0"

%o for n in count(1): yield int(s)%n; s += str(n)

%o print(list(islice(agen(), 80))) # _Michael S. Branicky_, Nov 21 2022

%o (PARI) a(n)=if(n<=9, return(1719%n)); my(m=Mod(123456789,n)); for(d=2,#Str(n-1), my(D=10^d); for(k=D/10,min(D,n)-1, m=D*m+k)); lift(m) \\ _Charles R Greathouse IV_, Nov 21 2022

%Y Cf. A007908, A110740 (indices of 0's).

%Y Cf. A095221.

%K nonn,base,easy

%O 1,4

%A _Amarnath Murthy_, Apr 29 2004

%E More terms from Sam Handler (sam_5_5_5_0(AT)yahoo.com), Nov 12 2004