-2

For two numbers, $691$ and $697$, tell me which (or both) is prime.

Without using calculator, what is the strategy for tackling this? I tried all the numbers up to 8 which are easy to test. How do you deal with better numbers?

Parcly Taxel
  • 103,344
Trajan
  • 5,194
  • 2
  • 27
  • 71
  • 4
    Try all the primes up to the square root: if they are easy to check, do it fast. If they aren't easy to check, do it anyways. –  Nov 01 '20 at 17:28
  • is there nothing you can do in your head better? – Trajan Nov 01 '20 at 17:29
  • I'm quite good at dividing three-digit numbers by two-digit numbers in my head. I cannot quite boast about it, because people are usually better than me at that. –  Nov 01 '20 at 17:30
  • 2
    There are divisibility tricks for $2,3,5,11$. In this case the case $23$ is easy since $690$ is a multiple of $23$. $7$ is also easy since $700$ is a multiple of $7$. Then only $13,17,19$ remain. – player3236 Nov 01 '20 at 17:35
  • @player3236 still tricky – Trajan Nov 01 '20 at 17:48
  • @Permian well, there isn't a clear-cut way. You will have to plug in values. But there are ways to significantly make it easier and reduce the amount of values you have to divide. – Sirswagger21 Nov 01 '20 at 19:13
  • 1
    I just did it in my head. After eliminating the easy primes ($2,3,5,7,11$) I started at the top with $23$. Since $3\cdot23=69$, that one is easy to eliminate. $19$ was a little more work, but it’s easy to see that neither $121$ nor $127$ is divisible by $194$. And $4\cdot17=68$, which makes the job very easy. – Brian M. Scott Nov 01 '20 at 19:20
  • @Brian $\bmod 19!:\ \color{#c00}{20!\equiv! 1}\Rightarrow 691 = 34(\color{#c00}{20})!+!11 = -4(\color{#c00}1)!+!11 \equiv 7\Rightarrow, 697\equiv 691!+!6 \equiv 7!+!6\ \ $ – Bill Dubuque Nov 01 '20 at 21:25
  • @Bill: Whatever one sees first! For me it was $3\cdot19=57$ as a known starting point, $121=11^2$ likewise, so that I really only had to think about $127$, and it’s obviously $6(20-1)+13$. – Brian M. Scott Nov 01 '20 at 21:29
  • @Brian The point is that they can all be done uniformly and simply this way, e.g. see my answer. – Bill Dubuque Nov 01 '20 at 22:07
  • 1
    @Bill: Which is both nice and interesting but not actually relevant to my primary concern at the time, which was doing the necessary calculations as easily as possible — and easily is very much a function of who is doing the calculations! – Brian M. Scott Nov 01 '20 at 22:30
  • @Brian Of course the comments are not meant only for you (I pinged you only since you mentioned other trial division optimizations so I thought you might be interested). In my experience, many beginners are not aware of the optimizations I mentioned. – Bill Dubuque Nov 01 '20 at 22:32
  • @Bill: Ah, okay; I tend to assume that when I’m pinged in a comment, it’s intended primarily for me. – Brian M. Scott Nov 01 '20 at 22:34

4 Answers4

4

$$29^2 - 697 = 144 = 12^2$$ so $$ 697 = 29^2 - 12^2 = 17 \cdot 41 $$

This is Fermat's method, it works quickly if there are two factors that are pretty close together. Beginning with $27^2 = 729,$ subtract each number from the square. If the result is a square you get two factors. Otherwise take the next square...

Will Jagy
  • 139,541
  • 1
    While that takes only a few steps for $697,$ for the prime $691$ it will take $27$ steps to find no factors - a bit painful. So doing both (OP's problem) may well be slower than trial division (for anyone proficient at such). But that can be allieviated somewhat in general since Fermat can be combined with trial division / sieving, along with other optimizations, e.g. see here. – Bill Dubuque Nov 01 '20 at 23:48
3

$697=625+72(\to 25^2+2×6^2)=49+648(\to 7^2+2×18^2)$. Both are of the form $a^2+2b^2$, and this nonuniqueness implies proper prime factors $\in\{1,3\}\bmod 8$. Actual factors are $17$ and $41$.

Alternatively, we can set out to prove that $691$ is prime. As this number $\equiv 3\bmod 8$, it is certified prime if it has a unique representation as $a^2+2b^2$ and the squares in this representation are relatively prime.

To prove uniqueness efficiently we need to cut down on trials. To effect this, first note that $a^2$ must be odd and can't end in $5$ ($b^2$ can't end in $3$ or $8$). Then if $a^2$ ends in $1$ it must end in $41$ or $91$ because $b$ would be a multiple of $5$ and thus $2b^2$ would have to be a multiple of $50$. We rule out an ending of $91$, however, because this fails $\bmod 4$.

That leaves only six values of $a^2$ ending with the proper digits and less than $691$, and we try those. Thus $691$ equals each of the following:

$9+682(\to b^2=341)$

$49+642(\to b^2=321)$

$169+522(\to b^2=261)$

$289+402(\to b^2=201)$

$441+250(\to b^2=125)$

$\color{blue}{529+162(\to b^2=81,\therefore a=23,b=9)}$

The existence of a unique sum hits on our very last chance!

Oscar Lanzi
  • 39,403
  • 1
    good... Brillhart 2009 and 2016 http://zakuski.utsa.edu/~jagy/Brillhart_Euler_factoring_2009.pdf ......... http://zakuski.utsa.edu/~jagy/Brillhart_Euler_factoring_2016.pdf – Will Jagy Nov 02 '20 at 01:26
2

The only nontrivial trial divisions can all be done uniformly easily mentally as follows:

$\bmod 13\!:\ \color{#c00}{40\!\equiv\! 1}\Rightarrow\,691={17}(\color{#c00}{40})\!+\!11\equiv\,\ 4\,(\color{#c00}1)+11\equiv 2,\,$ so $\ 691\!+\!6\equiv 8$

$\bmod 17\!:\ \color{#c00}{17\!\equiv\! 0}\Rightarrow\,691=\color{#c00}{17}(40)\!+\!11 \equiv\,\ \color{#c00}{0}\,(40)\!+\!11\!\equiv\! 11,\,$ so $\ 691\!+\!6\color{#0a0}{\equiv 0}$

$\bmod 19\!:\ \color{#c00}{40\!\equiv\! 2}\Rightarrow\,691=17(\color{#c00}{40})\!+\!11\equiv\, (-2)\color{#c00}2\!+\!11\equiv 7,\,$ so $\ 691\!+\!6\equiv 11$

$\bmod 23\!:\ \color{#c00}{17,40\equiv -6}\ \Rightarrow \ \color{#c00}{17(40})\!+\!11\equiv \color{#c00}{-6(-6)}\!+\!11\!\equiv\! 1,\,$ so $\ 691\!+\!6\equiv 7$

More generally see the universal divisibility test, e.g. see here and here.

Bill Dubuque
  • 272,048
  • or $\bmod 23!:\ \color{#c00}{23}!\equiv! 0\Rightarrow,691 = \color{#c00}{23}(30)!+!1\equiv 1,,$ so $\ 691!+!6\equiv 7\ \ $ – Bill Dubuque Nov 01 '20 at 22:21
0

You should eliminate single digit prime factors first: $2, 3, 5, 7$.

  • By observation, both are odd. Eliminate $2$.
  • By sum of digits rule, both are not divisible by $3$.
  • By observation of last digit, both are not divisible by $5$.
  • For 7, you can apply this rule and check that both are not divisible by $7$

Let us also eliminate 11 since it has an easy to check divisibility rule.

  • For 11, you can apply the divisibility rule (Form the alternating sum of the digits. The result must be divisible by 11) and check that both are not divisible by $11$

Therefore one of the factor is at least 2 digits.

Answer #1: Use the divisibility rules given here for primes up to 30. This works since the square root of 697 lies between 26 and 27.


Answer #2: Using digital roots

Since the numbers themselves are 3 digits and no single digit factor exists, both factors must be 2 digits (for both numbers).

We have, $p = 10a + b, q = 10c+d$


Further steps for 691:

$pq = (10a + b)(10c + d) = 691$

The digital root of an integer $n$ is denoted by $dr(n)$.

The digital root of $691$ is $dr(691) = 7$.

Using this Vedic square, also shown below, we see that:

enter image description here

$$\{(dr(p),dr(q))\} \equiv \{(1,7), (2,8), (4,4), (5,5), (7,1), (8,2)\}$$

are the possibilities. Due to commutativity of multiplication, we can consider the reduced set:

$$\{(1,7), (2,8), (4,4), (5,5)\}$$

Check the primes $11 < p,q \lt 60$ i.e., $13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59$ Their respective digital roots are: $4, 8, 1, 5, 2, 4, 1, 5, 7, 2, 8, 5$

So, $\{(p,q)\} \in \{(19,43), (37,43), (29,17), (29,53), (47,17), (47,53), (13,13), (13,31), (31,13), (31,31), (23,23), (23,59),(59,23), (59,59)\}$

We can eliminate redundant pairs using commutativity:

So, $\{(p,q)\} \in \{(19,43), (37,43), (29,17), (29,53), (47,17), (47,53), (13,13), (13,31), (31,31), (23,23), (23,59), (59,59)\}$

Using $691 \mod 10 = 1$, we can eliminate pairs leaving

$${(p,q)\} \in {(37,43), (47,53), (31,31), (59,59)}$$

All these products are greater than 691 which can be checked quickly. For eg: $30 \times 40 = 1200, 40 \times 50 = 2000$ and so on.

Therefore, $691$ must be prime.


Further steps for 697:

The digital root of 697 is $dr(697) = 4$.

Using this the Vedic square again, we see that:

$$\{(dr(p),dr(q))\} \equiv \{(1,4), (2,2), (4,1), (5,8), (7,7), (8,5)\}$$

are the possibilities. Due to commutativity of multiplication, we can consider the reduced set:

$$\{(dr(p),dr(q))\} \equiv \{(1,4), (2,2), (5,8), (7,7)\}$$

Check the primes $11 < p,q \lt 60$ i.e., $13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59$ Their respective digital roots are: $4, 8, 1, 5, 2, 4, 1, 5, 7, 2, 8, 5$

So, $\{(p,q)\} \in \{(19,13), (37,13), (19,31), (37,31), (29,29), (29,47), (41,17), (47,29), (47,47), (23,17), (23,53), (43,17), (43,53), (59,17), (59,53)\}$

We can eliminate redundant pairs using commutativity:

So, $\{(p,q)\} \in \{(19,13), (37,13), (19,31), (37,31), (29,29), (29,47), (41,17), (47,47), (23,17), (23,53), (43,17), (43,53), (59,17), (59,53)\}$

Using $697 \mod 10 = 7$, we can eliminate pairs leaving only those marked by the green cells in the figure below:

Figure

Of these 15, we can eliminate all whose products are lesser than 697 or greater than 697 by using the product of numbers rounded to nearest 10. For eg: $19 \times 13 < 300$, $29 \times 43 > 800$ and so on. You need to check only 3 products $(667, 697 and 767)$ by hand to find out that $697 = 17 \times 41$

Final elimination matrix

This works for small numbers where we can calculate by hand.

You can also force a condition that $p \le q$, but if we do that we should not do the reduction using the commutativity rule.

For larger integers, I have a conjecture that we may be able to extend this digital roots technique to speed up the recovery of divisors. It is still an evolving idea. See my related question: An old multiplication technique and its reverse for Integer Factoring

vvg
  • 3,311
  • 1
    $(41, 17)$ should come from the $(5,8)$ digital root pair. I missed typing it. Transcribing the set from the matrix will help avoiding this error. – vvg Nov 04 '20 at 04:32