Enigmatic Code

Programming Enigma Puzzles

Category Archives: project euler

Project Euler: Problem 369

From Project Euler, 29th January 2012 [link]

In a standard 52 card deck of playing cards, a set of 4 cards is a Badugi if it contains 4 cards with no pairs and no two cards of the same suit.

Let f(n) be the number of ways to choose n cards with a 4 card subset that is a Badugi. For example, there are 2598960 ways to choose five cards from a standard 52 card deck, of which 514800 contain a 4 card subset that is a Badugi, so f(5) = 514800.

Find ∑ f(n) for 4 ≤ n ≤ 13.



Enigma 45: Six squares – harder

From New Scientist #1188, 3rd January 1980 [link] [link]

“You may remember,” said Mr Knull, “helping me recently to find the smallest possible set of three different integers P, Q and R such that P+Q, P+R, Q+R, P−Q, P−R and Q−R are all perfect squares. It was P=17, Q=8, R=−8.

“Here now is the harder version. Again you need to find P, Q and R satisfying the same conditions. But this time we don’t allow any of the three integers to be negative.”

Can you help me again, please, by finding the smallest set of three different integers which meet the conditions? By smallest I mean with P+Q+R as small as possible.

This puzzle refers back to Enigma 40.

A solution is given in New Scientist #1189, and in New Scientist #1190 it is noted that no correct solutions were recieved. However I think there is a solution where P+Q+R is smaller than that given as the solution in the magazine.

I sent New Scientist an email about this in December 2011, and in New Scientist #2853 an item was published in the Feedback section about my email, and I was awarded the prize for solving the puzzle 32 years late!

Note: This puzzle resurfaced as Project Euler Problem 142.

Note: This problem is known as Mengoli’s Six-Square Problem (1674). Euler found the smallest solution (1765), by hand.

[enigma45] [euler142]

%d bloggers like this: