## Program for algebraic equation with mod in maple...

I need help to create a program that will find all the positive integers n, where n < 1000, such that
(n 􏰀-1)!= 􏰁 􏰀-1 (mod n^2 ) . program has to be in full and state the values of n obtained.

## Wilsons Theorom...

How could i show wilsons theorom on maple?

(p-1)!=-1(modp) if and only if p is prime.

## nested mods -> possible with fold-operators?...

Hello,

my problem is as follows. Given

g := [g1, g2, ... , g99];    # a list of polynomials,  high  in degree and with big coefficients

S := [1, 3, 14, 29];        # Set of indices, which polynomials we want to multiply

p := 11;   # the modulus

------------------------------------------------------------------------------------------------------------------------------

I want to calculate the product of the constant-terms of the indexed g, that means for example

cg1 * cg3 * cg14 * cg29  mod p

where cgi means coeff(g[i], x, 0), and mod should be mods,  using symmetric representatives

Till now I'm using:

mods(mul(coeff(g[i], x, 0), i in S), p)

It works, but the problem is, that the order is not optimal and costs too much time.

The order is for example:
(3  *  5 * 7 * 9) mod 11;

But I need for efficieny an order like:
(((3 * 5 mod 11) * 7 mod 11) * 9 mod 11

I read about the fold operators, but I've no idea how to combine these with mul and mods to get what I need.

 Page 1 of 1
﻿