# How would one go about finding the Trinity Hall Prime number?

This video on Numberphile talks about the Trinity Hall prime, a number I find truly remarkable.

My question is, how would one go about finding such a number?

This is obviously very open-ended, but here are some possible specifications.

• It was important that the number was prime, because we mathematicians live for that sort of thing.
• It was important that the number of digits was relevant. In this case, it was 1350 (as mentioned in the video).
• It should be very suitable for ASCII art, that is, it should be filled with 0's and some other digit for the most part (in some base, preferably 10).

We obviously allow some "impurities", such as the 1 at the end of the number and the 621 in between, but in general we want our number to roughly meet the requirements.

As far as I understand, this is computationally extremely difficult, and I can't think of any theorems that would help in this venture. Just finding all primes of length 1350 is computationally intensive, and the other restrictions seem to make it even harder.

Even if this number was just found, I imagine that computers find numerous long primes all the time, and the fact that this number was found to have this property requires some amount of "human pulling a rabbit out of a hat". How would one find look at a list of primes and find such properties?

I apologize if this question is too soft, but I do not know of any computational methods that seem even remotely helpful, and I would like to learn more.

Professor McKee explains: "Most of the digits of p were fixed so that: (i) the top two thirds made the desired pattern; (ii) the bottom third ensured that p-1 had a nice large (composite) factor F with the factorisation of F known. Numbers of this shape can easily be checked for primality. A small number of digits (you can see which!) were looped over until p was found that was prime."

but can anyone tell me what is exactly going on behind the scenes in there?

• I think it's all explained in the answers at the earlier question at your link. First, you make the pattern, using ones and eights. Then, you fill it out to 1350 digits with zeros. Then, you change the last digit or two or three to make it a prime. It's not hard, nowadays, with a good computer and good software, to test whether a 1350-digit number is prime, and even if you have to test a few hundred of them, it's still doable. So, can you be more precise about what exactly you want to know? Sep 8 '17 at 9:44
• I don't see how changing the last few digits of a long number gives you control over (a) the primality of a number and (b) the factorisation of p-1 simultaneously. Is there some mathematical reason for why that works? Sep 8 '17 at 9:53
• You are quite right. For $p-1$, you need the last digit to be 1. For primality, you have to fiddle with some of the numbers farther up in the picture. If you just fiddle with a few of them, the picture will still look like the Trinity Hall crest, and if you fiddle with just, say, three of them, you have to test at most 1000 numbers for primality, which is doable. Sep 8 '17 at 9:59

33333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333

0000000000000000000000000000000000000000000000000087700000000000000000000000000000000000000000000000

7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777

it consist of $300$ digit, and start with $33333\cdots$ and ends with $7777\cdots$ and in the middle there is mainly $000\cdots$ with irregular $877$.

It took me less than $5$ second to generate this number using Miller-Rabin test and some iteration from $000$ to $999$ , and the one that generated a prime was $877$.

Generally speaking, i can generate a "shakespeare works" prime if i let $A=1,B=2,\cdots$ with minor irregularity like $3$ digit or so different from the original script (as i could say i added my name in the last, lol).

So its not that hard to make a big primes that satisfy any condition you want, for example its must contain mostly of $1$ or $3$ or $7$ or that its alternate between $1$ and $5$ and so on.