Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
define y value and x value with random Big Integer type for equation ( X = y^(p/q) mod n != 1) in csharp c#? 


What I have tried:

X = (Math.Pow(y, p/q)%N != 1)
Posted
Updated 1-Jul-21 18:06pm

1 solution

Frankly, I have no idea. The equation you have been given, that is easy to implement - you almost have it yourself, but I suspect that X is not supposed to be a boolean but rather that mod n != 1 is a constraint rather than a part of the equation.

But other than that, we just don't have much information: which of the variables y, p, q, and n are intended to be random? Which should be BigInteger types? If it's any of them, then you will need to use the BigInteger version of Math.Pow, and that only comes in one version: BigInteger.Pow(BigInteger, Int32) Method (System.Numerics) | Microsoft Docs[^]

What you need to do is probably re-read your task carefully, and work out exactly what it is asking you to do - you have paraphrased it here and we can't work out from that what your teacher has asked you to do.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900