A382184 a(n) is the least k >= 0 such that the factorial base expansion of n starts with that of k while the remaining digits are zeros.
0, 1, 1, 3, 4, 5, 1, 7, 3, 9, 10, 11, 4, 13, 5, 15, 16, 17, 18, 19, 20, 21, 22, 23, 1, 25, 7, 27, 28, 29, 3, 31, 9, 33, 34, 35, 10, 37, 11, 39, 40, 41, 42, 43, 44, 45, 46, 47, 4, 49, 13, 51, 52, 53, 5, 55, 15, 57, 58, 59, 16, 61, 17, 63, 64, 65, 66, 67, 68, 69
Offset: 0
Examples
The first terms, in decimal and in factorial base, are: n a(n) fact(n) fact(a(n)) -- ---- ------- ---------- 0 0 0 0 1 1 1 1 2 1 1,0 1 3 3 1,1 1,1 4 4 2,0 2,0 5 5 2,1 2,1 6 1 1,0,0 1 7 7 1,0,1 1,0,1 8 3 1,1,0 1,1 9 9 1,1,1 1,1,1 10 10 1,2,0 1,2,0 11 11 1,2,1 1,2,1 12 4 2,0,0 2,0 13 13 2,0,1 2,0,1 14 5 2,1,0 2,1 15 15 2,1,1 2,1,1
Links
Programs
-
PARI
a(n) = { if (n, my (m = n, s = oo, d); for (r = 2, oo, if (m==0 || s==0, break, d = m%r, s = min(s, r-1-d);); m \= r;); if (s, my (v = 0); for (r = 2, oo, if (n==0, return (v), v += (n%r) * max(0, r-1-s)!; n \= r;);););); return (n); }
Formula
a(n) <= n with equality iff n = 0 or n belongs to A273670.
a(k!) = 1 for any k >= 0.