Super Safi’s Monday Morning Math Mayhem 21 – Square Pyramidal and Harshad numbers

Morning Mathematical Monsters & Maniacs!

(Today’s post is sponsored by the letter “M”)


Hi, I’m Super Safi and you may remember me from such stats and strategy posts as Kwik-E-Mart Farming and the advanced losing-to-win Superheroes battle strategy.

Over the past 600+ episodes, The Simpsons has taken us on an amazing mathematical journey involving fractions, probability, Fermat’s last theorem, and hundreds of other aspects from the wonderful world off mathematics.

And what better way to start your week, then by discussing math Monday morning?

With season 30 officially in our rearview mirror after last nights season premiere (shout out to the use of the Pythagorean theorem in last nights episode), we continue our journey today on September 30th, by looking at some properties of the number 30 – Square Pyramidal and Harshad numbers.


In Bart’s Girlfriend (Season 06, Episode 07), Bart develops a crush on Reverend Lovejoy’s daughter Jessica. When Jessica invites Bart over for dinner, Reverend Lovejoy test Bart’s mathematical aptitude.

Helen Lovejoy: “So Bart, how’s school going? Jessica always gets Straight A’s.
Bart: “Well, in my family, grades aren’t that important. It’s what you learn that counts.
Reverend Lovejoy: “Six times five! What is it?
Bart: “Actually, numbers don’t have much use in my future career: Olympic gold-medal rocket-sled champ!
Helen Lovejoy: “I didn’t know the rocket sled was an Olympic event.
Bart: “Well no offense, lady, but what you don’t know could fill a warehouse.

Now for those of you who do make it as Olympic rocket-sled athletes, you may not need to know what six times five is, but for the rest of us:

6   x   5   =   30

So let’s look at a couple properties of the number 30:



Square Pyramidal Number

A square pyramidal number is a number that represents the number of stacked spheres in a pyramid with a square base. So the first four square pyramidal numbers are:

12   =   1

12   +   22   =   1   +   4   =   5

12   +   22   +   32   =   1   +   4   +   9   =   14

12   +   22   +   32   +   42   =   1   +   4   +   9   +   16   =   30

Graphically, 30 as a square pyramidal number can be depicted as follows:

Formulas for calculating square pyramidal numbers was first documented by 12th century Italian mathematician Fibonacci and later refined by 16th century German mathematician Johann Faulhaber.



Harshad Number

20th century recreational mathematician Dattatreya Ramchandra (D.R.) Kaprekar was an Indian school teacher with no formal postgraduate training. In his spare time, he enjoyed dabbling in numbers and discovered many interesting properties of various numbers; one of which were harshad numbers.

Dattatreya Ramchandra Kaprekar

The team harshad comes from the Sanskrit meaning ‘joy-giver’. D.R. Kaprekar found great joy in the number 30, as he found this number was divisible by the sum of its digits.

30  ÷   (3   +   0)   =   30  ÷   3   =   10 with no remainder


If we go back to our first three Math Mayhems from January, we can see if any ot the three numbers we looked at were harshad numbers:

8,191   ÷   (8   +   1   +   9   +   1)   =   8,191   ÷   19   =   431 with remainder 2

8,128   ÷   (8   +   1   +   2   +   8)   =   8,128   ÷   19   =   427 with remainder 15

8,208   ÷   (8   +   2   +   0   +   8)   =   8,208   ÷   18   =   456 with no remainder

So only 8,208 is a harshad number. How narcissistic is that?


20th century Canadian mathematician Ivan Niven, who served as professor of mathematics at University of Oregon for many years as well as president of the Mathematical Association of America, extended harshad numbers beyond base 10 to any n-base in 1977, resulting in Niven numbers. Niven numbers are essentially harshad numbers, but in any base. So 30 in base 10 is a Niven number, in addition to being a harshad number.

Ivan Niven


Now that we’ve completed a look at some properties of the number 30, be sure to keep them in mind when you watch Treehouse of Horror 30 in a couple weeks. Were you able to quickly calculate six times five the first time you saw Reverend Lovejoy pose the question to Bart? Were you familiar with square pyramidal numbers? What about harshad numbers or Niven numbers? Do you know any other numbers that are both square pyramidal and harshad? Sound off in the comments below. You know we love hearing from you.

13 responses to “Super Safi’s Monday Morning Math Mayhem 21 – Square Pyramidal and Harshad numbers

  1. I didn’t see the Pythagorean Theorem in Sunday’s episode. I only saw quadratic equations.

  2. I didn’t see the Pythagorean theorem in Sunday’s episode. The only thing I saw were quadratic equations.

  3. I found 33 Harshad numbers where the Pyramidal number has a “Base” between 1 and 100, the highest of those is 95.
    There the Pyramidal number is 290320, the sum of the digits is 16 and that divides as 18145 and no remainder.
    Had fun getting Excel to work on that, and forgot to tap !!

    • Well done!!!

      • Never thought, do the single digit ones count ?? 1 and 2 were included in those and both 1 and 5 obviously divide by themselves !!
        I set up the “digit stripper” to cope with 12 digit results, so I could make it go a lot further too, or email it in if you like ??

  4. Hey Safi
    Have you ever posted about a method of maximising your odds of picking 3 donuts after you reach level 939.

    Currently when KEM farming I get about 30 chances to win donuts. Some days it seems there’s a definite pattern where the “3 donuts” moves or stays. Other times just random. Anyway not even sure it could be done. Just wondering 🙂

    • No, I’ve only posted comments that I have a sure fired method of getting 3 dounts about 33% of the time. The trick is to always go for the middle one first.

      • 🤣🤣🤣

      • Haha

      • avian? Realizing that I had a high percentage of turns picking the 3 with my third pick, I changed my strategy to pick the one that I would pick last, first. Since then, I have been doing much better.

        • Damn you autocorrect, avian should be “after”

        • I imagine there’s a multiverse with an almost infinity instances of me living across all possible universes. We are of one mind and one of us sacrifices his chance by going first for the rest. This helps the rest of us choose the correct selection. Unfortunately, I seem to be the one to go first all of the time, as my average seems to be about 1 in 3 for my first attempt. 😜

Leave a Reply