Find the minimal initial values

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite












Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The Fibonacci sequence is one example of this type of sequence for F(0) = F(1) = 1, but any two initial values will yield a different sequence. For example F(0) = 3, F(1) = 1 produces these terms.



3, 1, 4, 5, 9, 14, 23, 37, 60, 97, ...


Challenge



The task is to find F(0) and F(1) that minimize F(0) + F(1) given some term of a sequence F(n). Write a function or complete program to complete the task.



Input



Input is a single positive integer, F(n). It may be accepted as a parameter or from standard input. Any reasonable representation is allowed, including direct integer or string representations.



Invalid inputs need not be considered.



Output



The output will be two positive integers, F(0) and F(1). Any reasonable format is acceptable. Here are some examples of reasonable formats.



  • Written on separate lines to standard output

  • Formatted on standard output as a delimited 2-element list

  • Returned as a tuple or 2-element array of integers from a function

Examples



60 -> [3, 1]
37 -> [3, 1]
13 -> [1, 1]
26 -> [2, 2]
4 -> [2, 1]
5 -> [1, 1]
6 -> [2, 2]
7 -> [2, 1]
12 -> [3, 2]
1 -> [1, 1]


Scoring



This is code golf. The score is calculated by bytes of source code.



Sandbox










share|improve this question























  • does 12 -> [4, 0] count?
    – Flame
    2 hours ago










  • F is a sequence of positive integers, and 0 isn't positive, so that's not valid.
    – recursive
    2 hours ago










  • Nitpick: the Fibonacci sequence may be defined by $F[0] = 0, F[1] = 1$ or $F[1] = F[2] = 1$. Many of the sequence's well-known properties rely on this indexing.
    – Dennis♦
    16 mins ago














up vote
6
down vote

favorite












Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The Fibonacci sequence is one example of this type of sequence for F(0) = F(1) = 1, but any two initial values will yield a different sequence. For example F(0) = 3, F(1) = 1 produces these terms.



3, 1, 4, 5, 9, 14, 23, 37, 60, 97, ...


Challenge



The task is to find F(0) and F(1) that minimize F(0) + F(1) given some term of a sequence F(n). Write a function or complete program to complete the task.



Input



Input is a single positive integer, F(n). It may be accepted as a parameter or from standard input. Any reasonable representation is allowed, including direct integer or string representations.



Invalid inputs need not be considered.



Output



The output will be two positive integers, F(0) and F(1). Any reasonable format is acceptable. Here are some examples of reasonable formats.



  • Written on separate lines to standard output

  • Formatted on standard output as a delimited 2-element list

  • Returned as a tuple or 2-element array of integers from a function

Examples



60 -> [3, 1]
37 -> [3, 1]
13 -> [1, 1]
26 -> [2, 2]
4 -> [2, 1]
5 -> [1, 1]
6 -> [2, 2]
7 -> [2, 1]
12 -> [3, 2]
1 -> [1, 1]


Scoring



This is code golf. The score is calculated by bytes of source code.



Sandbox










share|improve this question























  • does 12 -> [4, 0] count?
    – Flame
    2 hours ago










  • F is a sequence of positive integers, and 0 isn't positive, so that's not valid.
    – recursive
    2 hours ago










  • Nitpick: the Fibonacci sequence may be defined by $F[0] = 0, F[1] = 1$ or $F[1] = F[2] = 1$. Many of the sequence's well-known properties rely on this indexing.
    – Dennis♦
    16 mins ago












up vote
6
down vote

favorite









up vote
6
down vote

favorite











Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The Fibonacci sequence is one example of this type of sequence for F(0) = F(1) = 1, but any two initial values will yield a different sequence. For example F(0) = 3, F(1) = 1 produces these terms.



3, 1, 4, 5, 9, 14, 23, 37, 60, 97, ...


Challenge



The task is to find F(0) and F(1) that minimize F(0) + F(1) given some term of a sequence F(n). Write a function or complete program to complete the task.



Input



Input is a single positive integer, F(n). It may be accepted as a parameter or from standard input. Any reasonable representation is allowed, including direct integer or string representations.



Invalid inputs need not be considered.



Output



