WOO logo

Ask The Wizard #357

Create three fractions using each of the digits from 1 to 9 exactly once, where each fraction has a single digit in the numerator and two digits in the denominator, ensuring the total of these fractions equals one.

As an illustration, the fractions 8/16, 9/27, and 3/24 comply with all requirements except for the fact that their sum adds up to 23/24, rather than 1.

Gialmere

5/34 + 7/68 + 9/12

To find the solution, there are a staggering 60,480 different permutations calculated using permut(9,3)*permut(6,3)*permut(3,3)/fact(3). Honestly, I spent over an hour attempting various combinations and couldn't crack it.

That led me to develop a program designed to go through all fact(9) = 362,880 arrangements of the nine digits, allowing me to check each combination. The challenge was ensuring that I reviewed every possible sequence of the numbers. Here’s a guide on how to achieve this using lexicographic ordering.

  1. Begin by placing all nine digits into an array, organized from the smallest to the largest.
  2. Locate the final element in the array where a succeeding element is greater. If no such element exists, terminate the program.
  3. From the element identified in step 2, find the last element in the array that exceeds its value.
  4. Execute a swap between the two elements identified in steps 2 and 3.
  5. Reverse the order of the elements in the array starting from the position immediately after the one found in step 2 to the end of the array.
  6. Go back to step 2

By consistently applying this method, you will uncover the correct answer six different times, corresponding to all six permutations of the three fractions.

I wrote out the following code to arrange the digits from 1 to 9 according to lexicographic order and examine each arrangement to determine if it fits as a solution.

void three_fraction(void)
{
int i, x_max, y_max, temp_array[100], hold, pt;
int lex_array[] = { 1,2,3,4,5,6,7,8,9 };
int num_elements = sizeof(lex_array) / sizeof(lex_array[0]);
int count = 0;
bool stop = false;
double tot3;
cerr << \"Total elements =\t\" << num_elements << "
\";
do
{
count++;
tot3 = (double)lex_array[0] / (double)(10 * lex_array[1] + lex_array[2]);
tot3 += (double)lex_array[3] / (double)(10 * lex_array[4] + lex_array[5]);
tot3 += (double)lex_array[6] / (double)(10 * lex_array[7] + lex_array[8]);
if (tot3 == 1.0)
{
cerr << count << \"\\t\";
cerr << lex_array[0] << \"/\" << lex_array[1] << lex_array[2] << \" + \";
cerr << lex_array[3] << \"/\" << lex_array[4] << lex_array[5] << \" + \";
cerr << lex_array[6] << \"/\" << lex_array[7] << lex_array[8] << "
\";
}
x_max = -1;
for (i = 0; i < (num_elements - 1); i++)
{
if (lex_array[i] < lex_array[i + 1])
x_max = i;
}
if (x_max >= 0)
{
y_max = 0;
for (i = x_max + 1; i < num_elements; i++)
{
if (lex_array[x_max] < lex_array[i])
y_max = i;
}
hold = lex_array[x_max];
lex_array[x_max] = lex_array[y_max];
lex_array[y_max] = hold;
if (x_max + 1 < num_elements - 1) // reverse
{
for (i = x_max + 1; i < num_elements; i++)
{
temp_array[i] = lex_array[i];
}
pt = 0;
for (i = x_max + 1; i < num_elements; i++)
{
lex_array[i] = temp_array[num_elements - 1 - pt];
pt++;
}
}
}
else
stop = true;
} while (stop == false);
}

This inquiry is a topic of discussion on my forum at Wizard of Vegas .

A man possessed a 10-gallon barrel of wine along with a jug. One day, he poured out a jug-full of wine and then refilled the barrel with water. Later, after the wine and water mixed thoroughly, he drew another jug-full and again refilled the keg with water. Consequently, the barrel ended up with equal amounts of wine and water.

What was the capacity of the jug?

Gialmere

10-5*sqrt(2) = 2.9289 gallons

Let j = volume of jug.

After the initial pouring, the jug had 10-j gallons of wine remaining. Once the water was added, the proportion of wine to the whole barrel became (10-j)/10.

After extracting the diluted wine, there remained 10-j gallons of this mixture in the barrel. The volume of pure wine contained within the diluted solution can be defined as:

(10-j)*((10-j)/10) = 5

(10-j)^2 = 50

j^2 - 20j + 100 = 50

j^2 - 20j + 50 = 0

j = (20 +/- sqrt(400-200))/2

j = (20 +/- 10*sqrt(2))/2

j = 10 +/- 5*sqrt(2)

Given that the jug cannot exceed the barrel’s capacity, we must employ a negative sign:

j = 10 - 5*sqrt(2) = apx. 2.92893218813452 gallons.

This inquiry is a topic of discussion on my forum at Wizard of Vegas .

A six-sided die rolls continuously until the cumulative total reaches 13 or more. What are the mean, median, and mode of this final sum?

Gialmere

Mean = 14.690219
Median = 14
Mode = 13

For this problem, I utilized a Markov Chain. In the table that follows, you can observe the probability associated with each possible end total based on the current sum, starting from the left column. Begin with the clear scenarios for totals from 13 to 18. Subsequently, for current sums of 0 to 12, compute the average from the six cells below.

The initial state probabilities can be identified in the first row where the total sum is 0.

Markov Chain

Sum of Rolls 13 14 15 16 17 18
0 0.279263 0.236996 0.192313 0.145585 0.097371 0.048472
1 0.290830 0.230791 0.188524 0.143842 0.097114 0.048899
2 0.293393 0.241931 0.181893 0.139625 0.094943 0.048215
3 0.289288 0.245178 0.193717 0.133678 0.091410 0.046728
4 0.280369 0.242560 0.198450 0.146988 0.086950 0.044682
5 0.268094 0.235687 0.197878 0.153768 0.102306 0.042267
6 0.253604 0.225827 0.193419 0.155611 0.111500 0.060039
7 0.360232 0.193566 0.165788 0.133380 0.095572 0.051462
8 0.308771 0.308771 0.142104 0.114326 0.081919 0.044110
9 0.264660 0.264660 0.264660 0.097994 0.070216 0.037809
10 0.226852 0.226852 0.226852 0.226852 0.060185 0.032407
11 0.194444 0.194444 0.194444 0.194444 0.194444 0.027778
12 0.166667 0.166667 0.166667 0.166667 0.166667 0.166667
13 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000
14 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000
15 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000
16 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000
17 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000
18 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000

This topic has been brought up and explored in my forum a Wizard of Vegas .