A227191 a(n) = n minus (product of nonzero digits in factorial base representation of n).
0, 1, 2, 2, 3, 5, 6, 7, 8, 8, 9, 10, 11, 12, 13, 12, 13, 15, 16, 17, 18, 16, 17, 23, 24, 25, 26, 26, 27, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 36, 37, 39, 40, 41, 42, 40, 41, 46, 47, 48, 49, 48, 49, 52, 53, 54, 55, 54, 55, 56, 57, 58, 59, 56, 57, 60, 61, 62
Offset: 1
Examples
22 has factorial expansion A007623(22) = "320", and multiplying the nonzero digits, we get 3*2 = 6, and 22-6 = 16, thus a(22)=16.
Links
Programs
-
Mathematica
a[n_] := Module[{k = n, m = 2, r, p = 1}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, If[r > 0, p *= r]; m++]; n - p]; Array[a, 100] (* Amiram Eldar, Feb 14 2024 *)
-
Scheme
(define (A227191 n) (- n (A227153 n)))
Formula
a(n) = n - A227153(n).