cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

4, 0, 0, 0, 12, 4, 5032, 6, 2990, 329881, 6, 10, 1720, 9, 6, 4, 56, 5, 634, 18, 68, 12, 51848, 22, 124, 1671, 12, 6, 30, 28, 756, 30
Offset: 1

Views

Author

Derek Orr, May 21 2014

Keywords

Comments

The entries a(n) = 0 are based on checking values of k <= 20000. - Derek Orr, May 21 2014
a(33) > 456000. - Derek Orr, Oct 23 2014 and Jon E. Schoenfield, Oct 25 2014
If a(n) > n, a(n) + n is necessarily prime.
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.
a(33) > 4*10^6. - Jon E. Schoenfield, Apr 30 2018

Examples

			(3!+1)/(3+1) = 7/4 is not an integer. (4!+1)/(4+1) = 25/5 = 5 is an integer. So a(1) = 4.
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.
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.
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
		

Programs

  • PARI
    a(n)=k=3;while((k!+n)%(k+n)&&k<2e6,k++);k \\ program improved by Derek Orr, Oct 23 2014
    
  • 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

Extensions

More terms added by Derek Orr, Oct 23 2014 and Jon E. Schoenfield, Oct 25 2014
Edited by M. F. Hasler, Oct 30 2014