Enigmatics

Enigma 1480

Posted on: Sunday 10/2, 2008;  12:04 PM

Use the convention that the children {"Ann", "Ben", "Con", "Den", "Ern"} correspond to the list {1,2,3,4,5} when using indices to lists.

Construct a list of all permutations of {True, True, True, False, False} which specifies all possible ways in which the 5 children lie or tell the truth.

"BE3411633860_1.gif"

"BE3411633860_2.gif"

Construct a list of all permutations of the list {1,2,3,4,5} which specifies all ways in which the 5 childrens' ages can be arranged in increasing order.

"BE3411633860_3.gif"

Use the above lists to construct the joint list of truth/lie and age ordering. There are 1200 such cases.

"BE3411633860_4.gif"

"BE3411633860_5.gif"

Construct the list of the 10 statements about pairs of relative ages.

"BE3411633860_6.gif"

"BE3411633860_7.gif"

Define a function for determining whether a particular joint truth/lie and age ordering satisfies a particular statement about a pair of relative ages.

"BE3411633860_8.gif"

Extract the cases in the joint list of truth/lie and age ordering that satisfy all 10 statements about pairs of relative ages. There are only 8 such cases.

"BE3411633860_9.gif"

"BE3411633860_10.gif"

Construct a list of all possible pairs of ages that could be compared.

"BE3411633860_11.gif"

"BE3411633860_12.gif"

Compute how many of these pairs are valid statements for each the surviving cases of truth/lie and age ordering. Only one case has 12 valid statements, which is therefore the sought after solution.

"BE3411633860_13.gif"

List the solution in detail.

"BE3411633860_14.gif"

Permalink   Notebook

Enigma 1479

Posted on: Thursday 31/1, 2008;  7:29 PM

Construct a list of all the 3-digit positive numbers.

"BE3410796582_1.gif"

Deduce all of the factors of each number in the above list. This is done in 3 steps: (1) Compute the prime factors (and their multiplicities) of each number, (2) Unravel this to create a list of all prime factors (including 1) of each number, (3) Pick all possible subsets of these prime factors to build all of the integer factors of each number, and restrict each one to occurring only once.

"BE3410796582_2.gif"

Construct a list of all possible 4-tuples of indices to the list of numbers that form an arithmetic progression. 299 is the maximum step length that is consistent with a 4-tuple fitting into the list of numbers {100, ..., 999}.

"BE3410796582_3.gif"

"BE3410796582_4.gif"

Pick out those 4-tuples that have numbers whose corresponding lists of integer factors have lengths that form an arithmetic progression with common difference 1. There is only one case that satisfies this constraint.

"BE3410796582_5.gif"

The solution is the smallest and the largest 3-digit integers.

"BE3410796582_6.gif"

Permalink   Notebook

Enigma 1478

Posted on: Friday 25/1, 2008;  7:04 PM

Constuct a list of all perfect squares with 1, 2, 3, or 4 digits, and then split each square into its constituent digits.

"BE3410276640_1.gif"

Remove all cases where the squares contain repeated digits, then split the resulting list into 4 sublists corresponding to 1-digit, 2-digit, 3-digit, and 4-digit squares.

"BE3410276640_2.gif"

"BE3410276640_3.gif"

Construct a list of partitions of 10 formed from the integers 1, 2, 3, and 4 that can be used as indices to pick candidate lists of 4 sublists from the above list, which are thus guaranteed to have a total of exactly 10 digits in them. The condition that the digits are different has not yet been applied here.

"BE3410276640_4.gif"

"BE3410276640_5.gif"

Construct a list of all of the candidate lists of 4 sublists.

"BE3410276640_6.gif"

"BE3410276640_7.gif"

Pick out the cases in which all of the digits are different. There are only 4 such cases.

"BE3410276640_8.gif"

Pick out Peter and Quentin's cases, which must have exactly 2 squares in common.

"BE3410276640_9.gif"

Remove Peter and Quentin's cases to leave 2 cases yet to be assigned.

"BE3410276640_10.gif"

Pick out Rose's case, which must not have any squares in common with either Peter or Quentin's cases.

"BE3410276640_11.gif"

Remove Rose's case to recover Stanley's case.

"BE3410276640_12.gif"

Permalink   Notebook

Enigma 1477

Posted on: Thursday 17/1, 2008;  3:43 PM

Define the names of the people.

"BE3409573418_1.gif"

"BE3409573418_2.gif"

Define the landing and departure times.

"BE3409573418_3.gif"

Create a list of all possible landing and departure times, where a single case has the format {landings:{hw1, hw2, hw3}, departures:{hw1, hw2, hw3}} = {{{lh1,lw1}, {lh2,lw2}, {lh3,lw3}}, {{dh1,dw1}, {dh2,dw2}, {dh3,dw3}}}. In order to limit the size of the list it is immediately constrained to enforce the landing times of each husband-wife pair to be exactly as defined.

"BE3409573418_4.gif"

"BE3409573418_5.gif"

Construct a list of all possible alternative departure times in which husbands and wives are paired up in all possible ways (!).

"BE3409573418_6.gif"

Extract the set of cases that fit the above alternatives.

"BE3409573418_7.gif"

"BE3409573418_8.gif"

Extract the cases in which all the people had different waiting times.  There are only 2 possibilities.

"BE3409573418_9.gif"

Compute the waiting times for these 2 cases.

"BE3409573418_10.gif"

For each of the 2 cases compute the number of husbands who waited for a shorter time than their wives. This tells us that the first case is the one for which more than one husband had a shorter wait than his wife.

