**From New Scientist #1363, 23rd June 1983** [link]

“You want to know how old I am?” said Auntie Greta to her two nieces. “Well, as you know, your ages (in years) have no common factor higher than 1. My age (in years) is not an exact multiple of the age of either of you, but the *square* of my age is exactly the average of the *cubes* of your ages. So I am …”

How many years old?

This puzzle brings the total number of Enigmas on the site to 700. There’s a continuous archive of puzzles from Enigma 1299 on 24th July 2004 until the final puzzle, Enigma 1780 at the end of 2013 (482 puzzles). There is also a continuous archive from the start of Enigma in February 1979, up to Enigma 217 on 23rd June 1983 (217 puzzles), along with a lone puzzle from 2000 this brings us to 700 Enigmas in total, and leaves around 1085 puzzles to source and upload.

In total just over 39% of all Enigma puzzles are now available on the site. I will continue to expand the archive as time and internet connection allow.

**Note:** I am waiting for a phone line to be connected at my new house, so I only have sporadic access to the internet at the moment.

[enigma217]

### Like this:

Like Loading...

*Related*

This Python program examines possible ages for the nieces from 1 to 100 years. It runs in 38ms.

Solution:Auntie Greta is 42 years old.The nieces are aged 11 and 13 years old.

There are further solutions for higher numbers. The next solution would be when the Aunt is aged 2387 and the nieces are aged 17 and 225, but this seems impractical.

This puzzle will be pleasing to fans of “The Hitchhikers Guide to the Galaxy”.

Talking about Basic in Enigma 323, here is a Visual Basic console solution for Enigma 217. I compiled and ran it under Visual Studio 2015. I think now I have seen programming solutions on your site in Python, C++, SQL, MiniZinc, Fortran and Basic (both BBC Basic and Visual Basic now). Any more candidates?

When I started coding programmed solutions to Enigma puzzles (Enigma 1361) I was using Perl, and I have put up quite a few Perl solutions (for most of Enigmas 1522 – 1554), although since I learned Python I have tended to prefer it for it’s compactness and readability (although it is often slightly slower). I have coded the odd Enigma puzzle in C to get a faster program, but I don’t think I’ve put any of those up. Also I did have a brief dabble with Julia for Enigma 190.

There have also been contributions to the site in Haskell (although I couldn’t get the program to run) and Mathematica (which I can run on my Raspberry Pi).

If some of those languages can be likened to an elegant suit, Basic is the comfortable jeans and an old sweater. Easy to learn; easy to see what a program is doing (in great contrast to many!). You don’t have to think the program out in advance or “structure” it — though I admit indenting the FOR loops does improve the readability. You can have lots of lovely GOTOs, and Turbo Basic also has an EXIT FOR instruction to leave a loop prematurely without messing up the stack pointer. As Geoff has shown, it doesn’t have to be spaghetti code. Altogether it suits me fine. I just wish for a bit more speed sometimes, for example with my sledgehammer approach to some of these puzzles involving numerous nested loops.

Here are a few other sites I found that have collected programmatic solutions to Enigma puzzles.

[ http://charlespetzold.com/etc/enigma/index.html ] – by Charles Petzold, mostly in C.

[ https://sites.google.com/site/jzapal/fortran_enigma ] – by Jan Zapal, mostly in Fortran 95.

[ http://www.hakank.org/minizinc/ ] – by Hakan Kjellerstrand, Enigma puzzles and more, mostly in MiniZinc.

Here are solutions in the C# and C languages:

In

Enigma 1182I wrote thecoprime_pairs()function to generate coprime pairs. I’ve added a variation of the code to theenigma.pylibrary, so with the latest version you can solve this puzzle with the following Python code:In asal function, what is the purpose of lim variable? it is not used, I guess it is for the end value of the loop.Even if it was meant for the loop, the function would still be inefficient.

How do you know that two numbers are prime? They have no common factor except 1, then gcd(a,b)=1, for example let a=5 and then b=12, so b is not a prime number. This means asal function lacks of checking some numbers as I showed.

[deleted]My intention is to correct the mistake, there is a big mistake in the code,the numbers share a common factor and that is 1. I could not see the code related to it. What about the lim variable? What is the purpose of it? In my opinion, You should talk about the code, not about me. The subject is the code itself, not me! Mahmut

I like to explain a little more in case you do understand, Mahmut. Do check these numbers for example, 8 and 15. Are they prime numbers? They share only a common factor and it is 1. So, asal function is not sufficient since it does not check these numbers, instead there should be a greatest common divisor function. Shorty, gcd(a,b).

Apart from this, The asal function does not seem efficient.

[deleted][deleted][deleted][deleted][deleted]I am going to edit or remove comments in this thread that don’t add to the discussion of this particular puzzle.

Naim: As Ahmet points out the program you have posted solves a variation on the puzzle where the ages of the nieces are both prime (which does ensure that they have no common factor greater than 1, but is not a necessary condition). It turns out that in the solution the nieces ages happen to both the prime, so your program does find the right answer. It also doesn’t seem to check the condition that the aunt’s age is not an exact multiple of either of the nieces ages.

If you want to post an amended version of your code please feel free to.

Jim: Thanks for your comment about my code.

Ahmet has informed me about his comments today.

Therefore, here is my amended version of my code:

MMA code

Aunt Greta's age is 42 and the Nieces ages are 11 and 13

To fast to record any time.

Paul Cleary.

The same algorithm using C++,

The MiniZinc solution below did not need the following condition in the puzzle to get the answer:

“Well, as you know, your ages (in years) have no common factor higher than 1.

Without the condition that the nieces ages are co-prime the next possible solution is:

which are reasonable ages for the nieces, but probably not for Auntie Greta.

With the condition the next possible solution is: