Last digit of a triangular number is the midpoint between two primes

If a triangular number is even, add and subtract 1 to see if you have found two primes, as in 6 +/1 gives 5 and 7. If the triangular number is odd, add and subtract 2 to see whether or not both are primes, as in 105 +/-2 gives 103 and 107. A small sample found that two primes are found with triangular numbers 6, 15, 45, 105, 231, 465, 741, 861. Is it normal to expect so many with last digit 1 or 5? The cycle for last digits of triangular numbers has 20 terms and last digit 0 appears 4 times and last digit 8 appears 2 times. Last digit 1 appears 4 times, last digit 3 appears 2 times (never a solution), and last digit 5 appears 4 times. Will a larger sample conform to the statistically expect distribution?

• Why could a cyclic sequence with period 20 to have unexpected behaviour in the long run? Perhaps I don't understand what you're asking. – Harald Hanche-Olsen Aug 22 '18 at 18:02
• The unexpected behavior concerns the frequency of finding primes using the triangular numbers. Remember that this method asks for a prime on either side of the triangular number at a distance of either 1 or 2. The cycle gives NO guaranteed of finding a prime; rather it does show when they will NOT be found, as in multiples of 3. – J. M. Bergot Aug 22 '18 at 18:37
• Again, will a larger sample show a preponderance of last digits 1 and 5 for the midpoints between two primes as found by the above method? – J. M. Bergot Aug 22 '18 at 19:16
• Ah silly me; total failure of my reading comprehension, sorry. (Not enough caffeine, perhaps?) Well, since primes are getting farther between as numbers get bigger, I would be surprised if this is true. A few lines of code should let you check it out up to fairly large numbers, though. I'd try that before beginning to conjecture anything. – Harald Hanche-Olsen Aug 23 '18 at 8:08
• A little experimentation keeps Grand Theory healthy. Remember to test for the distance to these two primes being either one away from the midpoint or two away. If you enjoyed this question, math.stackexchange.com/questions/2890178/… – J. M. Bergot Aug 23 '18 at 18:01

I think you are right about even numbers: add $1$ or subtract $1$, since

$3 \cdot even - 1 \lor 3 \cdot even +1 = prime$ (if prefer to use positive coefficients $5$ and $7$ here instead of $1$ and $-1$ as of $0$ is regarded an even as well)

But, in case of odd progression you might consider to add $4$ to see the full pattern:

$3 \cdot odd + 2 \lor 3 \cdot odd + 4 = prime$

So for example a triangular number $15$ using the prime number form above will generate:

$13$, $17$, and also $11$ and $19$. In case of last digit $3$, for which you mentioned to have no solution, a triangular number $153$ will give you two prime numbers: $149$ and $157$, but not $151$ and $155$, since the latter one is the product of $5$ and $31$.

• Was any experiments done with even numbers ending in digit 0 or 8 to see if primes can be found for both -1 and +1? For odds ending in 1 or 5: 21,231,351,741,861,1431,3081..for 5: 5,15,45,105,465,1485,4005... – J. M. Bergot Aug 25 '18 at 17:42
• My answer is rather a suggestion, I haven't checked that for all cases. I will do it in a free time, since your question sounds interesting to me. – usiro Aug 25 '18 at 19:02
• Let there be numbers! Let there be evidence! Good luck with your search. – J. M. Bergot Aug 27 '18 at 17:52