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.

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.

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

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

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

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.

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

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.

List the solution in detail.

Enigma 1479

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

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

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.

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}.

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.

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

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.

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.

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.

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

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

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

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

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

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

Enigma 1477

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

Define the names of the people.

Define the landing and departure times.

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.

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

Extract the set of cases that fit the above alternatives.

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

Compute the waiting times for these 2 cases.

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.

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

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

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.

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

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.

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

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.

Define some "enigmatic" message text.

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

Encode the list of character codes starting at time 0.

Convert the encoded list to cipher text.

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

Verify that the cipher text decodes correctly.

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

 0 ANDWHENHELAIDEYESONHERHEGOTTHEFEELINGTHEYHADMETBEFORE 1 HRNGXEYOIFPIWXCJMOWFIVJPPMSSBSTLCVPXETPDHGJDUEAVEFCIJ 2 KWRAGORRIOJMTUETVSMHKVNITMRGZCDFKFJHDZXJGUIDINUCKLQHI 3 TGTJNZOASEJMJKCNLSVLIFSGSMXIHGHDSDQFCZXRUWWMSMSWKFLST 4 IARZQSEPDNNWRSEWUCCQKQLARVFSPNOLSCKEIZXFWGYLWAAULMANO 5 CJTIZPMJWUNHBCIMBNFAOALHXUTCPHITSBIDQIDPGQIZDCIRFGPCD 6 CZXPOFWJTXXAFGNVEGOUMHUBFIDAPOPTYHQJEHDTQOSBXMHBKLARS 7 GICSINANJGIXHIXCNDDSMBTZTKHZVIJTYPYROVDAONQLEYDJJKGCD 8 GPMBIXCNRVBNFGRFCTRRMIHHDUOYVGHZYDYFSXMUNMPVVNVFUVUIJ 9 QSGQMBAXBPYVHIAOWFQFVCJPHEIEVOPZHNYPZHLBMSOMYYIXPQGWX 10 BBPKMDCIFPOFLMQDPZWHUATPOCPMEWXZGRETTRZVSAOXTEPKEFXIJ
 Recent Posts 31/1, 2008; 7:29 PM: Enigma 147925/1, 2008; 7:04 PM: Enigma 147817/1, 2008; 3:43 PM: Enigma 147714/1, 2008; 11:24 AM: Enigma machine11/1, 2008; 3:43 PM: Enigma 14767/1, 2008; 9:11 PM: Enigma 147521/12, 2007; 4:40 PM: Enigma 147414/12, 2007; 1:36 PM: Enigma 14739/12, 2007; 12:40 PM: Enigma 14722/12, 2007; 11:55 AM: Enigma 14711/12, 2007; 5:33 PM: Enigma 146729/11, 2007; 3:27 PM: Enigma 146929/11, 2007; 2:12 PM: Enigma 146829/11, 2007; 1:09 PM: Enigma 146527/11, 2007; 8:39 PM: Enigma 146227/11, 2007; 8:38 PM: Enigma 146427/11, 2007; 8:35 PM: Enigma 146327/11, 2007; 8:23 PM: Enigma 146127/11, 2007; 8:19 PM: Enigma 146027/11, 2007; 8:14 PM: Enigma 1459

Blogged from
A WorkLife FrameWork by