There is no known formula for finding prime numbers. All numbers must be tested to determine whether they are prime or not. There are some interesting patterns that pop up in prime numbers, but you never know how long they will hold.
These types of numbers, where all the digits are the same number except one, are known as near repdigit primes.
Another pattern can be found when adding and subtracting factorials (!). The factorial of a number is the product of that number and all other positive integers less than that number. So for example, 4! = 4 x 3 x 2 x 1.
Alternating adding and subtracting factorials, as shown below, yields primes numbers until you get to 9!.
If you want to see if a number is prime, or find out the factors of number that isn’t prime (those number are called composite), you can check numbers from 1 to 100,000,000 at cpnumbers.com.