login
{concatenation n, n-1, n-2, ...3,2,1} mod n.
4

%I #13 Jan 10 2017 19:43:09

%S 0,1,0,1,1,3,3,1,0,1,6,9,2,1,6,1,4,9,0,1,12,17,4,9,21,21,0,13,11,21,

%T 20,17,6,29,1,9,8,25,36,1,0,33,41,17,36,23,26,33,34,21,30,41,38,27,6,

%U 1,36,39,7,21,31,59,54,49,21,39,57,45,60,41,31,9,37,41,21

%N {concatenation n, n-1, n-2, ...3,2,1} mod n.

%H Indranil Ghosh, <a href="/A114795/b114795.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A000422(n) mod n. - _Michel Marcus_, Jan 10 2017

%e a(7) = 7654321 mod 7 = 3.

%t f[n_] := Mod[FromDigits@ Flatten@ IntegerDigits@ Reverse@ Range@ n,

%t n]; Array[f, 75] (* or *)

%t f[n_] := Fold[Mod[#1*10^Floor[1 + Log10@#2] + #2, n] &, 0,

%t Reverse@Range@n]; Array[f, 75] (* _Robert G. Wilson v_, Jan 10 2017 *)

%o (Python)

%o def A114795(n):

%o s=""

%o for i in range(n,0,-1):

%o s+=str(i)

%o return int(s)%n # _Indranil Ghosh_, Jan 10 2017

%Y Cf. A000422.

%K base,nonn

%O 1,6

%A _Amarnath Murthy_, Nov 19 2005

%E More terms from Ryan Murphy (murphy(AT)minegoboom.com) and Evonne Haines (avissean(AT)adelphia.net), Jan 21 2006