This morning the boys and I did a really fun computer / number theory project based on a problem that Dan Anderson sent to us. Here’s the write up of that project:
A neat problem Dan Anderson shared with us
and here’s the original problem, which is problem #12 in Project Euler:
What is the first triangular number with more than 500 divisors?
We solved that problem using Mathematica and also talked about a natural extension of that problem – what is the first triangular number with exactly 500 divisors?
The interesting thing about this second question is that all of the triangular numbers that we found with exactly 500 divisors were even (and in, fact, multiples of 16). After we turned off the camera, we wondered why that was the case.
It was easy to modify the code to look for triangular numbers with exactly 500 divisors that were also odd. We didn’t find any, though – even after searching through the first 200,000,000 triangular numbers.
Why, though? Why would a triangular number with exactly 500 divisors have to be even?
Eventually I realized that I could modify the code even more to make the search more efficient (and the code more and more completely impossible for anyone but me to understand . . . .). Those modifications and efficiencies came from thinking about the math behind the problem.
The math says that a number with exactly 500 divisors has some special properties. For example, it might be a product of 3 primes to the 4th power and 2 primes to the 1st power. It might be a product of 2 primes to the 9th power and one prime to the 4th power. There are a few other possibilities, but not many more. I figured I could speed up the process by searching through the triangular numbers that were divisible by 3^4. This search was still fairly slow, though, and didn’t find anything up into the 300,000,000th triangular number.
What about 5^4? nope – still too slow.
What about 7^4? Gold!!!
But, I got ahead of myself, because searching for triangular numbers divisible by 11^4 produces these results:
The 484,983,125th triangular number – namely 117,604,316,009,874,375 – is what I now think is the smallest odd triangular number with exactly 500 divisors.
But if you look carefully, you’ll see something else in that picture. Something that only appeared because I wasn’t at the computer to stop it after the other discovery. Namely, the 1,482,401,249th and 1,482,401,250th triangular numbers both have 500 divisors and are both odd! Twins!!
The numbers are enormous and their factors are really cool:
I wonder if there are infinitely many of these odd twins??!!
I don’t get to do a lot of math like this any more. A day of playing around, thinking about the math, and a lot of trial and error was really fun and even produced some interesting results. That’s really what math is about for me.
This evening I sat down with the kids to talk about the fun we had today and ask them if there were any other searches they’d like to try out. Here are those two quick talks: