Discovering an Algorithm in 2021.

Algebra Level 5

Let S n S_n be the set of all the numbers of the form ϵ n 3 + ϵ n 1 3 + . . . + ϵ 2 3 + ϵ 1 3 \epsilon_n\sqrt{3+\epsilon_{n-1}\sqrt{3+...+\epsilon_2\sqrt{3+\epsilon_1 \sqrt{3}}}} where the number of radicals is an arbitrary non-negative integer number n n and ϵ k = ± 1 \epsilon_k=\pm 1 for any non-negative integer k k less than or equal to n . n. If you can express the elements of S 12 S_{12} like a finite increasing sequence of numbers { r 0 , r 1 , r 2 , . . . , r m 1 } , \{r_0, r_1, r_2, ..., r_{m-1}\}, where m m is the number of distinct numbers in S 12 , S_{12}, then find 1000 r 2021 , \lfloor -1000r_{2021}\rfloor, otherwise, enter 555.

Note : x \lfloor x \rfloor denotes the floor of the number x . x.


The answer is 835.

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

Let E n E_n represent the set of possible ϵ k \epsilon_k for an integer k k less than equal to n n where the corresponding r m r_m is sorted from lowest to highest (I will abbreviate 1 -1 as - and 1 1 as + + ). For instance, E 2 = { [ , + ] , [ , ] , [ + , ] , [ + , + ] } E_2 = \{[-, +], [-, -], [+, -], [+, +]\} with corresponding set of r m r_m of { 3 + 3 , 3 3 , 3 3 , 3 + 3 } \left\{-\sqrt{3+\sqrt{3}},-\sqrt{3-\sqrt{3}},\sqrt{3-\sqrt{3}},\sqrt{3+\sqrt{3}}\right\} . The i i th element of E n E_n corresponds to ϵ n i + 1 \epsilon_{n - i + 1} (e.g: 1st element equals ϵ n \epsilon_n and last element equals ϵ 1 \epsilon_1 ). I started by listing out S n S_n for various small values of n n using brute-force:

n n E n E_n
1 { [ ] , [ + ] } \{[-], [+]\}
2 { [ , + ] , [ , ] , [ + , ] , [ + , + ] } \{[-, +], [-, -], [+, -], [+, +]\}
3 { [ , + , + ] , [ , + , ] , [ , , ] , [ , , + ] , [ + , , + ] , [ + , , ] , [ + , + , ] , [ + , + , + ] } \{[-, +, +], [-, +, -], [-, -, -], [-, -, +], [+, -, +], [+, -, -], [+, +, -], [+, +, +]\}

Using a Python script, I also computed E 4 E_4 and E 5 E_5 but I figured that the sizes of these sets would be too large to display in this post ( E 4 = 16 |E_4| = 16 and E 5 = 32 |E_5| = 32 ).

After listing these sets, I noticed several repeated patterns. First, look at the last number of each of the sets ( ϵ 1 \epsilon_1 ) with n > 1 n > 1 . For E 2 E_2 , the sequence of ϵ 1 \epsilon_1 values is { + , , , + } \{+, -, -, +\} . For E 3 E_3 , the sequence is { + , , , + , + , , , + } \{+, -, -, +, +, -, -, +\} . In general for n > 1 n > 1 , ϵ 1 \epsilon_1 alternates between groups of two - and groups of two + + beginning with a group of 1 + + . We can model this sequence for the i i th ( i 1 i \geq 1 ) set of E n E_n given n > k n > k with the function f 1 ( i ) = ( 1 ) floor ( mod ( i , 4 ) 2 ) f_{1}\left(i\right)=\left(-1\right)^{\operatorname{floor}\left(\frac{\operatorname{mod}\left(i,4\right)}{2}\right)} (check values yourself to confirm that it works).

Next, we'll look at the sequence of ( ϵ 2 \epsilon_2 ) with n > 2 n > 2 . For E 3 E_3 , the sequence is { + , + , , , , , + , + } \{+, +, -, -, -, -, +, +\} . For E 4 E_4 , the sequence is { + , + , , , , , + , + , + , + , , , , , + , + } \{+, +, -, -, -, -, +, +, +, +, -, -, -, -, +, +\} . In general for n > 2 n > 2 , ϵ 2 \epsilon_2 alternates between groups of four - and groups of four + + beginning with a group of 2 + + . We can model this sequence for the i i th ( i 1 i \geq 1 ) set of E n E_n given n > k n > k with the function f 2 ( i ) = ( 1 ) floor ( mod ( i + 1 , 8 ) 4 ) f_{2}\left(i\right)=\left(-1\right)^{\operatorname{floor}\left(\frac{\operatorname{mod}\left(i+1,8\right)}{4}\right)}

Looking at the sequences for ϵ 3 \epsilon_3 and ϵ 4 \epsilon_4 , it turns out that for n > k n > k , ϵ k \epsilon_k alternates between groups of 2 k 2^k - and groups of 2 k 2^k + + beginning with a group of 2 k 1 2^{k -1} + + . We can generalize this with the function f ( i , k ) = ( 1 ) floor ( mod ( i + 2 k 1 1 , 2 k + 1 ) 2 k ) \displaystyle f\left(i,k\right)=\left(-1\right)^{\displaystyle \operatorname{floor}\left(\frac{\operatorname{mod}\left(i+2^{k-1}-1,2^{k+1}\right)}{2^{k}}\right)} to find the value of ϵ k \epsilon_k for the i i th ( i 1 i \geq 1 ) set of E n E_n given n > k n > k .

Now what about k = n k = n ? Well, let's look at the sequences of ϵ n \epsilon_n for each E n E_n . For E 1 E_1 , the sequence of ϵ 1 \epsilon_1 is { , + } \{-, +\} , for E 2 E_2 , the sequence of ϵ 2 \epsilon_2 is { , , + , + } \{-, -, +, +\} , and for E 3 E_3 , the sequence of ϵ 3 \epsilon_3 is { , , , , + , + , + , + } \{-, -, -, -, +, +, +, +\} . We quickly see that the sequence for ϵ n \epsilon_n starts with 2 n 1 2^{n - 1} groups of - followed by 2 n 1 2^{n - 1} groups of + + . The general formula for ϵ n \epsilon_n for the i i th ( i 1 i \geq 1 ) set of E n E_n is g ( i , n ) = ( 1 ) 1 + floor ( i 1 2 ( n 1 ) ) g\left(i,n\right)=\left(-1\right)^{\displaystyle 1+\operatorname{floor}\left(\frac{i-1}{2^{\left(n-1\right)}}\right)} .

We now have the tools we need to compute r 2021 r_{2021} for n = 12 n = 12 . Firstly, we generate the 2022th index of E 12 E_{12} (since r r starts counting at 0 not 1) using f ( 2022 , k ) f(2022, k) with 1 k < 12 1 \leq k < 12 and g ( 2022 , 12 ) g(2022, 12) . This means that ϵ 1 = f ( 2022 , 1 ) \epsilon_1 = f(2022, 1) , ϵ 2 = f ( 2022 , 2 ) \epsilon_2 = f(2022, 2) , ϵ 3 = f ( 2022 , 3 ) \epsilon_3 = f(2022, 3) , ..., ϵ 12 = g ( 2022 , 12 ) \epsilon_{12} = g(2022, 12) . This list of ϵ k \epsilon_k is [ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ] [-1, -1, -1, 1, -1, 1, 1, 1, 1, 1, -1, -1] . Plugging this into the nested radical expression (I used a Python script for this) gives r 2021 = 0.835422 r_{2021} = -0.835422 . Thus, 1000 r 2021 = 835 \lfloor -1000r_{2021} \rfloor = \boxed{835} .

I imagine that the proof for why this pattern emerges is more complicated than simply identifying the pattern.

Wonderful work, @Alexander McDowell !

Arturo Presa - 5 months ago
Jose Presa
Feb 6, 2021
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.Linq;

namespace RadicalCalculator
{
    public class RadicalValueCalculator
    {
        private static readonly int _epsilonLength = 12;

