%I #16 Mar 03 2018 09:48:49
%S 0,1,1,2,1,5,1,13,5,17,3,7,1,7,1,3,5,11,1,5,7,19,11,23,1,61,7,27,41,
%T 101,1,11,13,43,23,53,11,71,31,91,17,37,2,19,3,4,7,29,1,31,11,41,7,17,
%U 7,67,9,29,47,107,1,3,4,23,13,14,17,77,37,97,19,39,1
%N In factorial base, any rational number has a terminating expansion; hence we can devise a self-inverse permutation of the rational numbers, say f, such that for any rational number q, the representations of q and of f(q) in factorial base are mirrored around the radix point and q and f(q) have the same sign; a(n) = the numerator of f(n).
%C See A299160 for the corresponding denominators.
%C The function f restricted to the nonnegative integers establishes a bijection from the nonnegative integers to the rational numbers q such that 0 <= q < 1, hence n -> a(n) / A299161(n) runs uniquely through all rational numbers q such that 0 <= q < 1.
%C The rational numbers q = n + f(n) for some integer n are the fixed points of f.
%C If two rational numbers, say p and q, have the same sign and can be added without carry in factorial base, then f(p + q) = f(p) + f(q).
%H Rémy Sigrist, <a href="/A299161/b299161.txt">Table of n, a(n) for n = 0..10000</a>
%H Rémy Sigrist, <a href="/A299161/a299161.png">Colored logarithmic scatterplot of the first 100000 terms</a> (where the color is function of A299160(n))
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Factorial_number_system#Fractional_values">Factorial number system (Fractional values)</a>
%H <a href="/index/Fa#facbase">Index entries for sequences related to factorial base representation</a>
%F a(n) < A299160(n) for any n >= 0.
%F a(n!) = 1 for any n >= 0.
%e The first terms, alongside f(n) and the factorial base representations of n and of f(n), are:
%e n a(n) f(n) fact(n) fact(f(n))
%e -- ---- ---- ------- ----------
%e 0 0 0 0 0.0
%e 1 1 1/2 1 0.1
%e 2 1 1/6 1 0 0.0 1
%e 3 2 2/3 1 1 0.1 1
%e 4 1 1/3 2 0 0.0 2
%e 5 5 5/6 2 1 0.1 2
%e 6 1 1/24 1 0 0 0.0 0 1
%e 7 13 13/24 1 0 1 0.1 0 1
%e 8 5 5/24 1 1 0 0.0 1 1
%e 9 17 17/24 1 1 1 0.1 1 1
%e 10 3 3/8 1 2 0 0.0 2 1
%e 11 7 7/8 1 2 1 0.1 2 1
%e 12 1 1/12 2 0 0 0.0 0 2
%e 13 7 7/12 2 0 1 0.1 0 2
%e 14 1 1/4 2 1 0 0.0 1 2
%e 15 3 3/4 2 1 1 0.1 1 2
%e 16 5 5/12 2 2 0 0.0 2 2
%e 17 11 11/12 2 2 1 0.1 2 2
%e 18 1 1/8 3 0 0 0.0 0 3
%e 19 5 5/8 3 0 1 0.1 0 3
%e 20 7 7/24 3 1 0 0.0 1 3
%t Block[{nn = 72, m}, m = 1; While[Factorial@ m < nn, m++]; m; {0}~Join~Numerator@ Array[NumberCompose[Prepend[#, 0], 1/Range[Length@ # + 1]!] &@Reverse@ IntegerDigits[#, MixedRadix[Reverse@ Range[2, m]]] &, nn]] (* _Michael De Vlieger_, Feb 10 2018 *)
%o (PARI) a(n) = my (v=0); for (r=2, oo, if (n==0, return (numerator(v))); v += (n%r)/r!; n\=r)
%Y Cf. A299160.
%K nonn,base,frac
%O 0,4
%A _Rémy Sigrist_, Feb 04 2018