[go: up one dir, main page]

login
A286604
a(n) = n mod sum of digits of n in factorial base.
4
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, 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, 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
OFFSET
1,5
FORMULA
a(n) = n mod A034968(n).
MATHEMATICA
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 *)
PROG
(Scheme) (define (A286604 n) (modulo n (A034968 n)))
(Python)
def a007623(n, p=2): return n if n<p else a007623(n//p, p+1)*10 + n%p
def a(n):
return n % sum(int(k) for k in str(a007623(n)))
print([a(n) for n in range(1, 201)]) # Indranil Ghosh, Jun 21 2017
CROSSREFS
Cf. A118363 (positions of zeros), A286607 (of nonzeros).
Sequence in context: A063974 A144628 A373832 * A366784 A217540 A226861
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Jun 18 2017
STATUS
approved