        public static int[] GenerateEpsilonCombinationFor(int i)
        {
            var stringForm = Convert.ToString(i, 2).PadLeft(12, '0');
            var result = stringForm.Select(b => b == '0' ? -1 : 1).ToArray();
            return result;
        }

        public static IEnumerable<int[]> GenerateAllEpsilonCombinations()
        {
            var setSize = (int)Math.Pow(2, _epsilonLength);

            for (int i = 0; i < setSize; i++)
                yield return GenerateEpsilonCombinationFor(i);
        }

        public static double CalculateRadicalFor(int[] epsilons)
        {
            if (epsilons.Length != _epsilonLength)
                throw new Exception("Wrong size array");

            double result = 0;

            for (int i=0; i < _epsilonLength; i++)
            {
                result = epsilons[i] * Math.Sqrt(3 + result);
            }

            return result;
        }

        public static double FinalCalculation()
        {
            var allEpsilonArrays = GenerateAllEpsilonCombinations().ToList();
            var allRadicalResults = allEpsilonArrays.Select(a => CalculateRadicalFor(a)).OrderBy(v => v).ToArray();
            var result = Math.Floor(allRadicalResults[2021] * -1000);
            return result;
        }
    }

    public class Tests
    {
        [Test]
        public void EndToEndTest()
        {
            Assert.AreEqual(835, RadicalValueCalculator.FinalCalculation());
        }
    }
}

Arturo Presa
Jan 9, 2021

Given an arbitrary positive integer number n n , we can define the following function f n : S n { 0 , 1 , 2 , . . . , 2 n 1 } f_n: S_n\rightarrow \{0, 1, 2, ..., 2^n-1\} by the following rule f n ( a n 3 + a n 1 3 + . . . + a 1 3 ) = ( α n α n 1 . . . α 1 ) 2 , f_n(a_n\sqrt{3+ a_{n-1}\sqrt{3+...+ a_1\sqrt{3}}})= (\overline{\alpha_n \alpha_{n-1} ... \alpha_1})_2, where the expression in the right side of the following equation is a binary number defined on the following way For any integer k k greater than or equal to 1 and less than n n , α k = { 1 , if a n a n 1 . . . a k = 1 0 , if a n a n 1 . . . a k = 1. \alpha_k=\begin{cases} 1, & \text{ if}\; a_n a_{n-1}...a_k=1 \\ 0, & \text{ if}\; a_na_{n-1}...a_k=-1. \end{cases} We can see that f n f_n is well-defined and has an inverse function that can be defined in the following way f n 1 ( α n α n 1 . . . α 1 ) 2 = a n 3 + a n 1 a n 3 + . . . + a 1 a 2 3 , f_n^{-1} (\overline{\alpha_n\alpha_{n-1} ... \alpha_1})_2=a_n\sqrt{3+ \frac{a_{n-1}}{a_n}\sqrt{3+...+ \frac{a_1}{a_2}\sqrt{3}}}, where
a k = { 1 , if α k = 1 1 , if α k = 0. a_k=\begin{cases} 1, & \text{ if}\; \alpha_k=1 \\ -1, & \text{ if}\; \alpha_k=0. \end{cases} Now, we are going to use Mathematical Induction to prove the following equivalence.

a n 3 + a n 1 3 + . . . + a 1 3 < b n 3 + b n 1 3 + . . . + b 1 3 a_n\sqrt{3+ a_{n-1}\sqrt{3+...+ a_1\sqrt{3}}}<b_n\sqrt{3+ b_{n-1}\sqrt{3+...+ b_1\sqrt{3}}} \iff f n ( a n 3 + a n 1 3 + . . . + a 1 3 ) < f n ( b n 3 + b n 1 3 + . . . + b 1 3 ) ( ) f_n(a_n\sqrt{3+ a_{n-1}\sqrt{3+...+ a_1\sqrt{3}}})<f_n(b_n\sqrt{3+ b_{n-1}\sqrt{3+...+ b_1\sqrt{3}}})\;\;\;\;\;\;\;(*) Notice that the symbol "<" represent the regular order of the set of numbers. Of course, this property is obviously true when n = 1. n=1.

Assume that the equivalence is true if n = k , n=k, and we must prove that it is true when n = k + 1. n=k+1. To prove (*) for n = k + 1 n=k+1 let us consider two numbers a k + 1 3 + a k 3 + . . . + a 1 3 a_{k+1}\sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}} and b k + 1 3 + b k 3 + . . . + b 1 3 b_{k+1}\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}} in S k + 1 S_{k+1} . Let us consider also that f k + 1 ( a k + 1 3 + a k 3 + . . . + a 1 3 ) = ( α k + 1 α k . . . α 1 ) 2 f_{k+1}(a_{k+1}\sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}})=(\overline{\alpha_{k+1}\alpha_k ... \alpha_1})_2 and f k + 1 ( b k + 1 3 + b k 3 + . . . + b 1 3 ) = ( β k + 1 β k . . . β 1 ) 2 , f_{k+1}(b_{k+1}\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}} )=(\overline{\beta_{k+1} \beta_k ... \beta_1})_2, where the α k s \alpha_k's and the β k s \beta_k's are defined as we did it above. We are going to divide the proof in the following cases.

