Guyz, im trying to figure out how to find solutions to there two problems


Consider a field which is square in shape and 100*100 units in area . I am standing at the North-West corner of the field . From any place I am allowed to take one of the following 3 moves

1) 1 unit to the East
2) 1 unit to the South
3) sqrt(2) units to the South-East

I am not allowed to move out of the field.

I randomly pick one of the possible moves at each step and reach the South-East corner of the field ? The odds that I took the shortest path are 1:x

Find x .


For a prime number p the set of co-primes less than or equal to it is given by {1,2,3,4,...p-1} .

We define f(x,p) 0<x<p = 1 if and only if all the numbers from 1 to p-1 can be written as a power of x in modulo-p arithmetic .

Let n be the largest 12-digit prime number . Find the product of all integers j less than n such that f(j,n)=1, in modulo-n arithmetic

the second one is very difficult.

What does thid have to do with C++?

So what's the question? It looks like a copy and paste of your homework assignment.

For the first one, here are some hints :

1) Compute the distance from the first square(north-west) to the last square (south-east) and note that for each square there are upto 8 position on can move.