# positive three-digit prime numbers

I can solve this problem by typing "prime number under 200" in google and then examining three-digit prime numbers. My question is whether there is way to solve the problem without remembering all the prime numbers under 200.

How many positive three-digit prime numbers less than 200 have two digits the same?

• There are only about 25 possibilities with repeated digits, isn’t that right? It’s really not hard to check whether a number between $100$ and $200$ is prime, since you need to check divisibility only by $3$, $7$, $11$, and $13$. Don’t forget that a number is divisible by $3$ if and only if the sum of its digits is divisible by $3$ (“casting out nines”) and a number is divisible by $11$ if and only if the alternating sum of its digits is divisible by $11$ (like $924$). Of course you can write out a Sieve, too, but that’s rather wasteful. – Lubin Jun 3 '16 at 3:32

## 2 Answers

One way is to consider the digit combinations that allow for "two the same" while also being "positive three-digit primes less than $200$":

• $1X1$
• $11Y$
• $1ZZ$

After finding all possible digit combinations (are there any missing from the above list?), it should be relatively easy to find out which numbers matching one of these categories are prime.

To conclude this approach, consider using $X\in\{0,1,2,3,4,5,6,7,8,9\}$, where we get

$\{101,111,121,131,141,151,161,171,181,191\}\to\{101,131,151,181,191\}$

Using $Y,Z\in\{1,3,7,9\}$, we get

$\{111,113,117,119,133,177,199\}\to\{113,199\}$

Except for $121$, the smallest prime factor of any of the $18$ digit-combination candidates was not greater than $7$, and the final list of primes meeting the stated criteria is:

$\{101,113,131,151,181,191,199\}$

A solution is to make a sieve, cancelling out the numbers from 100 to 199 that have factors of numbers 2-15 (14 squared =196/15 squared = 225). From there you manage to get rid of all numbers that are composite and are left with those three-digit prime numbers less than 200.

It will take time but can be fast if you use shorthand and make shortcuts.