The output will be two positive integers, F(0) and F(1). Any reasonable format is acceptable. Here are some examples of reasonable formats.



  • Written on separate lines to standard output

  • Formatted on standard output as a delimited 2-element list

  • Returned as a tuple or 2-element array of integers from a function

Examples



60 -> [3, 1]
37 -> [3, 1]
13 -> [1, 1]
26 -> [2, 2]
4 -> [2, 1]
5 -> [1, 1]
6 -> [2, 2]
7 -> [2, 1]
12 -> [3, 2]
1 -> [1, 1]


Scoring



This is code golf. The score is calculated by bytes of source code.



Sandbox










share|improve this question















Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The Fibonacci sequence is one example of this type of sequence for F(0) = F(1) = 1, but any two initial values will yield a different sequence. For example F(0) = 3, F(1) = 1 produces these terms.



3, 1, 4, 5, 9, 14, 23, 37, 60, 97, ...


Challenge



The task is to find F(0) and F(1) that minimize F(0) + F(1) given some term of a sequence F(n). Write a function or complete program to complete the task.



Input



Input is a single positive integer, F(n). It may be accepted as a parameter or from standard input. Any reasonable representation is allowed, including direct integer or string representations.



Invalid inputs need not be considered.



Output



The output will be two positive integers, F(0) and F(1). Any reasonable format is acceptable. Here are some examples of reasonable formats.



  • Written on separate lines to standard output

  • Formatted on standard output as a delimited 2-element list

  • Returned as a tuple or 2-element array of integers from a function

Examples



60 -> [3, 1]
37 -> [3, 1]
13 -> [1, 1]
26 -> [2, 2]
4 -> [2, 1]
5 -> [1, 1]
6 -> [2, 2]
7 -> [2, 1]
12 -> [3, 2]
1 -> [1, 1]


Scoring



This is code golf. The score is calculated by bytes of source code.



Sandbox







code-golf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago

























asked 2 hours ago









recursive

4,8241221




4,8241221











  • does 12 -> [4, 0] count?
    – Flame
    2 hours ago










  • F is a sequence of positive integers, and 0 isn't positive, so that's not valid.
    – recursive
    2 hours ago










  • Nitpick: the Fibonacci sequence may be defined by $F[0] = 0, F[1] = 1$ or $F[1] = F[2] = 1$. Many of the sequence's well-known properties rely on this indexing.
    – Dennis♦
    16 mins ago
















  • does 12 -> [4, 0] count?
    – Flame
    2 hours ago










  • F is a sequence of positive integers, and 0 isn't positive, so that's not valid.
    – recursive
    2 hours ago










  • Nitpick: the Fibonacci sequence may be defined by $F[0] = 0, F[1] = 1$ or $F[1] = F[2] = 1$. Many of the sequence's well-known properties rely on this indexing.
    – Dennis♦
    16 mins ago















does 12 -> [4, 0] count?
– Flame
2 hours ago




does 12 -> [4, 0] count?
– Flame
2 hours ago












F is a sequence of positive integers, and 0 isn't positive, so that's not valid.
– recursive
2 hours ago




F is a sequence of positive integers, and 0 isn't positive, so that's not valid.
– recursive
2 hours ago












Nitpick: the Fibonacci sequence may be defined by $F[0] = 0, F[1] = 1$ or $F[1] = F[2] = 1$. Many of the sequence's well-known properties rely on this indexing.
– Dennis♦
16 mins ago




Nitpick: the Fibonacci sequence may be defined by $F[0] = 0, F[1] = 1$ or $F[1] = F[2] = 1$. Many of the sequence's well-known properties rely on this indexing.
– Dennis♦
16 mins ago










5 Answers
5






active

oldest

votes

















up vote
1
down vote














Japt, 34 bytes




_Ì<U?[ZÌZx]gV:ZÌ
õ ïUõ)ñx æ_gV ¥U


Try it online!



The empty first line is important.



Explanation:



_ Declare a function V:
Ì<U? :ZÌ If the second number is >= n, return it
[ZÌZx]gV Otherwise call V again with the second number and the sum


õ ïUõ) Get all pairs of positive integers where both are less than n
ñx Sort them by their sum
æ_gV ¥U Return the first (lowest sum) one where V returns n





