OFFSET
1,2
COMMENTS
Numbers n such that A000196(n) is in A008578 (i.e. is either 1 or prime). - Robert Israel, Jan 09 2016
LINKS
Daniel Suteu, Table of n, a(n) for n = 1..20000
Wikipedia, Wilson's theorem
EXAMPLE
For n = 26 it follows:
i = isqrt(26) = 5
(i-1)! = 24
(i-1)! = i-1 mod i
24 = 4 mod 5
MAPLE
seq(`if`(t=1 or isprime(t), seq(i, i=t^2..(t+1)^2-1), NULL), t=1..100); # Robert Israel, Jan 09 2016
MATHEMATICA
Select[Range@ 181, Function[n, Mod[(# - 1)!, #] == # - 1 &@ IntegerPart@ Sqrt@ n]] (* Michael De Vlieger, Jan 09 2016 *)
PROG
(Sidef)
10000.times { |n|
var i = n.isqrt;
if ((i-1)! % i == i-1) {
say n
}
}
(PARI) lista(nn) = for(n=1, nn, if(Mod((sqrtint(n)-1)!, sqrtint(n)) == sqrtint(n)-1, print1(n, ", "))); \\ Altug Alkan, Jan 12 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Daniel Suteu, Jan 08 2016
STATUS
approved