Case 1. a k + 1 = 1 a_{k+1}=-1 and b k + 1 = 1. b_{k+1}=1.

The equivalence (*) is true due to the fact that ( a k + 1 = 1 and b k + 1 = 1 ) ( α k + 1 = 0 and β k + 1 = 1 ) (a_{k+1}=-1\; \text{ and} \;b_{k+1}=1) \iff (\alpha_{k+1}=0 \;\text{and}\; \beta_{k+1} =1)

Case 2. a k + 1 = b k + 1 = 1. a_{k+1}=b_{k+1}=1. In this case, it is easy to see that if f k + 1 ( 3 + a k 3 + . . . + a 1 3 ) = ( 1 α k . . . α 1 ) 2 f_{k+1}(\sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}})=(\overline{1 \alpha_k ... \alpha_1})_2 and f k + 1 ( 3 + b k 3 + . . . + b 1 3 ) = ( 1 β k . . . β 1 ) 2 , f_{k+1}(\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}} )=(\overline{1 \beta_k ... \beta_1})_2, then f k ( a k 3 + . . . + a 1 3 ) = ( α k . . . α 1 ) 2 f_k( a_{k}\sqrt{3+...+ a_1\sqrt{3}})=(\overline{ \alpha_k ... \alpha_1})_2 and f k ( b k 3 + . . . + b 1 3 ) = ( β k . . . β 1 ) 2 , f_k( b_{k}\sqrt{3+...+ b_1\sqrt{3}})=(\overline{\beta_k ... \beta_1})_2, and vice-versa.

Then we can prove the equivalence (*) for n = k + 1 n=k+1 in the following way. The condition 3 + a k 3 + . . . + a 1 3 < 3 + b k 3 + . . . + b 1 3 \sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}}<\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}} is equivalent to a k 3 + . . . + a 1 3 < b k 3 + . . . + b 1 3 a_{k}\sqrt{3+...+ a_1\sqrt{3}}< b_{k}\sqrt{3+...+ b_1\sqrt{3}} by the definition of the order on M k + 1 . M^{k+1}. Using the hypothesis of induction the last inequality is equivalent to ( α k . . . α 1 ) 2 < ( β k . . . β 1 ) 2 , (\overline{ \alpha_k ... \alpha_1})_2<(\overline{\beta_k ... \beta_1})_2, and this one is equivalent to f k + 1 ( 3 + a k 3 + . . . + a 1 3 ) < f k + 1 ( 3 + b k 3 + . . . + b 1 3 ) . f_{k+1}(\sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}})<f_{k+1}(\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}}).