share|improve this answer



























    up vote
    1
    down vote














    Jelly, 13 bytes



    pWạṚ$</¿€SÞḢ


    Try it online!



    How it works



    pWạṚ$</¿€SÞḢ Main link. Argument: n

    W Wrap; yield [n].
    p Cartesian product; promote the left argument n to [1, ..., n] and take
    the product of [1, ..., n] and n, yielding [[1, n], ..., [n, n]].
    € Map the link to the left over the pairs [k, n].
    ¿ While...
    </ reducing the pair by less-than yields 1:
    ạ Cumulatively reduce the pair by absolute difference.
    Ṛ Reverse the result.
    In essence, starting with [a, b] := [k, n], we keep executing
    [a, b] := [b, |a - b|], until the pair is no longer increasing.
    SÞ Sort the resulting pairs by their sums.
    Ḣ Head; extract the first pair.





    share|improve this answer





























      up vote
      0
      down vote













      JavaScript (216 characters)



      function f(r)for(var n=1;;)var f=p(n);for(var u in f)if(s(f[u][0],f[u][1],r))return f[u];n++function p(r)for(var n=,f=1;0<r;)n.push([r,f]),r--,f++;return nfunction s(r,n,f)



      https://jsfiddle.net/twkz2gyb/



      (Ungolfed code):



      // For a given input n, return all combinations of positive integers that sum to n.
      function findPairs(n)
      var arr = ;
      var b = 1;
      while(n > 0)
      arr.push([n, b]);
      n--;
      b++;

      return arr;


      // Run a sequence for a and b, and continue fibonacci'ing until r is found(or quit if past r).
      function sequence(a, b, r)
      if(b === r)
      return true;
      else if(b > r)
      return null;

      var nextFibo = a + b;
      return sequence(b, nextFibo, r);


      // For a given n, find the first 2 numbers of the fibonacci sequence with the smallest sum that result in n.
      function find(n)
      var i = 1;
      while(i < 10)
      var pairs = findPairs(i);
      for(var p in pairs)
      var result = sequence(pairs[p][0], pairs[p][1], n);
      if(result)
      return pairs[p];


      i++;







      share|improve this answer



























        up vote
        0
        down vote














        Haskell, 81 bytes





        f x=head[(a,s-a)|s<-[2..],a<-[1..s-1],let u=s-a:zipWith(+)u(a:u),x`elem`take x u]


        Try it online!






        share|improve this answer



























          up vote
          0
          down vote














          Perl 6, 52 bytes





          ->n(1..n X 1..n).max:(n∈(


          Try it online!



          Brute-force solution.






          share|improve this answer






















            Your Answer





            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "200"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175118%2ffind-the-minimal-initial-values%23new-answer', 'question_page');

            );

            Post as a guest






























            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote














            Japt, 34 bytes




            _Ì<U?[ZÌZx]gV:ZÌ
            õ ïUõ)ñx æ_gV ¥U


            Try it online!



            The empty first line is important.



            Explanation:



            _ Declare a function V:
            Ì<U? :ZÌ If the second number is >= n, return it
            [ZÌZx]gV Otherwise call V again with the second number and the sum


            õ ïUõ) Get all pairs of positive integers where both are less than n
            ñx Sort them by their sum
            æ_gV ¥U Return the first (lowest sum) one where V returns n





            share|improve this answer
























              up vote
              1
              down vote














              Japt, 34 bytes




              _Ì<U?[ZÌZx]gV:ZÌ
              õ ïUõ)ñx æ_gV ¥U


              Try it online!



              The empty first line is important.



              Explanation:



              _ Declare a function V:
              Ì<U? :ZÌ If the second number is >= n, return it
              [ZÌZx]gV Otherwise call V again with the second number and the sum


              õ ïUõ) Get all pairs of positive integers where both are less than n
              ñx Sort them by their sum
              æ_gV ¥U Return the first (lowest sum) one where V returns n





              share|improve this answer






















                up vote
                1
                down vote










                up vote
                1
                down vote










                Japt, 34 bytes




                _Ì<U?[ZÌZx]gV:ZÌ
                õ ïUõ)ñx æ_gV ¥U


                Try it online!



                The empty first line is important.



                Explanation:



                _ Declare a function V:
                Ì<U? :ZÌ If the second number is >= n, return it
                [ZÌZx]gV Otherwise call V again with the second number and the sum


                õ ïUõ) Get all pairs of positive integers where both are less than n
                ñx Sort them by their sum
                æ_gV ¥U Return the first (lowest sum) one where V returns n





                share|improve this answer













                Japt, 34 bytes




                _Ì<U?[ZÌZx]gV:ZÌ
                õ ïUõ)ñx æ_gV ¥U


                Try it online!



                The empty first line is important.



                Explanation:



                _ Declare a function V:
                Ì<U? :ZÌ If the second number is >= n, return it
                [ZÌZx]gV Otherwise call V again with the second number and the sum


                õ ïUõ) Get all pairs of positive integers where both are less than n
                ñx Sort them by their sum
                æ_gV ¥U Return the first (lowest sum) one where V returns n






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 22 mins ago









                Kamil Drakari

                2,421416




                2,421416




















                    up vote
                    1
                    down vote














                    Jelly, 13 bytes



                    pWạṚ$</¿€SÞḢ


                    Try it online!



                    How it works



                    pWạṚ$</¿€SÞḢ Main link. Argument: n

                    W Wrap; yield [n].
                    p Cartesian product; promote the left argument n to [1, ..., n] and take
                    the product of [1, ..., n] and n, yielding [[1, n], ..., [n, n]].
                    € Map the link to the left over the pairs [k, n].
                    ¿ While...
                    </ reducing the pair by less-than yields 1:
                    ạ Cumulatively reduce the pair by absolute difference.
                    Ṛ Reverse the result.
                    In essence, starting with [a, b] := [k, n], we keep executing
                    [a, b] := [b, |a - b|], until the pair is no longer increasing.
                    SÞ Sort the resulting pairs by their sums.
                    Ḣ Head; extract the first pair.





                    share|improve this answer


























                      up vote
                      1
                      down vote














                      Jelly, 13 bytes



                      pWạṚ$</¿€SÞḢ


                      Try it online!



                      How it works



                      pWạṚ$</¿€SÞḢ Main link. Argument: n

                      W Wrap; yield [n].
                      p Cartesian product; promote the left argument n to [1, ..., n] and take
                      the product of [1, ..., n] and n, yielding [[1, n], ..., [n, n]].
                      € Map the link to the left over the pairs [k, n].
                      ¿ While...
                      </ reducing the pair by less-than yields 1:
                      ạ Cumulatively reduce the pair by absolute difference.
                      Ṛ Reverse the result.
                      In essence, starting with [a, b] := [k, n], we keep executing
                      [a, b] := [b, |a - b|], until the pair is no longer increasing.
                      SÞ Sort the resulting pairs by their sums.
                      Ḣ Head; extract the first pair.





                      share|improve this answer
























                        up vote
                        1
                        down vote










                        up vote
                        1
                        down vote










                        Jelly, 13 bytes



                        pWạṚ$</¿€SÞḢ


                        Try it online!



                        How it works



                        pWạṚ$</¿€SÞḢ Main link. Argument: n

                        W Wrap; yield [n].
                        p Cartesian product; promote the left argument n to [1, ..., n] and take
                        the product of [1, ..., n] and n, yielding [[1, n], ..., [n, n]].
                        € Map the link to the left over the pairs [k, n].
                        ¿ While...
                        </ reducing the pair by less-than yields 1:
                        ạ Cumulatively reduce the pair by absolute difference.
                        Ṛ Reverse the result.
                        In essence, starting with [a, b] := [k, n], we keep executing
                        [a, b] := [b, |a - b|], until the pair is no longer increasing.
                        SÞ Sort the resulting pairs by their sums.
                        Ḣ Head; extract the first pair.





                        share|improve this answer















                        Jelly, 13 bytes



                        pWạṚ$</¿€SÞḢ


                        Try it online!



                        How it works



                        pWạṚ$</¿€SÞḢ Main link. Argument: n

                        W Wrap; yield [n].
                        p Cartesian product; promote the left argument n to [1, ..., n] and take
                        the product of [1, ..., n] and n, yielding [[1, n], ..., [n, n]].
                        € Map the link to the left over the pairs [k, n].
                        ¿ While...
                        </ reducing the pair by less-than yields 1:
                        ạ Cumulatively reduce the pair by absolute difference.
                        Ṛ Reverse the result.
                        In essence, starting with [a, b] := [k, n], we keep executing
                        [a, b] := [b, |a - b|], until the pair is no longer increasing.
                        SÞ Sort the resulting pairs by their sums.
                        Ḣ Head; extract the first pair.






                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited 8 mins ago

























                        answered 21 mins ago









                        Dennis♦

                        183k32293726




                        183k32293726




















                            up vote
                            0
                            down vote













                            JavaScript (216 characters)



                            function f(r)for(var n=1;;)var f=p(n);for(var u in f)if(s(f[u][0],f[u][1],r))return f[u];n++function p(r)for(var n=,f=1;0<r;)n.push([r,f]),r--,f++;return nfunction s(r,n,f)



                            https://jsfiddle.net/twkz2gyb/



                            (Ungolfed code):



                            // For a given input n, return all combinations of positive integers that sum to n.
                            function findPairs(n)
                            var arr = ;
                            var b = 1;
                            while(n > 0)
                            arr.push([n, b]);
                            n--;
                            b++;

                            return arr;


                            // Run a sequence for a and b, and continue fibonacci'ing until r is found(or quit if past r).
                            function sequence(a, b, r)
                            if(b === r)
                            return true;
                            else if(b > r)
                            return null;

                            var nextFibo = a + b;
                            return sequence(b, nextFibo, r);


                            // For a given n, find the first 2 numbers of the fibonacci sequence with the smallest sum that result in n.
                            function find(n)
                            var i = 1;
                            while(i < 10)
                            var pairs = findPairs(i);
                            for(var p in pairs)
                            var result = sequence(pairs[p][0], pairs[p][1], n);
                            if(result)
                            return pairs[p];


                            i++;







                            share|improve this answer
























                              up vote
                              0
                              down vote













                              JavaScript (216 characters)



                              function f(r)for(var n=1;;)var f=p(n);for(var u in f)if(s(f[u][0],f[u][1],r))return f[u];n++function p(r)for(var n=,f=1;0<r;)n.push([r,f]),r--,f++;return nfunction s(r,n,f)



                              https://jsfiddle.net/twkz2gyb/



                              (Ungolfed code):



                              // For a given input n, return all combinations of positive integers that sum to n.
                              function findPairs(n)
                              var arr = ;
                              var b = 1;
                              while(n > 0)
                              arr.push([n, b]);
                              n--;
                              b++;

                              return arr;


                              // Run a sequence for a and b, and continue fibonacci'ing until r is found(or quit if past r).
                              function sequence(a, b, r)
                              if(b === r)
                              return true;
                              else if(b > r)
                              return null;

                              var nextFibo = a + b;
                              return sequence(b, nextFibo, r);


                              // For a given n, find the first 2 numbers of the fibonacci sequence with the smallest sum that result in n.
                              function find(n)
                              var i = 1;
                              while(i < 10)
                              var pairs = findPairs(i);
                              for(var p in pairs)
                              var result = sequence(pairs[p][0], pairs[p][1], n);
                              if(result)
                              return pairs[p];


                              i++;







                              share|improve this answer






















                                up vote
                                0
                                down vote










                                up vote
                                0
                                down vote









                                JavaScript (216 characters)



                                function f(r)for(var n=1;;)var f=p(n);for(var u in f)if(s(f[u][0],f[u][1],r))return f[u];n++function p(r)for(var n=,f=1;0<r;)n.push([r,f]),r--,f++;return nfunction s(r,n,f)



                                https://jsfiddle.net/twkz2gyb/



                                (Ungolfed code):



                                // For a given input n, return all combinations of positive integers that sum to n.
                                function findPairs(n)
                                var arr = ;
                                var b = 1;
                                while(n > 0)
                                arr.push([n, b]);
                                n--;
                                b++;

                                return arr;


                                // Run a sequence for a and b, and continue fibonacci'ing until r is found(or quit if past r).
                                function sequence(a, b, r)
                                if(b === r)
                                return true;
                                else if(b > r)
                                return null;

                                var nextFibo = a + b;
                                return sequence(b, nextFibo, r);


                                // For a given n, find the first 2 numbers of the fibonacci sequence with the smallest sum that result in n.
                                function find(n)
                                var i = 1;
                                while(i < 10)
                                var pairs = findPairs(i);
                                for(var p in pairs)
                                var result = sequence(pairs[p][0], pairs[p][1], n);
                                if(result)
                                return pairs[p];


                                i++;







                                share|improve this answer












                                JavaScript (216 characters)



                                function f(r)for(var n=1;;)var f=p(n);for(var u in f)if(s(f[u][0],f[u][1],r))return f[u];n++function p(r)for(var n=,f=1;0<r;)n.push([r,f]),r--,f++;return nfunction s(r,n,f)



                                https://jsfiddle.net/twkz2gyb/



                                (Ungolfed code):



                                // For a given input n, return all combinations of positive integers that sum to n.
                                function findPairs(n)
                                var arr = ;
                                var b = 1;
                                while(n > 0)
                                arr.push([n, b]);
                                n--;
                                b++;

                                return arr;


                                // Run a sequence for a and b, and continue fibonacci'ing until r is found(or quit if past r).
                                function sequence(a, b, r)
                                if(b === r)
                                return true;
                                else if(b > r)
                                return null;

                                var nextFibo = a + b;
                                return sequence(b, nextFibo, r);


                                // For a given n, find the first 2 numbers of the fibonacci sequence with the smallest sum that result in n.
                                function find(n)
                                var i = 1;
                                while(i < 10)
                                var pairs = findPairs(i);
                                for(var p in pairs)
                                var result = sequence(pairs[p][0], pairs[p][1], n);
                                if(result)
                                return pairs[p];


                                i++;








                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered 1 hour ago









                                Flame

                                1312




                                1312




















                                    up vote
                                    0
                                    down vote














                                    Haskell, 81 bytes





                                    f x=head[(a,s-a)|s<-[2..],a<-[1..s-1],let u=s-a:zipWith(+)u(a:u),x`elem`take x u]


                                    Try it online!






                                    share|improve this answer
























                                      up vote
                                      0
                                      down vote














                                      Haskell, 81 bytes





                                      f x=head[(a,s-a)|s<-[2..],a<-[1..s-1],let u=s-a:zipWith(+)u(a:u),x`elem`take x u]


                                      Try it online!






                                      share|improve this answer






















                                        up vote
                                        0
                                        down vote










                                        up vote
                                        0
                                        down vote










                                        Haskell, 81 bytes





                                        f x=head[(a,s-a)|s<-[2..],a<-[1..s-1],let u=s-a:zipWith(+)u(a:u),x`elem`take x u]


                                        Try it online!






                                        share|improve this answer













                                        Haskell, 81 bytes





                                        f x=head[(a,s-a)|s<-[2..],a<-[1..s-1],let u=s-a:zipWith(+)u(a:u),x`elem`take x u]


                                        Try it online!







                                        share|improve this answer












                                        share|improve this answer



                                        share|improve this answer










                                        answered 29 mins ago









                                        Delfad0r

                                        1,153315




                                        1,153315




















                                            up vote
                                            0
                                            down vote














                                            Perl 6, 52 bytes





                                            ->n(1..n X 1..n).max:(n∈(


                                            Try it online!



                                            Brute-force solution.






                                            share|improve this answer


























                                              up vote
                                              0
                                              down vote














                                              Perl 6, 52 bytes





                                              ->n(1..n X 1..n).max:(n∈(


                                              Try it online!



                                              Brute-force solution.






                                              share|improve this answer
























                                                up vote
                                                0
                                                down vote










                                                up vote
                                                0
                                                down vote










                                                Perl 6, 52 bytes





                                                ->n(1..n X 1..n).max:(n∈(


                                                Try it online!



                                                Brute-force solution.






                                                share|improve this answer















                                                Perl 6, 52 bytes





                                                ->n(1..n X 1..n).max:(n∈(


                                                Try it online!



                                                Brute-force solution.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited 2 mins ago

























                                                answered 40 mins ago









                                                nwellnhof

                                                5,188920




                                                5,188920



























                                                     

                                                    draft saved


                                                    draft discarded















































                                                     


                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function ()
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f175118%2ffind-the-minimal-initial-values%23new-answer', 'question_page');

                                                    );

                                                    Post as a guest













































































                                                    Comments

                                                    Popular posts from this blog

                                                    Long meetings (6-7 hours a day): Being “babysat” by supervisor

                                                    Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                                                    Confectionery