Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #21 Feb 21 2024 01:20:22
%S 0,0,1,0,2,0,1,0,0,1,3,0,1,2,3,0,2,0,3,0,1,2,5,0,1,0,0,1,1,0,1,2,1,2,
%T 0,0,1,2,4,0,5,2,3,4,3,4,5,0,1,2,3,0,3,0,3,0,2,3,5,0,1,2,3,4,2,1,1,2,
%U 6,0,7,0,1,2,0,1,5,2,4,0,3,4,6,4,1,2,3,4,1,0,0,1,5,6,5,0,2,3,3,4,3,2,1,2,0,1,3,0,4,5,7,0,5,2,3,4,0,1,9,0
%N a(n) = n mod sum of digits of n in factorial base.
%H Antti Karttunen, <a href="/A286604/b286604.txt">Table of n, a(n) for n = 1..10080</a>
%H <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>.
%F a(n) = n mod A034968(n).
%t a[n_] := Module[{k = n, m = 2, r, s = 0}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, s += r; m++]; Mod[n, s]]; Array[a, 100] (* _Amiram Eldar_, Feb 21 2024 *)
%o (Scheme) (define (A286604 n) (modulo n (A034968 n)))
%o (Python)
%o def a007623(n, p=2): return n if n<p else a007623(n//p, p+1)*10 + n%p
%o def a(n):
%o return n % sum(int(k) for k in str(a007623(n)))
%o print([a(n) for n in range(1, 201)]) # _Indranil Ghosh_, Jun 21 2017
%Y Cf. A034968, A286606.
%Y Cf. A118363 (positions of zeros), A286607 (of nonzeros).
%K nonn,base
%O 1,5
%A _Antti Karttunen_, Jun 18 2017