OFFSET
1,1
COMMENTS
k+1 divides k!+1 gives primes-1 by Wilson's Theorem. For the present sequence, there are 309 terms below 5000, compared with 669 primes (309/669 = 0.461...). There are 553 terms below 10000, compared with 1229 primes (553/1229 = 0.449...). - Ed Pegg Jr, Dec 05 2001
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) >> n log n. - Charles R Greathouse IV, Apr 16 2024
MAPLE
A053662:=n->`if`(n!+1 mod (2*n+1) = 0, n, NULL): seq(A053662(n), n=1..1000); # Wesley Ivan Hurt, Dec 01 2015
MATHEMATICA
Drop[Union[Table[If[IntegerQ[(n!+1)/(2n+1)], n], {n, 1, 1000}]], -1] (* Ed Pegg Jr, Dec 05 2001 *)
Select[Range[1000], Mod[#! +1, 2*# +1] == 0 &] (* G. C. Greubel, May 18 2019 *)
PROG
(PARI) for(n=1, 10^3, if((n!+1)%(2*n+1)==0, print1(n, ", ")) ) \\ G. C. Greubel, May 18 2019
(Magma) [n: n in [1..1000] | (Factorial(n)+1) mod (2*n+1) eq 0 ]; // G. C. Greubel, May 18 2019
(Sage) [n for n in (1..1000) if Mod(factorial(n)+1, 2*n+1)==0 ] # G. C. Greubel, May 18 2019
(GAP) Filtered([1..1000], n-> (Factorial(n)+1) mod (2*n+1)=0) # G. C. Greubel, May 18 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Chris K. Caldwell, Feb 16 2000
STATUS
approved