¿Necesita una mejor explicación de un problema matemático / de programación? [cerrado]

El problema es:

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?

preguntado el 08 de enero de 11 a las 21:01

I'm not really sure what you're asking. Also, how does this relate to programming? -

Don't make me scroll horizontally -

David: This is a problem in a programming competition. -

3 Respuestas

Try asking this over on math.stackexchange.com

Respondido 13 Abr '17, 15:04

Thanks, I didn't even know it existed. - SuprDewd

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 para algunos 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?

Respondido el 09 de enero de 11 a las 00:01

This is exactly what I needed! - SuprDewd

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

Respondido el 09 de enero de 11 a las 00:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.