32

I once heard it asserted that $91$ is the smallest composite number that is not obviously composite. The reasoning was that any composite number divisible by $2$, $3$, or $5$ is obviously composite, and the only composite numbers less than $91$ that are not divisible by $2$, $3$, or $5$ are $49$ and $77$, and it's obvious that those are obviously composite.

I'm going to go out on a limb and wildly guess that $577$ might be the largest prime number that is as obviously prime, or at least as quickly and easily seen to be prime as it is.

It's obviously not divisible by $2$, $3$, or $5$, and $7$ and $11$ are instantly rejected since subtraction of $77$ from this number leaves $500$, and $13$ is rejected since this number plus $13$ is $590$ so we've reduced it to thinking about the two-digit number $59$, and likewise subtracting $17$ from this number leaves $560$, and $56$ is not divisible by $17$, and subtracting $7$ leaves $570$ and $57$ is divisible by $19$, so we reject $19$. Finally, adding $23$ gives $600$, so we reject that, and there's no occasion to go higher than $23$ since $23+1 = 24=\lfloor\sqrt{577}\rfloor$.

So staring at it for ten seconds gives you the answer without writing anything or doing any divisions or looking at factorizations of nearby numbers that don't reduce instantly to two-digit problems. It's not unusual to reject a bunch of primes by doing this, but rejecting all of them by instantaneous reduction to one- or two-digit problems I don't recall seeing before.

Are there any bigger primes than $577$ where this is so quick and simple?

Michael Hardy
  • 1
  • 30
  • 276
  • 565
  • When I read the title first thing that came to my mind was [primality certificate](http://en.wikipedia.org/wiki/Primality_certificate). It would be more obvious to me if the number was given with a certificate. Anyway, great question ;-) – dtldarek May 23 '12 at 21:48
  • I believe that $\lfloor\sqrt{577}\rfloor = 24$... – u8y7541 May 13 '17 at 21:51
  • @u8y7541 : Fixed. $23$ is not the "floor" of $\sqrt{577}$ but it is the "prime floor" of $\sqrt{577}. \qquad$ – Michael Hardy May 14 '17 at 16:19

6 Answers6

52

https://mail-attachment.googleusercontent.com/attachment/?ui=2&ik=d860272f52&view=att&th=1377ee83b77f21fe&attid=0.1&disp=inline&realattid=f_h2ltntdx0&safe=1&zw&saduie=AG9B_P8uPzelpU1LhLRsIhOPqY2S&sadet=1337869307510&sads=h0-lBxxRSr2ieDrKqhhlK1j0axM ${}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}$

Will Jagy
  • 130,445
  • 7
  • 132
  • 248
  • 1
    Oy Will. While I appreciate the humour, this really doesn't answer the question. – Willie Wong May 24 '12 at 14:56
  • True, true. ${}{}{}$ – Will Jagy May 24 '12 at 15:05
  • 9
    I don't consider this humour, I consider this a very lame *attempt at* humour. If you want to get an upvote from me you'll have to do better than that. – Rudy the Reindeer May 24 '12 at 15:08
  • 13
    It answers the question, since its not very clear what is a 'big number' – TROLLHUNTER May 24 '12 at 15:15
  • Not my attempt. Please see http://books.google.com/books?id=kxcXm_Q9csEC&pg=PA189&lpg=PA189&dq=phantom+tollbooth+%22inside+was+the+biggest+3+Milo+had+ever+seen%22&source=bl&ots=9Di4nzAL6g&sig=1IrohSRdXozH4n7xvwfFibTunVQ&hl=en&sa=X&ei=o5O9T6jhLoqhiALnp8SgDg&ved=0CDYQ6AEwAA#v=onepage&q&f=false – Will Jagy May 24 '12 at 15:17
  • 2
    Lewis Carol wrote this same joke before any of us were born. – Michael Hardy May 24 '12 at 17:41
  • 21
    All threes are equal, but some are more equal than others. – Gerry Myerson May 25 '12 at 01:35
  • 6
    This is a big numeral, not a big number. :p –  Dec 01 '12 at 19:08
  • 4
    @Hurkyl, this is from a book called The Phantom Tollbooth, http://en.wikipedia.org/wiki/The_Phantom_Tollbooth . In the Numbers Mine, Milo asks for the biggest number and is shown a huge 3. See http://books.google.com/books?id=kxcXm_Q9csEC&pg=PA189&lpg=PA189&dq=phantom+tollbooth+%22inside+was+the+biggest+3+Milo+had+ever+seen%22&source=bl&ots=9Di4nzAL6g&sig=1IrohSRdXozH4n7xvwfFibTunVQ&hl=en&sa=X&ei=o5O9T6jhLoqhiALnp8SgDg&ved=0CDYQ6AEwAA#v=onepage&q&f=false – Will Jagy Dec 01 '12 at 19:31
18

We have that $677$ is obviously not divisible by $2, 3$, or $5$. Subtracting $77$ leaves $600$ which is not divisible by $7$ or $11$. Adding $13$ to it leaves $690$ which also reduces it to thinking about the two digit number $69$. Likewise subtracting $17$ from this number leaves $660$, and $66$ is not divisible by $17$, and subtracting $57$ leaves $620$ and $62$ is not divisible by $19$, so we reject $19$. Finally, adding $23$ gives $700$, so we reject that, and there's no occasion to go higher than $23$ since we have that $\lfloor\sqrt{677}\rfloor = 26$ so we need only check up to $23$.

As a bonus let's try $977$ which is prime. We have that $977$ is obviously not divisible by $2, 3$, or $5$. Subtracting $77$ leaves $900$ which is not divisible by $7$ or $11$, which also reduces it to thinking about the two digit number $90$ which is neither divisible by $7$ or $11$. Adding $13$ to it leaves $990$ which also reduces it to thinking about the two digit number $99$. Likewise subtracting $17$ from this number leaves $960$, and $96$ is not divisible by $17$, and subtracting $57$ leaves $920$ and $92$ is not divisible by $19$, so we reject $19$. Adding $23$ gives $1000$, so we reject that. Subtracting $87$ leaves $890$ and $89$ is not divisible by $29$, so we reject $29$. Finally, adding $93$ to $977$ gives us $1070$ and $107$ is not divisible by $31$ so we reject $31$ as well. Since we have that $\lfloor\sqrt{977}\rfloor = 31$, we need only check up to $31$ so we are done.

Michael Hardy
  • 1
  • 30
  • 276
  • 565
Eugene
  • 7,210
  • 2
  • 31
  • 66
  • Maybe this is a part of a general pattern, and maybe one of many such patterns. I hadn't noticed one so simple before. – Michael Hardy May 23 '12 at 17:31
  • I suspect it is. I'm just going to conjecture that this will work for all primes 77 mod 100. I'll think about it more when I'm less busy. – Eugene May 23 '12 at 17:36
  • 6
    Are you suggesting that $100000000000003177$ is obviously prime? – Robert Israel May 23 '12 at 17:46
  • Fair enough. If it gets too large I suppose it is a problem. – Eugene May 23 '12 at 17:52
  • Obviously it won't word in all such cases. It won't work with $777$, nor with $1177$, nor with $29877= 3\cdot23\cdot433$. And lots of others. – Michael Hardy May 23 '12 at 20:47
  • @MichaelHardy, those numbers you listed aren't primes. – Eugene May 24 '12 at 00:26
  • @Eugene : That's exactly what I was saying. – Michael Hardy May 24 '12 at 05:47
  • 2
    My conjecture was for primes 77 mod 100 though rather than an if and only if statement i.e. if n is a prime 77 mod 100 that is not too big, then we can perform a procedure similar to the ones above. – Eugene May 24 '12 at 05:53
  • Continuing a bit further using the well-known $1001=7\cdot11\cdot13$ as a starting point. "Near" by we find $899=31\cdot29$, $989=23\cdot43$, $988=19\cdot52$, $1003=17\cdot59$ (use respective multipliers 40,50 and 60, if you don't have the multiplication table of two-digit integers in your head) allowing us to conclude that 991 and 997 are primes. – Jyrki Lahtonen Jul 04 '12 at 07:22
  • Since $677$ is of the form $n^2+1$, we don't need to check any primes congruent $3$ mod $4$, so only two of those non-trivial tests are necessary ($13$ and $17$)! – Erick Wong Sep 26 '15 at 19:46
11

This quicker primality test can be done for numbers in any arithmetic progression. For example, rather than $577$ let's consider more generally numbers of the form $\rm\:m = 10\:\!n \!-\! 3.\:$ Because we are considering only $1/10$ of the integers, we can effectively reduce an Eratosthenes sieve primality test on $\rm\:m\:$ to a sieve on an integer roughly $1/10\,$'th the size of $\rm\:m,\:$ namely $\rm\:n.\:$ Indeed, we have

Theorem $\ $ If the positive integer $\rm\ m\: =\: 10\:\!n\!-\!3 < 841 = 29^2\:$ then

$$\rm 10\:\!n\!-\!3\ \ is\ prime\iff 3\nmid n,\ \: 7\nmid n\!-\!1,\ \: 11\nmid n\!+\!3,\:\ 13\nmid n\!+\!1,\:\ 17\nmid n\!-\!2,\:\ 19\nmid n\!-\!6,\:\ 23\nmid n\!+\!2 $$

Proof $\ $ Since $\rm\:m < 29^2,\:$ if it is composite it must be divisible by a prime $\rm\:p < 29,\:$ hence $\rm\:p \le 23.\:$ Consider, e.g. $\rm\:p = 13\:|\:10\:\!n\!-\!3\iff 13\:|\:10\:\!n\!-\!3\!+\!13 = 10(n\!+\!1)\iff 13\:|\:n\!+\!1,\:$ etc. $\ \ $ QED

Your example $\rm\:577 = 10\cdot 58 - 3\:$ so the above primality test amounts to checking if any of the above $7$ primes divide $\rm\: 58\pm k,\:$ for $\rm\:k\le 6,\:$ which can be done very quickly mentally, as you did.

Bill Dubuque
  • 257,588
  • 37
  • 262
  • 861
8

There is a very nice paper about this, Guy, Lacampagne, and Selfridge, Primes at a glance, Mathematics of Computation Vol. 48, No. 177, Jan., 1987, pages 183 to 202. I think that back issues of this journal are freely available at the American Mathematical Society website.

There is a follow-up paper by Agoh, Erdos, and Granville, Primes at a (somewhat lengthy) glance, The American Mathematical Monthly Vol. 104, No. 10, Dec., 1997, pages 943 to 945, but I'm pretty sure that one's behind a paywall if you don't connect from a subscriber.


EDIT: Link to Primes at a glance mentioned above.

Daniel R
  • 3,133
  • 3
  • 24
  • 39
Gerry Myerson
  • 168,500
  • 12
  • 196
  • 359
2

can't resist following the pattern: 877. Additionally, need to test for 29 (but trivial)

karakfa
  • 2,540
  • 11
  • 14
1

How quick is quick enough?

$n=1601$. Let $x=39$. $1601=40^2+1=40x+41=x^2+x+41$ which, as is well known, is prime for integer $0\leqslant x<40$.

$n=2081$ obviously has the form $x^2+5y^2$ ($x=9, y=20$) so every prime factor of $n$ has an even tens-digit. Clearly not 3.

  • 7: $2100-n=19$ and $7\nmid 19$.
  • 23: $2300-n=219$; $230-219=11$ and $23\nmid 11$.
  • 29: $n+29=2110$; $211+29=240$ and $29\nmid 24$.
  • 41: $n-41=2040$; $5\cdot 41=205$ so $41\nmid 204$.
  • 43: $43^2$ ends in 9; $43\cdot 47=45^2-2^2=2021\ne n$ and any other composite with smallest prime factor $\geqslant 43$ would be $>n$.
Rosie F
  • 2,418
  • 1
  • 8
  • 26