💾 Archived View for thebackupbox.net › ~epoch › blog › reverse-n-avg captured on 2024-12-17 at 10:09:56. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-08-18)

-=-=-=-=-=-=-

primes and otherwise

Update right after posting

the triangle that seed 15 made isn't a Sierpiński triangle. derp me. they look pretty close.

the one I made has a seam down the center... and other things. anyway. still neat.

back to your scheduled programming

I was thinking about the number 3301 and figured it was probably a prime number in reverse too, you know, 1033, because that seems like a property the cicada nerds would nerd over. I checked and it is prime in reverse. calculated the first handful by hand so I could see if it was on oeis.org. It is.

"Primes whose reversal in base 10 is also prime (called "palindromic primes" by D. Wells, although that name usually refers to A002385). Also called reversible primes."

https://oeis.org/A002385

oeis's list only went up to about 1000 and I wanted to go up at least past 3301, so I made a little C program to do this.

Then I started to wonder what the average of a reversible prime and its reverse would be. Always a whole number cuz, all primes (except 2) being odd add up to an even number.

I didn't really expect the averages to clump, but they did.

Then I wanted to see if any of those averages themself were prime.

Some of them are. Didn't really expect there to be that many of them.

Still going farther, some of the prime averages of a reversible-prime and its reverse, were also reversible-primes, but none of them were less than 5 digits, and none of the 5-digit ones were non-palindromes.

took a minute to check the 6 digits, and luckily.

most of the averages that were prime were palindromes, but a few weren't. :)

here's the highest one I calculated

9985139 9315899 avg: 9650519

both 9985139 and 9215899 are primes.

the number halfway between them, 9650519, is also prime.

the reverse, 9150569, is ALSO prime and not a palindrome.

I figure I could make this into a f() and just keep applying it to count how many times it keeps working.

no idea what the point of that would be, but why not?

If I do keep going down this path I'll need to find or make up a better name for these numbers.

I wonder if there are any that loop.

I don't think it'll ever infinite loop. There is a way of finding a number that loops any amount of times you want though.

100101 loops 2 times.

10001001 loops 3 times.

1000010001 loops 4 times.

[got distracted while writing this and played some more math]

so I made it output each iteration of the loop and made like, 100 digit versions of the 10001001-like numbers.

and got a triangle. which I didn't expect, but probably should have. the division being done on the '1' in the center made its value widen out and the zeros acted as padding preventing the center numbers from fucking up the end '1's.

there was an odd empty triangle near the top though and I expected it to continue into something that looked like a

Sierpinski Triangle

but it didn't. it was just one triangle.

so I started parameterizing it so I could explore the space easier and found that even though this one didn't make a fancy triangle, other seed numbers do.

15 was the first one.

seeds that contain only even numbers seem to die out after the second loop.

which, now thinking about it, makes sense. the even numbers divide evenly and don't affect the surrounding digits and fall into a palindrome quickly when averaged with their reverse.

here's a picture of seed 15

[img]

and.. the code for this crap is at

//git.thebackupbox.net/reverse-n-avg