Monday, October 26, 2020

Favorite Vampire

I was recently asked who my favorite vampire was.  I said, "the muppet from Sesame Street."

They told me, "he doesn't count!"  I replied, "I assure you he does."
-Anonymous

Monday, October 12, 2020

Well Yes, But Actually No. Matrix Multiplication Gone Horribly Right.

Saw a funny cartoon meme that showed how to do matrix multiplication the "wrong" way.
It made me wonder how many solutions would work using the wrong method the meme outlined. To answer this, I wrote a quick Ruby script to check all possible values for a1, a2 .. d1, d2 in the range 0-9 to see which satisfy the following matrix multiplication:
| a1 b1 | | a2 b2 | = | a3 b3 |
| c1 d1 | | c2 d2 |   | c3 d3 |
where:
a3 = a1 * 10 + a2
etc.
For example:
| 3 6 | | 9 3 | = | 39 63 |
| 4 3 | | 2 9 |   | 42 39 |
or lexically:
| s t | | w x | = | sw tx |
| u v | | y z |   | uy yz |
Assuming we check every possible combination, there would 9^8, or 43,046,721 combinations. That's not too large, and with some early checks, we should be able to significantly prune the search space down to around 100K.

Ignoring the trivial case (all zeroes), there are exactly 100 possible solutions. Of those, 82 have identical "right" diagonals where:
b1 = b2 and c1 = c2
but only 24 have identical "left" diagonals where:
a1 = a2 and d1 = d2
Some questions to think about:
1) Why exactly 100 solutions? It seems too non-random.
2) Why do so many (82) have matching "right" diagonals?
3) Are some solutions "duplicates" because of rotations, transposition, etc.?
4) Would you see similar numbers for 3x3 matrices?
| a b c | | j k l | = | aj bk cl |
| d e f | | m n o |   | dm en fo |
| g h i | | p q r |   | gp hq ir |
For those interested, here is the Ruby code I used:
#!/usr/bin/env ruby

count = 0
ldiags = 0
rdiags = 0

(1..9).each do |a1|
   (1..9).each do |b1|
      (1..9).each do |c1|
         (1..9).each do |d1|
            (1..9).each do |a2|
               a3x = (a1 * 10) + a2  # expected a3

               # actual a3 = (a1 * a2) + (b1 * c2)
               # so if (a1 * a2) is already larger
               # than our expected (a3x), we can 
               # skip checking anything else 
               next if (a1 * a2) > a3x

               (1..9).each do |b2|
                  b3x = (b1 * 10) + b2  # expected b3

                  # actual b3 = (a1 * b2) + (b1 * d2)
                  # so if (a1 * b2) is already larger
                  # than our expected (b3x), we can 
                  # skip checking anything else 
                  next if (a1 * b2) > b3x

                  (1..9).each do |c2|
                     a3 = (a1 * a2) + (b1 * c2)  # actual a3
                     next if a3 != a3x

                     c3x = (c1 * 10) + c2  # expected c3

                     c3 = (c1 * a2) + (d1 * c2)  # actual c3
                     next if c3 != c3x

                     (1..9).each do |d2|
                        b3 = (a1 * b2) + (b1 * d2)  # actual b3
                        next if b3 != b3x

                        d3x = (d1 * 10) + d2  # expected d3

                        d3 = (c1 * b2) + (d1 * d2)  # actual d3
                        next if d3 != d3x

                        # found a solution
                        count += 1
                        puts count
                        puts "| #{a1} #{b1} | | #{a2} #{b2} | = | #{a3} #{b3} |\n"
                        puts "| #{c1} #{d1} | | #{c2} #{d2} |   | #{c3} #{d3} |\n"

                        if (a1 == a2) && (d1 == d2)
                           ldiags += 1
                        end
                        if (b1 == b2) && (c1 == c2)
                           rdiags += 1
                        end
                     end
                  end
               end
            end
         end
      end
   end
end
         
puts "count:  #{count}"
puts "ldiags:  #{ldiags}"
puts "rdiags:  #{rdiags}"
PS. I found this as well. Apparently this meme spawned lots of interest. https://codegolf.stackexchange.com/questions/211918/bad-matrix-multiplication-that-gives-the-right-answer

Monday, August 31, 2020

Pi Mask

Thanks to a friend of the wife at the local college, our family got outfitted with these snazzy new masks:

Wednesday, September 18, 2019

I Ate Some Pi

These awesome plates were a gift from a family member many years ago. We use them all the time, and they couldn't be more perfect for us. Now that it's apple season, it's time to make some apple Pi.

Tuesday, September 10, 2019

Palindrome Dates (3)

 Happy palindrome date day!  9/10/2019 ... what will we do in 2020?

Monday, April 30, 2018

Happy Birthday to Gauss, Father of the First Predictive Algorithm

Today, April 30th, we celebrate the birthday of Carl Friedrich Gauss, often called the “Prince of Mathematicians.”

There are some fun details about his life and work available via the Google doodle page:

Image source: Google Doodle of the Day

The Quartz site also has an excellent article: https://qz.com/1265493/carl-friedrich-gauss-celebrating-the-father-of-the-predictive-algorithm

Thursday, January 4, 2018

New Largest Prime - 23,249,425 Digits!

