OFFSET
1,1
COMMENTS
Let Product_j (p_j)^(e_j) be the prime factorization of n^2+1. Then n is in the sequence if and only if for each j, e_j <= Sum_{k>=1} floor(n/(p_j)^k). - Robert Israel, Nov 11 2016
There exist infinitely many natural numbers n such that n^2+1 divides n!, because 2*(5*k-2)^2 is a term for k > 0. - Jinyuan Wang, Feb 06 2019
There are 2082 terms up to 10^4, 22792 up to 10^5, 242421 up to 10^6, 2523043 up to 10^7. Perhaps the asymptotic density is 1 - log(2) = 30.68...%. - Jinyuan Wang, Feb 09 2019
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Hojoo Lee, Problem A 26, Problems in elementary number theory, 2003.
EXAMPLE
For the first number, k=18: 18^2+1=325 divides 18!=6402373705728000.
MAPLE
select(t -> t! mod (t^2+1)=0, [$1..1000]); # Robert Israel, Nov 11 2016
MATHEMATICA
Select[Range@ 336, Divisible[#!, #^2 + 1] &] (* Jinyuan Wang, Feb 06 2019 *)
PROG
(PARI) isok(n) = (n! % (n^2+1) == 0) \\ Michel Marcus, Jul 23 2013
(PARI) valp(n, p)=my(s); while(n>=p, s += n\=p); s
is(n)=my(f=factor(n^2+1)); for(i=1, #f~, if(valp(n, f[i, 1])<f[i, 2], return(0))); 1 \\ Jinyuan Wang, Feb 06 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
R. J. Mathar, Jul 07 2006
STATUS
approved