Finding the aproximate integer Sqrt of a large prime

  • Thread starter Thread starter Facet
  • Start date Start date
  • Tags Tags
    Integer Prime
Facet
Messages
2
Reaction score
0
I am trying to understand how I can find the square root of a large prime number in the form of an integer value, the portion after the decimal is irelevant.

The numbers I wish to compute range around 188 multiplied by 3 to the power of 6548 plus 1, as an example. so let's say in excess of 3000 digits.

My problem with this is, using my quad-core machine, I'm finding my petty division through subtraction routine fairly slow, and (x+a/x)/2 as a solution is failing badly.

Can someone please find time to discuss with me a way of doing this?

Can a prime have a GCD with a smaller number(like the sqrt), I somehow just don't see it...

So if there is an easy solution, please let me know it =)
 
Mathematics news on Phys.org
You don't need to do any division at all.

Just use (x+k)^2 = x^2 + 2kx + k^2

Call your prime p. Start with x = the largest value of 2^m where x^2 < p, and k = x/2

Find (x+k)^2. If it is less than p, let x = x+k.
Divide k by 2 and repeat, until k = 1.

If your big arithmetic routines work in decimal not binary, you can use the same sort of algorithm to pick off one decimal digit of the answer at a time.

You don't need to spend time calculatiing the right-hand digits of the numbers that you know are zero, of course.
 
Thankyou for the quick reply, much appreciated... =)
I really need to touch up on my maths =(
I'm sure what you posted will help me out...
I can straight away see how much faster that would be ;)
one quick question - what is m
Edit: nvm - I think I see what you say =)
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top