jeudi 21 avril 2016

How to check if a number is an integer in Pari/GP?

I'm trying to write an if statement like this

 if(denominator([(i-1)! + 1] / i)-1,print(hi),print(ho))

i can be any integer for example 10, when I set i to 10 it gives this error.

? [(x-1)! + 1] / x *** this should be an integer: [(x-1)!+1]/x ^-----------

I really only need to check if [(x-1)! + 1] / x is an integer or not the denominator thing is what I came up with, I also tried Mod but couldn't get that working either.

Aucun commentaire:

Enregistrer un commentaire