开发者

Need better explanation of a mathematical/programming problem? [closed]

开发者 https://www.devze.com 2023-02-03 00:37 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. 开发者_开发技巧 Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.
开发者_开发技巧

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 12 years ago.

Improve this question

The problem is:

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

Can anyone give me a better explanation?


I'll assume that you're having trouble understanding what the question is asking you to do.

First, the function f must be defined. It needs to return 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". That is, in pseudo-code:

for i from 1 to p-1
   if (for some n, (x^n)%p != i%p) return 0
end for
return 1

If any of those numbers i can't be written as x^n for some n, then we don't return 1. If they all work, then we return 1.

Last, we're looking for the product of all those js. So, again, in pseudo-code:

let p = 1
for j from 1 to n
    if (f(j,n)==1)  p = p*j
end for
return p%n

We only multiply in the j if f(j,n) is 1, as requested. Does that make sense? Is there a specific part of the question you don't understand?


Try asking this over on math.stackexchange.com


really bad psuedocode for definition purposes -- this is not the correct code to do this

function answerToQuestion()
  answer = 1
  n = getLargest12DigitPrime()
  for j = 1 to n-1
      if (f(j,n) == 1)
         answer *= j

  return answer
end function

function f(j, n)
  for x=1 to n-1
     if not canBeWrittenAsPowerOfJModuloN(x, j, n)
         return 0
  return 1
end function
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号