Sunday Times Teaser 2632 – Times Table
by Victor Bryant
I have put the numbers 1 to 16 into a four by four table in an order in which the numbers in each row increase from left to right and those in each column increase from top to bottom.
If the top row is read as one number, it has four digits and is the product of the four numbers in the second row.
What are the four numbers in the second row?
4 Comments
Leave one →
Here is my first solution:
You miss 8 out of 10 solutions as s12, s08 and s are not explicitly sorted.
Maybe at the time you published the items in these sets were implicitly sorted.
This line of code relies on the fact that the current implementation of number_theory factor() returns a sorted list of factors.
When checking the factors only 6 first row combinations remain to be checked. It doesn’t make the program a lot faster.
My approach to this teaser has been to start straight away from 1234 for the top row and move on by factoring ujntil one reaches the point whereby second row carries the factors of the first row.