The Great Internet Mersenne Prime Search (GIMPS) has discovered the largest known prime number, 2^77,232,917 - 1, having 23,249,425 digits. The number, called M77232917, is the 50th "Mersenne prime" to be discovered. https://www.mersenne.org/primes/press/M77232917.html

Monday, October 16, 2017

Almost All Numbers Contain the Digit Three

My mind was blown today when I came across the assertion (and proof!) that almost all numbers contain the digit '3'.

For small numbers of a given length of digits, you can count the ones that contain the digit '3'. You can see these values in the following table:

Number of digits Examples % Containing 3
1 (0-9) 3 10% (1)
2 (0-99) 3,13,23,30,31,32,33,34,35,36,37,38,39,43,53,... 19% (19)
3 (0-999) 3,13,...,30-39,...,300-399,430-439,... 27% (271)

You can count them by hand, but the count 'C' for any given number of digits 'n' is given by the following formula:

C = 10^n - 9^n

Thus the percentage is given by:

% = (10^n - 9^n) / 10^n
% = (10^n / 10^n) - (9^n / 10^n)
% = 1 - (9/10)^n

Taking the limit of this a n -> inf and you see that % = 1.

James Grimes does an excellent job of explaining it in this video:
https://www.youtube.com/watch?v=UfEiJJGv4CE

Monday, July 10, 2017

Palindrome Dates

If you follow the traditional American format of mm/dd/yyyy for dates, then today, 7/10/2017 is "palindromic". The next date to follow this format will be 8/10/2018. Coincidentally, it also works for the mm/dd/yy format -- 7/10/17. If you follow the European format of dd/mm/yyyy, you're going to have to wait until October 7, 2017 -- which, you guessed it -- also comes out as 7/10/2017. PS. Yes, I know I've played fast and loose with leading zeroes.

Thursday, July 6, 2017

Climb To Prime

John H. Conway’s proposed a list of math problems for which he is offering $1000 for a solution.   One of those is his “Climb to a Prime” conjecture, which is stated as:

Problem 5. Climb to a Prime:

Let n be a positive integer. Write the prime factorization in the usual way, e.g. 60 = 22 · 3 · 5, in which the primes are written in increasing order, and exponents of 1 are omitted. Then bring exponents down to the line and omit all multiplication signs, obtaining a number f(n). Now repeat.

So, for example, f(60) = f(22 · 3 · 5) = 2235. Next, because 2235 = 3 · 5 · 149, it maps, under f, to 35149, and since 35149 is prime, it maps to itself. Thus 60 → 2235 → 35149 → 35149 → ..., so we have climbed to a prime, and we stop there forever. The conjecture, in which I seem to be the only believer, is that every number eventually climbs to a prime. The number 20 has not been verified to do so. Observe that 20 → 225 → 3252 → 223271 → ... , eventually getting to more than one hundred digits without yet reaching a prime!

James Davis took up the challenge and found a counterexample: 13532385396179 = 13 ⋅ 532 ⋅ 3853
This prime number fails the conjecture because its factorization maps back to itself!

You can read a few more details here:

http://www.popularmechanics.com/science/math/news/a26815/why-13532385396179-is-a-magic-number/

Wednesday, July 5, 2017

Finding the Right Math Class

An XKCD strip my kids could all relate to, from the author of "What if..." which they also loved:

https://xkcd.com/1856/

Monday, November 21, 2016

One Step Closer to Solving Sierpinski Prime Problem

The Sierpinski prime problem has been around for about 50 years.  The lowest known Sierpinski number is 78,557 and the quest is on to find the smallest.  After decades of effort, it had been narrowed down to six possible candidates: 10223, 21181, 22699, 24737, 55459 and 67607.

It's one of those "pure math" problems that sounds tantalizing simple to calculate, but requires immense computational effort.

After the announcement last month of the 7th largest known prime number, you can now strike 10223 off the list.

https://www.newscientist.com/article/2113283-crowdsourced-prime-number-could-help-solve-a-50-year-old-problem/


Monday, October 31, 2016

Pumpkin Pi

Today, I came across one of our old Halloween pics from a couple years ago (2014 I think) that I thought I would share:

Each year, the kids typically get to design (and help carve) their own pumpkins, and I sometimes get to do one for myself.   This was my contribution for that year.   It was inspired by this old "Foxtrot" comic by Bill Amend:

Jealous much?

Monday, October 10, 2016

Prime Number Distributions

Here's an interesting article that was a hot topic around the dinner table:

https://www.newscientist.com/article/2080613-mathematicians-shocked-to-find-pattern-in-random-prime-numbers/

Prime numbers (other than 2 and 5) must end in a 1,3,7 or 9.  Over the first few hundred million prime numbers, researchers found that a prime ending in 1 is followed by another prime ending in 1 just 18.5 per cent of the time instead of a more or equal distribution of 25 per cent.

Monday, June 6, 2016

My Little Archimedes

M had a to do a presentation for school on someone famous, and chose Archimedes.   Here's one of his props where he demonstrated Archimedes' method for calculating Pi.


Monday, May 23, 2016

Pi In Prime Time

If you're a fan of the Big Bang Theory (a "prime time" comedy!), it will probably come as no surprise that the show has lots of geeky math references. One that you might not have caught is that Amy Farrow Fowler's apartment number is 314.