These are chat archives for **Codewars/codewars.com/kata-solving-help**

Seriously I stuck

```
def am_I_Wilson(p)
my_fact = fact(p-1) + 1
my_div = p*p.to_f
res = my_fact / my_div
res == res.ceil rescue true
end
def fact(n)
n == 0 ? 1 : n * fact(n-1)
end
```

For the moment I cry :(

My logic seems to be not so bad

`(fact(p - 1) + 1 ) % p**2 == 0`

```
import math
def am_i_wilson(n):
if n <= 0:
return False
else:
return (math.factorial(n - 1) + 1 ) % n**2 == 0
```

failed

:(

The point is that you don't have a primality test in your code.

You may use Miller-Rabin test or the one that you prefer. In Ruby with

`require 'prime'`

you have the it in `isprime()`

!!

a 8 kyu seriously... it's easy but I passed too much time on it

thanks for the hint

!!!

It's a joke ?

Moahha

ok I need a break after this kind of kata...! Thanks Raul for the help and for the reference

is really helpful and interesting