Case 3. a k + 1 = b k + 1 = 1. a_{k+1}=b_{k+1}=-1. In this case, it also easy to see that f k + 1 ( 3 + a k 3 + . . . + a 1 3 ) = ( α k , . . . , α 1 ) 2 f_{k+1}(-\sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}})=(\overline{\alpha_k, ..., \alpha_{1}})_2 and f k + 1 ( 3 + b k 3 + . . . + b 1 3 ) = ( β k . . . β 1 ) 2 . f_{k+1}( -\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}})=(\overline{\beta_k ... \beta_{1}})_2. In turn, these two equations are equivalent to f k ( a k 3 + . . . + a 1 3 ) = ( t k . . . , t 1 ) 2 f_{k}( a_{k}\sqrt{3+...+ a_1\sqrt{3}})=(\overline{t_k ..., t_{1}})_2 and f k ( b k 3 + . . . + b 1 3 ) = ( t k , . . . , t 1 ) 2 , f_{k}( b_{k}\sqrt{3+...+ b_1\sqrt{3}})=(\overline{t_k, ..., t_{1}})_2, where t k = { 0 , if α k = 1 1 , if α k = 0. t_k=\begin{cases} 0, & \text{ if}\; \alpha_k=1 \\ 1, & \text{ if}\; \alpha_k=0. \end{cases} and s k = { 0 , if β k = 1 1 , if β k = 0. s_k=\begin{cases} 0, & \text{ if}\; \beta_k=1 \\ 1, & \text{ if}\; \beta_k=0. \end{cases} Now the equivalence (*) can be proved in a simple way for n = k + 1. n=k+1. The condition 3 + a k 3 + . . . + a 1 3 < 3 + b k 3 + . . . + b 1 3 -\sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}}<-\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}} is equivalent to b k 3 + . . . + b 1 3 < a k 3 + . . . + a 1 3 . b_{k}\sqrt{3+...+ b_1\sqrt{3}}< a_{k}\sqrt{3+...+ a_1\sqrt{3}}. The last inequality is equivalent to f k ( b k 3 + . . . + b 1 3 ) < f k ( a k 3 + . . . + a 1 3 ) , f_{k}( b_{k}\sqrt{3+...+ b_1\sqrt{3}})<f_{k}( a_{k}\sqrt{3+...+ a_1\sqrt{3}}), by the hypothesis of induction, and using the definitions of the t k s t_k's and s k s s_k's that we introduced above , this last inequality is equivalent to f k + 1 ( 3 + a k 3 + . . . + a 1 3 ) < f k + 1 ( 3 + b k 3 + . . . + b 1 3 ) . f_{k+1}(-\sqrt{3+ a_{k}\sqrt{3+...+ a_1\sqrt{3}}})<f_{k+1}(-\sqrt{3+ b_{k}\sqrt{3+...+ b_1\sqrt{3}}}).

Then the proof of (*) is complete.

From the property (*), we can obtain that f n f_n is not only bijective, but it also keeps the order. Therefore, in the case that n = 12 , n=12, we have that l k = f 12 1 ( k ) , l_k=f_{12}^{-1}(k), where k k is an integer satisfying 0 k 2 12 1 = 4095. 0\leq k\leq 2^{12}-1=4095. Now using that f 12 1 ( ( α 1 . . . α 11 ) 2 ) = ( a 12 3 + a 11 a 12 3 + . . . + a 1 a 2 3 ) f_{12}^{-1}((\overline{\alpha_1 ... \alpha_{11}})_2)=(a_{12}\sqrt{3+ \frac{a_{11}}{a_{12}}\sqrt{3+...+ \frac{a_1}{a_2}\sqrt{3}}}) as it was defined above, and that the binary representation of 2021 is ( 011111100101 ) 2 , (\overline{011111100101})_2, we obtain that f 12 1 ( 2021 ) = 3 3 + 3 + 3 + 3 + 3 + 3 3 + 3 3 3 3 = 0.8354... f_{12}^{-1}(2021)=-\sqrt {3 -\sqrt {3+\sqrt{3+\sqrt{3+\sqrt{3+\sqrt{3+\sqrt{3-\sqrt{3+\sqrt{3-\sqrt{3-\sqrt{3-\sqrt{ 3}}}}}}}}}}}}=-0.8354... So the answer is 835 . \boxed {835}.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...