"BE3409573418_11.gif"

For the first case compute the ordering of the waiting times.

"BE3409573418_12.gif"

List the names in the order given by the above ordering. This is the required solution.

"BE3409573418_13.gif"

Permalink   Notebook

Enigma machine

Posted on: Monday 14/1, 2008;  11:24 AM

This is adapted from Figure 36 of The Code Book by Simon Singh. The Enigma machine itself is modelled as a discrete time dynamical system. However the time series of inputs and outputs are treated as whole lists (with no particular starting time index) rather than as sequences of individual values (with a definite starting time index). For instance, this makes it easy to feed different inputs to an Enigma machine starting in the same state, because there is no need to erase any previous inputs and outputs.

Load the Combinatorica` package in order to manipulate permutations and cycle structures.

"BE3409298687_1.gif"

Define the initial state of the 3 scrambler wheels. Each is a random permutation of 26 letters.

"BE3409298687_2.gif"

"BE3409298687_3.gif"

"BE3409298687_4.gif"

"BE3409298687_5.gif"

Define the update rules for the scrambler wheels. Because this behaviour is periodic it would be much more efficient to compute the state at any time directly from the initial state, without going through all the intermediate time steps as is done here to illustrate the evolution of a discrete time dynamical system.

"BE3409298687_6.gif"

Define the reflector. Create a random permutation of 26 letters, partition it into 13 2-cycles, then convert this into the corresponding permutation.

"BE3409298687_7.gif"

"BE3409298687_8.gif"

Define the Enigma Machine encoding function for a single character (as a code in the range 1-26). Propagate forwards through the 3 scrambler wheels, through the reflector, then propagate backwards through the 3 scrambler wheels again.

"BE3409298687_9.gif"

Define some "enigmatic" message text.

"BE3409298687_10.gif"

Convert it to a list of character codes offset so that "A" is 1.

"BE3409298687_11.gif"

"BE3409298687_12.gif"

Encode the list of character codes starting at time 0.

"BE3409298687_13.gif"

"BE3409298687_14.gif"

Convert the encoded list to cipher text.

"BE3409298687_15.gif"

"BE3409298687_16.gif"

Concatenate all of the above operations to define the Enigma machine encoding function for a whole message.

"BE3409298687_17.gif"

Verify that the cipher text decodes correctly.

"BE3409298687_18.gif"

"BE3409298687_19.gif"

Verify that the cipher text decodes incorrectly if the scrambler wheels start off in the wrong state.

"BE3409298687_20.gif"

0 ANDWHENHELAIDEYESONHERHEGOTTHEFEELINGTHEYHADMETBEFORE
1 HRNGXEYOIFPIWXCJMOWFIVJPPMSSBSTLCVPXETPDHGJDUEAVEFCIJ
2 KWRAGORRIOJMTUETVSMHKVNITMRGZCDFKFJHDZXJGUIDINUCKLQHI
3 TGTJNZOASEJMJKCNLSVLIFSGSMXIHGHDSDQFCZXRUWWMSMSWKFLST
4 IARZQSEPDNNWRSEWUCCQKQLARVFSPNOLSCKEIZXFWGYLWAAULMANO
5 CJTIZPMJWUNHBCIMBNFAOALHXUTCPHITSBIDQIDPGQIZDCIRFGPCD
6 CZXPOFWJTXXAFGNVEGOUMHUBFIDAPOPTYHQJEHDTQOSBXMHBKLARS
7 GICSINANJGIXHIXCNDDSMBTZTKHZVIJTYPYROVDAONQLEYDJJKGCD
8 GPMBIXCNRVBNFGRFCTRRMIHHDUOYVGHZYDYFSXMUNMPVVNVFUVUIJ
9 QSGQMBAXBPYVHIAOWFQFVCJPHEIEVOPZHNYPZHLBMSOMYYIXPQGWX
10 BBPKMDCIFPOFLMQDPZWHUATPOCPMEWXZGRETTRZVSAOXTEPKEFXIJ

Permalink   Notebook

Recent Posts
31/1, 2008; 7:29 PM:
Enigma 1479
25/1, 2008; 7:04 PM:
Enigma 1478
17/1, 2008; 3:43 PM:
Enigma 1477
14/1, 2008; 11:24 AM:
Enigma machine
11/1, 2008; 3:43 PM:
Enigma 1476
7/1, 2008; 9:11 PM:
Enigma 1475
21/12, 2007; 4:40 PM:
Enigma 1474
14/12, 2007; 1:36 PM:
Enigma 1473
9/12, 2007; 12:40 PM:
Enigma 1472
2/12, 2007; 11:55 AM:
Enigma 1471
1/12, 2007; 5:33 PM:
Enigma 1467
29/11, 2007; 3:27 PM:
Enigma 1469
29/11, 2007; 2:12 PM:
Enigma 1468
29/11, 2007; 1:09 PM:
Enigma 1465
27/11, 2007; 8:39 PM:
Enigma 1462
27/11, 2007; 8:38 PM:
Enigma 1464
27/11, 2007; 8:35 PM:
Enigma 1463
27/11, 2007; 8:23 PM:
Enigma 1461
27/11, 2007; 8:19 PM:
Enigma 1460
27/11, 2007; 8:14 PM:
Enigma 1459

Archive


Links
COMMENTS

 

Blogged from
A WorkLife FrameWork by
Scientific Arts

All material on this website Copyright © 2008, Stephen Luttrell.