unix - Checking if a returned number is an integer in GP/Pari? -
this first time using gp/pari , having trouble completing question.
i asked print if return of function 'wq()' integer. there function can determine if number passed in integer? if not how go checking? find syntax difficult , can't find information online it.
i have included have far, appreciated.
wq(x) = { [(x-1)! + 1]/x } test(r,s) = { (i=r, s, if(isinteger(wq(i)), print("integer"), print("not interger"))); }
if understand correctly want check if (x-1)! + 1
multiple of x
. can modulo operation:
test(r,s) = { (i=r, s, if(mod((i - 1)! + 1, i) == 0, print("integer"), print("not integer"))); }
Comments
Post a Comment