login
Least number k > 2 such that (k!+n)/(k+n) is an integer, or 0 if no such k exists.
1

%I #53 May 01 2018 04:06:54

%S 4,0,0,0,12,4,5032,6,2990,329881,6,10,1720,9,6,4,56,5,634,18,68,12,

%T 51848,22,124,1671,12,6,30,28,756,30

%N Least number k > 2 such that (k!+n)/(k+n) is an integer, or 0 if no such k exists.

%C The entries a(n) = 0 are based on checking values of k <= 20000. - _Derek Orr_, May 21 2014

%C a(33) > 456000. - _Derek Orr_, Oct 23 2014 and _Jon E. Schoenfield_, Oct 25 2014

%C If a(n) > n, a(n) + n is necessarily prime.

%C For n = 33..100, the sequence continues with a(33), 12, 36, 6, 16, 36, 12, 12, 42, 40, 54, 42, 6, 16, 340730, 46, 774, 99, 90196, 16, 44, 52, 18, 12, 12, 1249, a(59), 9, a(61), 60, 30, 169, 43346, 12, 22, 38, 70, a(70), 2352, 70, a(73), 72, 36, 123183, a(77), 1283, a(79), 12, 118, a(82), 84, 82, a(85), 23, 42, 28, 110, 12, a(91), a(92), 883964, a(94), 14888, 6, 726, 96, 232, 10. For each n in {33, 59, 61, 70, 73, 77, 79, 82, 85, 91, 92, 94}, a(n) > 2*10^6.

%C a(33) > 4*10^6. - _Jon E. Schoenfield_, Apr 30 2018

%e (3!+1)/(3+1) = 7/4 is not an integer. (4!+1)/(4+1) = 25/5 = 5 is an integer. So a(1) = 4.

%e a(2) = 0, because k+2 can never divide k!+2: If k+2 = p > 3 is a prime, then k!+2 = (p-2)!+2 == (1+2) (mod p), using the fact that (p-2)! == 1 (mod p) for all primes p. If k+2 > 4 is composite, let k+2 = p*m for some prime p and some m > 2. Then p*m-2 >= m and also p*m-2 > p. Thus, k! = (p*m-2)! is divisible by p*m. (If m = p this still holds because then p*m-2 >= 2*m.) Therefore, k!+2 == 2 (mod k+2) in this case.

%e a(3) = 0 for similar reasons: Consider s = (k!+3) mod (k+3). If k+3 is prime, s = (k+8)/2 and if k+3 is composite, s = 3. So s is never 0.

%e a(4) = 0 as well: Let s = (k!+4) mod (k+4). If k+4 is prime, there are two cases. If k == 1 (mod 6), then s = (k+29)/6. If k == 3 (mod 6), then s = (5*k+45)/6 except at the following finite number of points (k,s): (3,3), (9,2), and (15,1). If k+4 is composite, s = 4 except at (k,s) = (5,7). Thus, s is never 0. - _Jon E. Schoenfield_, Oct 28 2014

%o (PARI) a(n)=k=3;while((k!+n)%(k+n)&&k<2e6,k++);k \\ program improved by _Derek Orr_, Oct 23 2014

%o (PARI) a(n)=for(k=3,n,if((k!+n)%(k+n)==0,return(k))); forprime(kn=2*n,2e6+n, if(prod(i=2,kn-n,i,Mod(1,kn))==-n, return(kn-n))); 0 \\ _Charles R Greathouse IV_, Oct 28 2014

%K nonn,hard,more

%O 1,1

%A _Derek Orr_, May 21 2014

%E More terms added by _Derek Orr_, Oct 23 2014 and _Jon E. Schoenfield_, Oct 25 2014

%E Edited by _M. F. Hasler_, Oct 30 2014