A265893 a(n) = A084558(n) - A230403(n); the length of factorial base representation of n without its trailing zeros.
0, 1, 1, 2, 1, 2, 1, 3, 2, 3, 2, 3, 1, 3, 2, 3, 2, 3, 1, 3, 2, 3, 2, 3, 1, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 1, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 2, 4, 3, 4, 3, 4, 1
Offset: 0
Examples
In factorial base A007623, 0 is shown as "0", but in this case all the zeros are trailing, so we set a(0) = 0 by convention. For n = 2, A007623(2) = "10", and by discarding the trailing zero only one significant digit "1" is left, thus a(2) = 1. For n = 132, A007623(132) = "10200", and by discarding its trailing zeros we are left with just three digits "102", thus a(132) = 3.
Links
Programs
-
Mathematica
a[n_] := Module[{k = n, m = 2, r, s = {}}, While[{k, r} = QuotientRemainder[k, m]; k != 0|| r != 0, AppendTo[s, r]; m++]; Length[s] - FirstPosition[s, ?(#>0 &)][[1]] + 1]; a[0] = 0; Array[a, 100, 0] (* _Amiram Eldar, Feb 21 2024 *)
-
Scheme
(define (A265893 n) (- (A084558 n) (A230403 n)))