Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Describe how to find a prime factor of 1742399 using at most 441 integer divisions and one square root.

So far I have only square rooted 1742399 to get 1319.9996. I have also tried to find a prime number that divides 1742399 exactly; I have tried up to 71 but had no luck. Surely there is an easier way that I am missing without trying numerous prime numbers. Any help would be great, thanks.

share|cite|improve this question
- you need only to test numbers up to $1319$. - test $2$ for even numbers - test $3$ for multiples of $3$ - the remaining numbers will be $1$ or $5 \bmod 6$ – Raymond Manzoni Aug 14 '12 at 20:36
@RaymondManzoni This is undoubtedly what the question had in mind. One can also eliminate multiples of 5 fairly efficiently and reduce the number of divisions by working mod 30. – Mark Bennet Aug 14 '12 at 20:43
Note also that in Raymond's scheme the first divisor you encounter will be prime (this is not entirely trivial). – Mark Bennet Aug 14 '12 at 20:44
@RaymondManzoni Thanks for your help guys. I understand using 2 to test for even numbers and 3 to test for multiples of 3 but I am confused over where the 5 mod 6 comes from. – Apeman Aug 14 '12 at 22:25
a prime number greater than $3$ must be equal to $1$ or $5 \bmod 6$ because a prime (larger than $3$) must be odd i.e. $1,3$ or $5 \bmod 6$. Since $3\bmod 6$ was handled by the case $3$ only remains $1$ and $5$. – Raymond Manzoni Aug 14 '12 at 22:30

Are you allowed to have a table of prime numbers? There are fewer than 441 such primes below 1320.

You probably aren't supposed to use this method, but 1742399 is nearly a square as you have identified and you can write it as 1742400-1, which is the difference of two squares. This gets you two smaller factors almost for free.

share|cite|improve this answer
  • you need only to test numbers up to $1319$.
  • test $2$ for even numbers
  • test $3$ for multiples of $3$
  • the remaining numbers will be $1$ or $5 \bmod 6$
share|cite|improve this answer
And testing the remaining numbers in the natural increasing order will mean that the first divisor encountered is a prime. – Mark Bennet Aug 14 '12 at 20:46
@Mark: of course more optimal methods exist (software usually implements a table of the first primes : compressed as differences in a byte or a word if you want $p > 10^9$). Since $li(1320)\approx 222$ we test two times more primes than required ($215 practically). For larger primes more sophisticated methods are used : little Fermat and extensions as proposed at Wikipedia. – Raymond Manzoni Aug 14 '12 at 21:02
I liked your answer because I could see immediately where the 441 came from. I could factorise the number, but I couldn't identify where the question was coming from, and you did. – Mark Bennet Aug 14 '12 at 21:05
@Mark: in fact I began by dividing $1320$ by $441$ got nearly $3$ and deduced that the modulo $6$ was in play (I played with that long ago so...). Your prime suggestion was more powerful but would have needed the division by nearly $\ln(1320)\approx 7.2$... Cheers, – Raymond Manzoni Aug 14 '12 at 21:11

Note that the problem asks you do describe how you would go about factorizing 1742399 in at most 442 operations. You are not being asked to carry out all these operations yourself! I think your method of checking all primes up to the squareroot is exactly what the problem is looking for, but to be safe you should check that there are no more than 441 primes less than or equal to 1319.

share|cite|improve this answer

Hint $\ $ Prime $\rm\:p\neq 2,3\:\Rightarrow\: p\equiv \pm 1\pmod 6$

Remark $\ $ For more on sieving see my post here, which includes links to ingenenious mechanical sieving machines devised by Lehmer in the precomputer era, e.g. using bicycles chains, photoelectric devices, etc. Below are some general references.

Wooding, Kjell. The Sieve Problem in One and Two-Dimensions.
PhD Thesis. Calgary, Alberta. April, 2010

Lehmer, D.H. The sieve problem for all-purpose computers, MTAC, v. 7 1953, p. 6-14

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.