OFFSET
2,3
COMMENTS
a(n) is the greatest integer x such that gcd(x,n!) = 1 and x/n! < 1 - sum_{j=2}^{n-1} a(j)/j!.
The infinite series sum_{n=2}^infinity a(n)/n! = 1
For each n, either a(n) = 1 or a(n) >= n+1.
LINKS
Robert Israel and T. D. Noe, Table of n, a(n) for n = 2..10000 (first 1000 terms from Robert Israel)
EXAMPLE
1 - a(2)/2! = 1/2 = 3/3!, gcd(2,3!)>1 so a(3) = 1.
1 - a(2)/2! - a(3)/3! = 8/4! so a(4) = 7.
MAPLE
N:= 100; a[2]:= 1; R[2]:= 1/2;
for j from 3 to N do
T:= R[j-1] *j!;
for x from T-1 by -1 while igcd(x, j!) > 1 do end do;
a[j]:= x;
R[j]:= R[j-1] - x/j!
end do:
seq(a[j], j=2..N);
MATHEMATICA
s = 1; Table[d = n! s; q = If[d <= n, 1, If[d <= n^2, Prime[PrimePi[d]], Print["d > n^2"]; Abort[]]]; s = s - q/n!; q, {n, 2, 100}] (* T. D. Noe, Jul 27 2012 *)
PROG
(Sage)
def A214686_list(n) :
a = [1]; R = 1/2
for j in (3..n+1) :
J = factorial(j)
T = R * J
for x in range(T-1, -1, -1) :
if gcd(x, J) == 1 : break
a.append(x)
R = R - x / J
return a
A214686_list(51) # Peter Luschny, Jul 27 2012
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Jul 25 2012
STATUS
approved