Is there even a formula? 🤔

Billy and Tom are playing the following game: On his first turn Billy writes down the numbers 2, 1 and 2 as shown.

Tom afterwards writes down the sum of every two consecutively positioned numbers in-between them. Therefore the sheet of paper starts to look a bit like this:

In imitation of Tom's actions, Billy writes down the next batch of sums in the same way:

The game finishes when there will be no more numbers 100 written. Help Billy and Tom figure out how many 100's they will have placed since they are too lazy to count them.

Bonus: Try to find a formula for every number n n .


The answer is 40.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Patrick Corn
Apr 20, 2018

Let's just look at the left half of the line. So there's a 2 2 on the left and a 1 1 on the right. Every value written down in between is going to be an integer linear combination of these boundary values. Let's call them α \alpha and β \beta instead of 2 2 and 1 1 for now.

The first value we write down is α + β . \alpha + \beta. The next two are 2 α + β 2\alpha + \beta and α + 2 β . \alpha + 2\beta. The next four are 3 α + β , 3 α + 2 β , 2 α + 3 β , α + 3 β . 3\alpha + \beta, 3\alpha + 2\beta, 2\alpha + 3\beta, \alpha + 3\beta. And so on. If we represent m α + n β m\alpha + n\beta as [ m n ] , \begin{bmatrix} m\\n \end{bmatrix}, then successive steps yield [ 1 1 ] , [ 2 1 ] , [ 1 2 ] , [ 3 1 ] , [ 3 2 ] , [ 2 3 ] , [ 1 3 ] . \begin{bmatrix} 1\\1 \end{bmatrix}, \\ \begin{bmatrix} 2\\1 \end{bmatrix}, \begin{bmatrix} 1\\2 \end{bmatrix}, \\ \begin{bmatrix} 3\\1 \end{bmatrix}, \begin{bmatrix} 3\\2 \end{bmatrix}, \begin{bmatrix} 2\\3 \end{bmatrix}, \begin{bmatrix} 1\\3 \end{bmatrix}. This is exactly how the terms of the Farey sequence are generated. From two adjacent fractions m 1 n 1 , m 2 n 2 , \frac{m_1}{n_1}, \frac{m_2}{n_2}, we generate m 1 + m 2 n 1 + n 2 . \frac{m_1+m_2}{n_1+n_2}. It is well-known that iterating this process will generate every fraction in lowest terms exactly once.

Hence the number of 100 100 s will be the number of ways to write m α + n β = 100 m\alpha + n\beta = 100 where m , n m,n are relatively prime. Let's substitute back now: 2 m + n = 100. 2m+n=100. Now the general answer will follow from a lemma:

Lemma: If N ≥ 3 , N \ge 3, the number of solutions in nonnegative coprime integers m , n m,n to the equation 2 m + n = N 2m+n = N is ϕ ( N ) / 2. \phi(N)/2.

Proof: There must be a fancy way to do this, but I don't see it. Take cases. If N N is odd, then every positive integer m < N / 2 m < N/2 that is coprime to N N will produce one solution. There are ϕ ( N ) / 2 \phi(N)/2 of these. If N N is even, then n = 2 k n=2k and we get m + k = N / 2 m+k=N/2 with m m odd. Then if N / 2 N/2 is odd, then k k is even and we are in the previous case, so there are ϕ ( N / 2 ) / 2 \phi(N/2)/2 solutions, which equals ϕ ( N ) / 2. \phi(N)/2. If N / 2 N/2 is even, then every positive integer m ≤ N m \le N that is coprime to N / 2 N/2 will produce a solution, so the answer is ϕ ( N / 2 ) = ϕ ( N ) / 2. \phi(N/2) = \phi(N)/2.

At any rate, the lemma shows that the number of N N s on the left half of the line is Ï• ( N ) / 2 , \phi(N)/2, so the total number of N N s is twice that, or Ï• ( N ) . \phi(N). For N = 100 N=100 this gives 40 . \fbox{40}.

Mark Hennings
Feb 28, 2018

At each stage, Billy and Tom are creating successive rows in what is called the Steiner Diatomic Array. This paper records a result that the number n n occurs Ï• ( n ) \phi(n) times in the n n th row of the SDA, where Ï• \phi is the Euler totient function. Since every element of the SDA (apart from the 1 1 s in the first row) are obtained by adding two positive integers together, any new number (one that did not appear in the row above) in the ( n + 1 ) (n+1) st or later row will be larger than n n . Thus the last time that n n will be added to the SDA will be in the n n th row.

Thus we want to know the number of times 100 100 occurs in the 100 100 th row, which is Ï• ( 100 ) = 40 \phi(100) = \boxed{40} .

Great solution!

Nikola Yanakiev - 3 years, 3 months ago

Was looking add it... Had no idea it had such a close relation to the Euler totient function... Nice write up!

Geoff Pilling - 3 years, 3 months ago
Giorgos K.
Feb 17, 2018

here is a Mathematica algorithm that finds the nth step

for example if p=6 we get the 6th step (just change the value of p to find the step you want)

p=6;s={2,1,2};z=0;While[z<p-1,t=Tr/@Partition[s,2,1];s=Riffle[s,t];z++];Print@s

{2,11,9,16,7,19,12,17,5,18,13,21,8,19,11,14,3,13,10,17,7,18,11,15,4,13,9,14,5,11,6,7,1,7,6,11,5,14,9,13,4,15,11,18,7,17,10,13,3,14,11,19,8,21,13,18,5,17,12,19,7,16,9,11,2}

to solve this puzzle we use the above algorithm, raising the value of "limit" until we get the right result

limit = 40; s = {2, 1, 2}; While[Count[s, 100] < limit, t = Tr /@ Partition[s, 2, 1]; s = Riffle[s, t]] Count[s, 100]

here is another solution

FixedPoint[Count[Riffle[#,Tr/@Partition[#,2,1]]&,100],{2,1,2}]

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...