Given an input, print all exponents where the base and power sum to the input











up vote
18
down vote

favorite
3












So this is my first challenge on this site.



What this challenge is is that you input a number, and your code spits out numbers which can be calculated as an exponent. The sum of the exponent and base in the number must equal the input.
The numbers must start from $1^{n-1}$ to $(n)^0$.



Example



Given input 5, the program will print:



1  
8
9
4
1


$1^4$ is 1 and $1+4=5$
$2^3$ is 8 and $2+3=5$
$3^2$ is 9 and $3+2=5$
$4^1$ is 4 and $4+1=5$
$5^0$ is 1 and $5+0=5$



Input and Output



Input will be in the form of an integer.
Output will be a list of numbers, delimited by either commas or new lines.



This is code-golf, so shortest code wins.










share|improve this question









New contributor




Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 5




    the comma/newline detail should be omitted, it is normal practice around here to let output of lists be in any convenient format, including as a list/array object being returned by a function
    – Sparr
    Nov 28 at 4:20






  • 3




    Is the input always greater than 0 or do we have to deal with 0 and negatives?
    – Veskah
    Nov 28 at 4:21










  • Inputs will always be positive
    – Embodiment of Ignorance
    Nov 28 at 5:01






  • 6




    Two equally short answers doesn't matter. If you feel like accepting an answer, choose the earliest posted one. However I strongly recommend waiting at least a few days, and would suggest never accepting an answer (to encourage more submissions).
    – Οurous
    Nov 28 at 5:21








  • 1




    Shouldn't the title be "Given an integer, print all the powers obtained with a base and an exponent that sum to the input"?
    – Nicola Sap
    2 days ago















up vote
18
down vote

favorite
3












So this is my first challenge on this site.



What this challenge is is that you input a number, and your code spits out numbers which can be calculated as an exponent. The sum of the exponent and base in the number must equal the input.
The numbers must start from $1^{n-1}$ to $(n)^0$.



Example



Given input 5, the program will print:



1  
8
9
4
1


$1^4$ is 1 and $1+4=5$
$2^3$ is 8 and $2+3=5$
$3^2$ is 9 and $3+2=5$
$4^1$ is 4 and $4+1=5$
$5^0$ is 1 and $5+0=5$



Input and Output



Input will be in the form of an integer.
Output will be a list of numbers, delimited by either commas or new lines.



This is code-golf, so shortest code wins.










share|improve this question









New contributor




Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 5




    the comma/newline detail should be omitted, it is normal practice around here to let output of lists be in any convenient format, including as a list/array object being returned by a function
    – Sparr
    Nov 28 at 4:20






  • 3




    Is the input always greater than 0 or do we have to deal with 0 and negatives?
    – Veskah
    Nov 28 at 4:21










  • Inputs will always be positive
    – Embodiment of Ignorance
    Nov 28 at 5:01






  • 6




    Two equally short answers doesn't matter. If you feel like accepting an answer, choose the earliest posted one. However I strongly recommend waiting at least a few days, and would suggest never accepting an answer (to encourage more submissions).
    – Οurous
    Nov 28 at 5:21








  • 1




    Shouldn't the title be "Given an integer, print all the powers obtained with a base and an exponent that sum to the input"?
    – Nicola Sap
    2 days ago













up vote
18
down vote

favorite
3









up vote
18
down vote

favorite
3






3





So this is my first challenge on this site.



What this challenge is is that you input a number, and your code spits out numbers which can be calculated as an exponent. The sum of the exponent and base in the number must equal the input.
The numbers must start from $1^{n-1}$ to $(n)^0$.



Example



Given input 5, the program will print:



1  
8
9
4
1


$1^4$ is 1 and $1+4=5$
$2^3$ is 8 and $2+3=5$
$3^2$ is 9 and $3+2=5$
$4^1$ is 4 and $4+1=5$
$5^0$ is 1 and $5+0=5$



Input and Output



Input will be in the form of an integer.
Output will be a list of numbers, delimited by either commas or new lines.



This is code-golf, so shortest code wins.










share|improve this question









New contributor




Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











So this is my first challenge on this site.



What this challenge is is that you input a number, and your code spits out numbers which can be calculated as an exponent. The sum of the exponent and base in the number must equal the input.
The numbers must start from $1^{n-1}$ to $(n)^0$.



Example



Given input 5, the program will print:



1  
8
9
4
1


$1^4$ is 1 and $1+4=5$
$2^3$ is 8 and $2+3=5$
$3^2$ is 9 and $3+2=5$
$4^1$ is 4 and $4+1=5$
$5^0$ is 1 and $5+0=5$



Input and Output



Input will be in the form of an integer.
Output will be a list of numbers, delimited by either commas or new lines.



This is code-golf, so shortest code wins.







code-golf math arithmetic






share|improve this question









New contributor




Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









Οurous

5,99311032




5,99311032






New contributor




Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 28 at 4:00









Embodiment of Ignorance

1507




1507




New contributor




Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Embodiment of Ignorance is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 5




    the comma/newline detail should be omitted, it is normal practice around here to let output of lists be in any convenient format, including as a list/array object being returned by a function
    – Sparr
    Nov 28 at 4:20






  • 3




    Is the input always greater than 0 or do we have to deal with 0 and negatives?
    – Veskah
    Nov 28 at 4:21










  • Inputs will always be positive
    – Embodiment of Ignorance
    Nov 28 at 5:01






  • 6




    Two equally short answers doesn't matter. If you feel like accepting an answer, choose the earliest posted one. However I strongly recommend waiting at least a few days, and would suggest never accepting an answer (to encourage more submissions).
    – Οurous
    Nov 28 at 5:21








  • 1




    Shouldn't the title be "Given an integer, print all the powers obtained with a base and an exponent that sum to the input"?
    – Nicola Sap
    2 days ago














  • 5




    the comma/newline detail should be omitted, it is normal practice around here to let output of lists be in any convenient format, including as a list/array object being returned by a function
    – Sparr
    Nov 28 at 4:20






  • 3




    Is the input always greater than 0 or do we have to deal with 0 and negatives?
    – Veskah
    Nov 28 at 4:21










  • Inputs will always be positive
    – Embodiment of Ignorance
    Nov 28 at 5:01






  • 6




    Two equally short answers doesn't matter. If you feel like accepting an answer, choose the earliest posted one. However I strongly recommend waiting at least a few days, and would suggest never accepting an answer (to encourage more submissions).
    – Οurous
    Nov 28 at 5:21








  • 1




    Shouldn't the title be "Given an integer, print all the powers obtained with a base and an exponent that sum to the input"?
    – Nicola Sap
    2 days ago








5




5




the comma/newline detail should be omitted, it is normal practice around here to let output of lists be in any convenient format, including as a list/array object being returned by a function
– Sparr
Nov 28 at 4:20




the comma/newline detail should be omitted, it is normal practice around here to let output of lists be in any convenient format, including as a list/array object being returned by a function
– Sparr
Nov 28 at 4:20




3




3




Is the input always greater than 0 or do we have to deal with 0 and negatives?
– Veskah
Nov 28 at 4:21




Is the input always greater than 0 or do we have to deal with 0 and negatives?
– Veskah
Nov 28 at 4:21












Inputs will always be positive
– Embodiment of Ignorance
Nov 28 at 5:01




Inputs will always be positive
– Embodiment of Ignorance
Nov 28 at 5:01




6




6




Two equally short answers doesn't matter. If you feel like accepting an answer, choose the earliest posted one. However I strongly recommend waiting at least a few days, and would suggest never accepting an answer (to encourage more submissions).
– Οurous
Nov 28 at 5:21






Two equally short answers doesn't matter. If you feel like accepting an answer, choose the earliest posted one. However I strongly recommend waiting at least a few days, and would suggest never accepting an answer (to encourage more submissions).
– Οurous
Nov 28 at 5:21






1




1




Shouldn't the title be "Given an integer, print all the powers obtained with a base and an exponent that sum to the input"?
– Nicola Sap
2 days ago




Shouldn't the title be "Given an integer, print all the powers obtained with a base and an exponent that sum to the input"?
– Nicola Sap
2 days ago










34 Answers
34






active

oldest

votes













1 2
next











up vote
5
down vote














APL (Dyalog Unicode), 8 5 bytes





⍳*⊢-⍳


Try it online!



Anonymous prefix tacit function. TIO tests for the range [1..10].



Thanks @lirtosiast for 3 bytes.



How:



⍳*⊢-⍳ ⍝ Tacit function
⍳ ⍝ Range. ⍳n generates the vector [1..n].
⊢- ⍝ Subtracted from the argument. The vector is now [n-1,n-2,...,0]
⍳* ⍝ Exponentiate using the range [1..n] as base. The result is the vector
⍝ [1^(n-1), 2^(n-2), 3^(n-3),...]





share|improve this answer



















  • 2




    ⍳*⊢-⍳ is 5 bytes, using ⎕IO←1.
    – lirtosiast
    2 days ago










  • @lirtosiast took me a while to figure out why does that work, but I got it. Thanks.
    – J. Sallé
    yesterday


















up vote
4
down vote













Japt, 5 bytes



õ_p´U


Try it



õ         :Range [1,input]
_ :Map
p : Raise to the power of
´U : Input decremented





share|improve this answer






























    up vote
    4
    down vote














    Perl 6, 19 bytes





    {^$_+1 Z**[R,] ^$_}


    Try it online!



    Anonymous code block that takes a number and returns a list. Zip exponents the range 1 to input and the range input-1 to 0






    share|improve this answer






























      up vote
      4
      down vote














      Aheui (esotope), 193 164 bytes (56 chars)



      방빠싹받분샥퍼붇바파쟈뿌차샦히망맣여
      타빠바푸투반또분뽀뿌서썪삯타삯받반타
      석차샦져쌲볼어타토싻삭빠쏛ㅇ또섞썪뻐


      Try it online!



      Try it on AVIS(Korean); just copy and paste code above, press start button, input a number, see how it moves. To see output, press the >_ icon on left side.





      It's not golfed much, but I give it a shot.






      share|improve this answer























      • Is it possible to chose a character set, so that each character is stored in 2 bytes?
        – tsh
        2 days ago










      • @tsh According to Aheui specification, an Aheui code consists of only UTF-8 characters.
        – cobaltp
        2 days ago


















      up vote
      3
      down vote














      Jelly, 5 bytes



      R*ḶU$


      Try it online!



      R                [1,...,n]
      * to the power of
      ḶU$ [0,...,n-1] reversed





      share|improve this answer






























        up vote
        3
        down vote














        Pyth, 5 bytes



        _m^-Q


        Try it online!



        Optimally encoded this would be 4.106 bytes.



        _                reverse of the following list:
        m map the following lambda d:
        ^ (N-d)**d
        -Qd
        d
        Q over [0,...,N-1]





        share|improve this answer






























          up vote
          3
          down vote













          Haskell, 23 bytes



          f i=[x^(i-x)|x<-[1..i]]


          Try it online!



          Alternative version, also 23 bytes:



          f i=(^)<*>(i-)<$>[1..i]





          share|improve this answer




























            up vote
            3
            down vote














            J, 10 bytes



            (>:^|.)@i.


            Try it online!



            If we really need to separate the numbers by a newline:




            J, 13 bytes



            ,.@(>:^|.)@i.


            Try it online!






            share|improve this answer






























              up vote
              3
              down vote













              PHP, 32 bytes



              while($argn)echo++$i**--$argn,_;


              Run as pipe with -nR or try it online.






              share|improve this answer




























                up vote
                3
                down vote














                Octave, 18 bytes





                @(n)(t=1:n).^(n-t)


                Try it online!



                Thanks Luis Mendo, using internal variable saves 3 bytes.






                share|improve this answer






























                  up vote
                  2
                  down vote














                  Wolfram Language (Mathematica), 24 20 18 bytes



                  (x=Range@#)^(#-x)&


                  Try it online!



                  -4 thanks @lirtosiast.






                  share|improve this answer






























                    up vote
                    2
                    down vote














                    MathGolf, 6 bytes



                    rx╒m#


                    Try it online!






                    share|improve this answer





















                    • I have implemented reverse subtraction, multiplication and division, but it looks like a reverse power operator could come in handy?
                      – maxb
                      2 days ago


















                    up vote
                    2
                    down vote














                    Python 2, 40 bytes





                    lambda n:[i**(n-i)for i in range(1,n+1)]   #Outputs a list


                    Try it online!




                    Python 2, 41 bytes





                    n,i=input(),0
                    exec"print(n-i)**i;i+=1;"*n #Prints in reversed order


                    Try it online!






                    share|improve this answer




























                      up vote
                      2
                      down vote














                      Ruby, 27 bytes





                      ->n{(1..n).map{|r|r**n-=1}}


                      Try it online!






                      share|improve this answer




























                        up vote
                        2
                        down vote














                        Retina, 35 bytes



                        .+
                        *
                        _
                        $$.($.'*$($.>`$*)_¶
                        %~`^
                        .+¶


                        Try it online! Explanation:



                        .+
                        *


                        Convert the input to unary.



                        _


                        Match each position. This then sets several replacement variables. $` becomes the left of the match; $>` modifies this to be the left and match; $.>` modifies this to take the length, i.e. the current index. $' meanwhile is the right of the match, so $.' is the length i.e. the current exponent.



                        $$.($.'*$($.>`$*)_¶


                        Create a string $.( plus $.' repetitions of $.>`* plus _. For an example, for an index of 2 in an original input of 5, $.' is 3 and $.>` is 2 so the resulting string is $.(2*2*2*_. This conveniently is a Retina replacement expression that caluclates 2³. Each string is output on its own line.



                        %~`^
                        .+¶


                        For each line generated by the previous stage, prefix a line .+ to it, turning it into a replacement stage, and evaluate that stage, thereby calculating the expression.






                        share|improve this answer




























                          up vote
                          2
                          down vote













                          QBasic, 3533 bytes



                          Thank you @Neil for 2 bytes!



                          INPUT a
                          FOR b=1TO a
                          ?b^(a-b)
                          NEXT


                          Slightly expanded version on REPL.IT because the interpreter in't entirely up-to-spec.



                          Output



                          QBasic (qb.js)
                          Copyright (c) 2010 Steve Hanov

                          5
                          1
                          8
                          9
                          4
                          1





                          share|improve this answer























                          • Save 2 bytes by outputting the list in the correct order! (b^(a-b) for b=1..a)
                            – Neil
                            2 days ago










                          • @Neil Thanks, I've worked it in!
                            – steenbergh
                            2 days ago


















                          up vote
                          2
                          down vote














                          F# (.NET Core), 42 bytes





                          let f x=Seq.map(fun y->pown y (x-y))[1..x]


                          Try it online!






                          share|improve this answer




























                            up vote
                            2
                            down vote














                            JavaScript (Node.js), 33 32 bytes





                            n=>(g=i=>--n?++i**n+[,g(i)]:1)``


                            Try it online!



                            -3 bytes with credits to @Shaggy, and -1 byte by @l4m2!




                            JavaScript (Node.js), 36 bytes





                            f=(n,i=1)=>n--?[i++**n,...f(n,i)]:


                            Try it online!




                            JavaScript (Node.js), 37 bytes





                            n=>[...Array(n)].map(x=>++i**--n,i=0)


                            Try it online!






                            share|improve this answer























                            • 33 bytes
                              – Shaggy
                              2 days ago










                            • 32
                              – l4m2
                              2 days ago


















                            up vote
                            2
                            down vote














                            C# (Visual C# Interactive Compiler), 46 bytes





                            x=>new int[x].Select((_,i)=>Math.Pow(i+1,--x))


                            Try it online!






                            share|improve this answer




























                              up vote
                              2
                              down vote














                              MATL, 5 bytes



                              :Gy-^


                              Try it online!



                              Explanation



                              Consider input 5 as an example.



                              :     % Implicit input. Range
                              % STACK: [1 2 3 4 5]
                              G % Push input again
                              % STACK: [1 2 3 4 5], 5
                              y % Duplicate from below
                              % STACK: [1 2 3 4 5], 5, [1 2 3 4 5]
                              - % Subtract, element-wise
                              % STACK: [1 2 3 4 5], [4 3 2 1 0]
                              ^ % Power, element-wise. Implicit display
                              % STACK: [1 8 9 4 1]





                              share|improve this answer




























                                up vote
                                2
                                down vote













                                Java, 59 Bytes



                                for(int i=1;a+1>i;i++)System.out.println(Math.pow(i,a-i));





                                share|improve this answer























                                • Welcome to PPCG. It looks like this requires "input" be assigned to the predefined variable a, which we don't allow.
                                  – Shaggy
                                  yesterday












                                • Hello, here's a fix for you: n->{for(int i=0;i++<n;)System.out.println(Math.pow(i,n-i));} 60 bytes (code and test cases in the link)
                                  – Olivier Grégoire
                                  21 hours ago




















                                up vote
                                2
                                down vote














                                Jelly, 4 bytes



                                *ạ¥€


                                Try it online!






                                share|improve this answer




























                                  up vote
                                  1
                                  down vote














                                  Clean, 37 bytes



                                  import StdEnv
                                  $n=[i^(n-i)\i<-[1..n]]


                                  Try it online!



                                  Defines $ :: Int -> [Int] taking an integer and returning the list of results.



                                  $ n                // function $ of n
                                  = [i ^ (n-i) // i to the power of n minus i
                                  \ i <- [1..n] // for each i in 1 to n
                                  ]





                                  share|improve this answer






























                                    up vote
                                    1
                                    down vote














                                    R, 34 bytes





                                    x=1:scan();cat(x^rev(x-1),sep=',')


                                    Try it online!






                                    share|improve this answer





















                                    • Is the default "sep" not a space? Would that not work?
                                      – stuart stevenson
                                      yesterday








                                    • 1




                                      @stuartstevenson "Output will be a list of numbers, delimited by either commas or new lines."
                                      – Giuseppe
                                      yesterday


















                                    up vote
                                    1
                                    down vote














                                    05AB1E, 5 bytes



                                    LD<Rm


                                    Port of @lirtosiast's Jelly answer.



                                    Try it online.



                                    Explanation:





                                    L      # List in the range [1, (implicit) input integer]
                                    # i.e. 5 → [1,2,3,4,5]
                                    D< # Duplicate this list, and subtract 1 to make the range [0, input)
                                    # i.e. [1,2,3,4,5] → [0,1,2,3,4]
                                    R # Reverse it to make the range (input, 0]
                                    # i.e. [0,1,2,3,4] → [4,3,2,1,0]
                                    m # Take the power of the numbers in the lists (at the same indices)
                                    # (and output implicitly)
                                    # i.e. [1,2,3,4,5] and [4,3,2,1,0] → [1,8,9,4,1]





                                    share|improve this answer




























                                      up vote
                                      1
                                      down vote














                                      Lua, 43 41 bytes



                                      -2 bytes thanks to @Shaggy





                                      s=io.read()for i=1,s do print(i^(s-i))end


                                      Try it online!






                                      share|improve this answer



















                                      • 1




                                        I don't think you need the +0; seems to work without it.
                                        – Shaggy
                                        2 days ago


















                                      up vote
                                      1
                                      down vote













                                      R, 22 bytes



                                      n=scan();(1:n)^(n:1-1)


                                      Fairly self-explanatory; note that the : operator is higher precendence than the - operator so that n:1-1 is shorter than (n-1):0



                                      If we are allowed to start at 0, then we can lose two bytes by using (0:n)^(n:0) avoiding the need for a -1.






                                      share|improve this answer




























                                        up vote
                                        1
                                        down vote














                                        Charcoal, 9 bytes



                                        I⮌ENX⁻θιι


                                        Try it online! Link is to verbose version of code. Explanation:



                                           N        Input as a number
                                        E Map over implicit range
                                        ι Current value
                                        ⁻ Subtracted from
                                        θ First input
                                        X Raised to power
                                        ι Current value
                                        ⮌ Reverse list
                                        I Cast to string
                                        Implicitly print on separate lines





                                        share|improve this answer




























                                          up vote
                                          1
                                          down vote














                                          C# (Visual C# Interactive Compiler), 55 bytes





                                          v=>Enumerable.Range(0,v--).Select(i=>Math.Pow(i+1,v--))


                                          Try it online!






                                          share|improve this answer




























                                            up vote
                                            1
                                            down vote














                                            Perl 5 -n, 21 bytes





                                            say++$**--$_ while$_


                                            Try it online!






                                            share|improve this answer

























                                              1 2
                                              next



                                              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
                                              });


                                              }
                                              });






                                              Embodiment of Ignorance is a new contributor. Be nice, and check out our Code of Conduct.










                                              draft saved

                                              draft discarded


















                                              StackExchange.ready(
                                              function () {
                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f176666%2fgiven-an-input-print-all-exponents-where-the-base-and-power-sum-to-the-input%23new-answer', 'question_page');
                                              }
                                              );

                                              Post as a guest















                                              Required, but never shown

























                                              34 Answers
                                              34






                                              active

                                              oldest

                                              votes








                                              34 Answers
                                              34






                                              active

                                              oldest

                                              votes









                                              active

                                              oldest

                                              votes






                                              active

                                              oldest

                                              votes








                                              1 2
                                              next









                                              up vote
                                              5
                                              down vote














                                              APL (Dyalog Unicode), 8 5 bytes





                                              ⍳*⊢-⍳


                                              Try it online!



                                              Anonymous prefix tacit function. TIO tests for the range [1..10].



                                              Thanks @lirtosiast for 3 bytes.



                                              How:



                                              ⍳*⊢-⍳ ⍝ Tacit function
                                              ⍳ ⍝ Range. ⍳n generates the vector [1..n].
                                              ⊢- ⍝ Subtracted from the argument. The vector is now [n-1,n-2,...,0]
                                              ⍳* ⍝ Exponentiate using the range [1..n] as base. The result is the vector
                                              ⍝ [1^(n-1), 2^(n-2), 3^(n-3),...]





                                              share|improve this answer



















                                              • 2




                                                ⍳*⊢-⍳ is 5 bytes, using ⎕IO←1.
                                                – lirtosiast
                                                2 days ago










                                              • @lirtosiast took me a while to figure out why does that work, but I got it. Thanks.
                                                – J. Sallé
                                                yesterday















                                              up vote
                                              5
                                              down vote














                                              APL (Dyalog Unicode), 8 5 bytes





                                              ⍳*⊢-⍳


                                              Try it online!



                                              Anonymous prefix tacit function. TIO tests for the range [1..10].



                                              Thanks @lirtosiast for 3 bytes.



                                              How:



                                              ⍳*⊢-⍳ ⍝ Tacit function
                                              ⍳ ⍝ Range. ⍳n generates the vector [1..n].
                                              ⊢- ⍝ Subtracted from the argument. The vector is now [n-1,n-2,...,0]
                                              ⍳* ⍝ Exponentiate using the range [1..n] as base. The result is the vector
                                              ⍝ [1^(n-1), 2^(n-2), 3^(n-3),...]





                                              share|improve this answer



















                                              • 2




                                                ⍳*⊢-⍳ is 5 bytes, using ⎕IO←1.
                                                – lirtosiast
                                                2 days ago










                                              • @lirtosiast took me a while to figure out why does that work, but I got it. Thanks.
                                                – J. Sallé
                                                yesterday













                                              up vote
                                              5
                                              down vote










                                              up vote
                                              5
                                              down vote










                                              APL (Dyalog Unicode), 8 5 bytes





                                              ⍳*⊢-⍳


                                              Try it online!



                                              Anonymous prefix tacit function. TIO tests for the range [1..10].



                                              Thanks @lirtosiast for 3 bytes.



                                              How:



                                              ⍳*⊢-⍳ ⍝ Tacit function
                                              ⍳ ⍝ Range. ⍳n generates the vector [1..n].
                                              ⊢- ⍝ Subtracted from the argument. The vector is now [n-1,n-2,...,0]
                                              ⍳* ⍝ Exponentiate using the range [1..n] as base. The result is the vector
                                              ⍝ [1^(n-1), 2^(n-2), 3^(n-3),...]





                                              share|improve this answer















                                              APL (Dyalog Unicode), 8 5 bytes





                                              ⍳*⊢-⍳


                                              Try it online!



                                              Anonymous prefix tacit function. TIO tests for the range [1..10].



                                              Thanks @lirtosiast for 3 bytes.



                                              How:



                                              ⍳*⊢-⍳ ⍝ Tacit function
                                              ⍳ ⍝ Range. ⍳n generates the vector [1..n].
                                              ⊢- ⍝ Subtracted from the argument. The vector is now [n-1,n-2,...,0]
                                              ⍳* ⍝ Exponentiate using the range [1..n] as base. The result is the vector
                                              ⍝ [1^(n-1), 2^(n-2), 3^(n-3),...]






                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited yesterday

























                                              answered 2 days ago









                                              J. Sallé

                                              1,853322




                                              1,853322








                                              • 2




                                                ⍳*⊢-⍳ is 5 bytes, using ⎕IO←1.
                                                – lirtosiast
                                                2 days ago










                                              • @lirtosiast took me a while to figure out why does that work, but I got it. Thanks.
                                                – J. Sallé
                                                yesterday














                                              • 2




                                                ⍳*⊢-⍳ is 5 bytes, using ⎕IO←1.
                                                – lirtosiast
                                                2 days ago










                                              • @lirtosiast took me a while to figure out why does that work, but I got it. Thanks.
                                                – J. Sallé
                                                yesterday








                                              2




                                              2




                                              ⍳*⊢-⍳ is 5 bytes, using ⎕IO←1.
                                              – lirtosiast
                                              2 days ago




                                              ⍳*⊢-⍳ is 5 bytes, using ⎕IO←1.
                                              – lirtosiast
                                              2 days ago












                                              @lirtosiast took me a while to figure out why does that work, but I got it. Thanks.
                                              – J. Sallé
                                              yesterday




                                              @lirtosiast took me a while to figure out why does that work, but I got it. Thanks.
                                              – J. Sallé
                                              yesterday










                                              up vote
                                              4
                                              down vote













                                              Japt, 5 bytes



                                              õ_p´U


                                              Try it



                                              õ         :Range [1,input]
                                              _ :Map
                                              p : Raise to the power of
                                              ´U : Input decremented





                                              share|improve this answer



























                                                up vote
                                                4
                                                down vote













                                                Japt, 5 bytes



                                                õ_p´U


                                                Try it



                                                õ         :Range [1,input]
                                                _ :Map
                                                p : Raise to the power of
                                                ´U : Input decremented





                                                share|improve this answer

























                                                  up vote
                                                  4
                                                  down vote










                                                  up vote
                                                  4
                                                  down vote









                                                  Japt, 5 bytes



                                                  õ_p´U


                                                  Try it



                                                  õ         :Range [1,input]
                                                  _ :Map
                                                  p : Raise to the power of
                                                  ´U : Input decremented





                                                  share|improve this answer














                                                  Japt, 5 bytes



                                                  õ_p´U


                                                  Try it



                                                  õ         :Range [1,input]
                                                  _ :Map
                                                  p : Raise to the power of
                                                  ´U : Input decremented






                                                  share|improve this answer














                                                  share|improve this answer



                                                  share|improve this answer








                                                  edited 2 days ago

























                                                  answered 2 days ago









                                                  Shaggy

                                                  18.4k21663




                                                  18.4k21663






















                                                      up vote
                                                      4
                                                      down vote














                                                      Perl 6, 19 bytes





                                                      {^$_+1 Z**[R,] ^$_}


                                                      Try it online!



                                                      Anonymous code block that takes a number and returns a list. Zip exponents the range 1 to input and the range input-1 to 0






                                                      share|improve this answer



























                                                        up vote
                                                        4
                                                        down vote














                                                        Perl 6, 19 bytes





                                                        {^$_+1 Z**[R,] ^$_}


                                                        Try it online!



                                                        Anonymous code block that takes a number and returns a list. Zip exponents the range 1 to input and the range input-1 to 0






                                                        share|improve this answer

























                                                          up vote
                                                          4
                                                          down vote










                                                          up vote
                                                          4
                                                          down vote










                                                          Perl 6, 19 bytes





                                                          {^$_+1 Z**[R,] ^$_}


                                                          Try it online!



                                                          Anonymous code block that takes a number and returns a list. Zip exponents the range 1 to input and the range input-1 to 0






                                                          share|improve this answer















                                                          Perl 6, 19 bytes





                                                          {^$_+1 Z**[R,] ^$_}


                                                          Try it online!



                                                          Anonymous code block that takes a number and returns a list. Zip exponents the range 1 to input and the range input-1 to 0







                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited 2 days ago

























                                                          answered Nov 28 at 4:34









                                                          Jo King

                                                          19.8k245105




                                                          19.8k245105






















                                                              up vote
                                                              4
                                                              down vote














                                                              Aheui (esotope), 193 164 bytes (56 chars)



                                                              방빠싹받분샥퍼붇바파쟈뿌차샦히망맣여
                                                              타빠바푸투반또분뽀뿌서썪삯타삯받반타
                                                              석차샦져쌲볼어타토싻삭빠쏛ㅇ또섞썪뻐


                                                              Try it online!



                                                              Try it on AVIS(Korean); just copy and paste code above, press start button, input a number, see how it moves. To see output, press the >_ icon on left side.





                                                              It's not golfed much, but I give it a shot.






                                                              share|improve this answer























                                                              • Is it possible to chose a character set, so that each character is stored in 2 bytes?
                                                                – tsh
                                                                2 days ago










                                                              • @tsh According to Aheui specification, an Aheui code consists of only UTF-8 characters.
                                                                – cobaltp
                                                                2 days ago















                                                              up vote
                                                              4
                                                              down vote














                                                              Aheui (esotope), 193 164 bytes (56 chars)



                                                              방빠싹받분샥퍼붇바파쟈뿌차샦히망맣여
                                                              타빠바푸투반또분뽀뿌서썪삯타삯받반타
                                                              석차샦져쌲볼어타토싻삭빠쏛ㅇ또섞썪뻐


                                                              Try it online!



                                                              Try it on AVIS(Korean); just copy and paste code above, press start button, input a number, see how it moves. To see output, press the >_ icon on left side.





                                                              It's not golfed much, but I give it a shot.






                                                              share|improve this answer























                                                              • Is it possible to chose a character set, so that each character is stored in 2 bytes?
                                                                – tsh
                                                                2 days ago










                                                              • @tsh According to Aheui specification, an Aheui code consists of only UTF-8 characters.
                                                                – cobaltp
                                                                2 days ago













                                                              up vote
                                                              4
                                                              down vote










                                                              up vote
                                                              4
                                                              down vote










                                                              Aheui (esotope), 193 164 bytes (56 chars)



                                                              방빠싹받분샥퍼붇바파쟈뿌차샦히망맣여
                                                              타빠바푸투반또분뽀뿌서썪삯타삯받반타
                                                              석차샦져쌲볼어타토싻삭빠쏛ㅇ또섞썪뻐


                                                              Try it online!



                                                              Try it on AVIS(Korean); just copy and paste code above, press start button, input a number, see how it moves. To see output, press the >_ icon on left side.





                                                              It's not golfed much, but I give it a shot.






                                                              share|improve this answer















                                                              Aheui (esotope), 193 164 bytes (56 chars)



                                                              방빠싹받분샥퍼붇바파쟈뿌차샦히망맣여
                                                              타빠바푸투반또분뽀뿌서썪삯타삯받반타
                                                              석차샦져쌲볼어타토싻삭빠쏛ㅇ또섞썪뻐


                                                              Try it online!



                                                              Try it on AVIS(Korean); just copy and paste code above, press start button, input a number, see how it moves. To see output, press the >_ icon on left side.





                                                              It's not golfed much, but I give it a shot.







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited 2 days ago

























                                                              answered Nov 28 at 6:50









                                                              cobaltp

                                                              3417




                                                              3417












                                                              • Is it possible to chose a character set, so that each character is stored in 2 bytes?
                                                                – tsh
                                                                2 days ago










                                                              • @tsh According to Aheui specification, an Aheui code consists of only UTF-8 characters.
                                                                – cobaltp
                                                                2 days ago


















                                                              • Is it possible to chose a character set, so that each character is stored in 2 bytes?
                                                                – tsh
                                                                2 days ago










                                                              • @tsh According to Aheui specification, an Aheui code consists of only UTF-8 characters.
                                                                – cobaltp
                                                                2 days ago
















                                                              Is it possible to chose a character set, so that each character is stored in 2 bytes?
                                                              – tsh
                                                              2 days ago




                                                              Is it possible to chose a character set, so that each character is stored in 2 bytes?
                                                              – tsh
                                                              2 days ago












                                                              @tsh According to Aheui specification, an Aheui code consists of only UTF-8 characters.
                                                              – cobaltp
                                                              2 days ago




                                                              @tsh According to Aheui specification, an Aheui code consists of only UTF-8 characters.
                                                              – cobaltp
                                                              2 days ago










                                                              up vote
                                                              3
                                                              down vote














                                                              Jelly, 5 bytes



                                                              R*ḶU$


                                                              Try it online!



                                                              R                [1,...,n]
                                                              * to the power of
                                                              ḶU$ [0,...,n-1] reversed





                                                              share|improve this answer



























                                                                up vote
                                                                3
                                                                down vote














                                                                Jelly, 5 bytes



                                                                R*ḶU$


                                                                Try it online!



                                                                R                [1,...,n]
                                                                * to the power of
                                                                ḶU$ [0,...,n-1] reversed





                                                                share|improve this answer

























                                                                  up vote
                                                                  3
                                                                  down vote










                                                                  up vote
                                                                  3
                                                                  down vote










                                                                  Jelly, 5 bytes



                                                                  R*ḶU$


                                                                  Try it online!



                                                                  R                [1,...,n]
                                                                  * to the power of
                                                                  ḶU$ [0,...,n-1] reversed





                                                                  share|improve this answer















                                                                  Jelly, 5 bytes



                                                                  R*ḶU$


                                                                  Try it online!



                                                                  R                [1,...,n]
                                                                  * to the power of
                                                                  ḶU$ [0,...,n-1] reversed






                                                                  share|improve this answer














                                                                  share|improve this answer



                                                                  share|improve this answer








                                                                  edited Nov 28 at 4:22

























                                                                  answered Nov 28 at 4:16









                                                                  lirtosiast

                                                                  15.6k436105




                                                                  15.6k436105






















                                                                      up vote
                                                                      3
                                                                      down vote














                                                                      Pyth, 5 bytes



                                                                      _m^-Q


                                                                      Try it online!



                                                                      Optimally encoded this would be 4.106 bytes.



                                                                      _                reverse of the following list:
                                                                      m map the following lambda d:
                                                                      ^ (N-d)**d
                                                                      -Qd
                                                                      d
                                                                      Q over [0,...,N-1]





                                                                      share|improve this answer



























                                                                        up vote
                                                                        3
                                                                        down vote














                                                                        Pyth, 5 bytes



                                                                        _m^-Q


                                                                        Try it online!



                                                                        Optimally encoded this would be 4.106 bytes.



                                                                        _                reverse of the following list:
                                                                        m map the following lambda d:
                                                                        ^ (N-d)**d
                                                                        -Qd
                                                                        d
                                                                        Q over [0,...,N-1]





                                                                        share|improve this answer

























                                                                          up vote
                                                                          3
                                                                          down vote










                                                                          up vote
                                                                          3
                                                                          down vote










                                                                          Pyth, 5 bytes



                                                                          _m^-Q


                                                                          Try it online!



                                                                          Optimally encoded this would be 4.106 bytes.



                                                                          _                reverse of the following list:
                                                                          m map the following lambda d:
                                                                          ^ (N-d)**d
                                                                          -Qd
                                                                          d
                                                                          Q over [0,...,N-1]





                                                                          share|improve this answer















                                                                          Pyth, 5 bytes



                                                                          _m^-Q


                                                                          Try it online!



                                                                          Optimally encoded this would be 4.106 bytes.



                                                                          _                reverse of the following list:
                                                                          m map the following lambda d:
                                                                          ^ (N-d)**d
                                                                          -Qd
                                                                          d
                                                                          Q over [0,...,N-1]






                                                                          share|improve this answer














                                                                          share|improve this answer



                                                                          share|improve this answer








                                                                          edited Nov 28 at 4:48

























                                                                          answered Nov 28 at 4:43









                                                                          lirtosiast

                                                                          15.6k436105




                                                                          15.6k436105






















                                                                              up vote
                                                                              3
                                                                              down vote













                                                                              Haskell, 23 bytes



                                                                              f i=[x^(i-x)|x<-[1..i]]


                                                                              Try it online!



                                                                              Alternative version, also 23 bytes:



                                                                              f i=(^)<*>(i-)<$>[1..i]





                                                                              share|improve this answer

























                                                                                up vote
                                                                                3
                                                                                down vote













                                                                                Haskell, 23 bytes



                                                                                f i=[x^(i-x)|x<-[1..i]]


                                                                                Try it online!



                                                                                Alternative version, also 23 bytes:



                                                                                f i=(^)<*>(i-)<$>[1..i]





                                                                                share|improve this answer























                                                                                  up vote
                                                                                  3
                                                                                  down vote










                                                                                  up vote
                                                                                  3
                                                                                  down vote









                                                                                  Haskell, 23 bytes



                                                                                  f i=[x^(i-x)|x<-[1..i]]


                                                                                  Try it online!



                                                                                  Alternative version, also 23 bytes:



                                                                                  f i=(^)<*>(i-)<$>[1..i]





                                                                                  share|improve this answer












                                                                                  Haskell, 23 bytes



                                                                                  f i=[x^(i-x)|x<-[1..i]]


                                                                                  Try it online!



                                                                                  Alternative version, also 23 bytes:



                                                                                  f i=(^)<*>(i-)<$>[1..i]






                                                                                  share|improve this answer












                                                                                  share|improve this answer



                                                                                  share|improve this answer










                                                                                  answered Nov 28 at 5:00









                                                                                  nimi

                                                                                  30.9k31985




                                                                                  30.9k31985






















                                                                                      up vote
                                                                                      3
                                                                                      down vote














                                                                                      J, 10 bytes



                                                                                      (>:^|.)@i.


                                                                                      Try it online!



                                                                                      If we really need to separate the numbers by a newline:




                                                                                      J, 13 bytes



                                                                                      ,.@(>:^|.)@i.


                                                                                      Try it online!






                                                                                      share|improve this answer



























                                                                                        up vote
                                                                                        3
                                                                                        down vote














                                                                                        J, 10 bytes



                                                                                        (>:^|.)@i.


                                                                                        Try it online!



                                                                                        If we really need to separate the numbers by a newline:




                                                                                        J, 13 bytes



                                                                                        ,.@(>:^|.)@i.


                                                                                        Try it online!






                                                                                        share|improve this answer

























                                                                                          up vote
                                                                                          3
                                                                                          down vote










                                                                                          up vote
                                                                                          3
                                                                                          down vote










                                                                                          J, 10 bytes



                                                                                          (>:^|.)@i.


                                                                                          Try it online!



                                                                                          If we really need to separate the numbers by a newline:




                                                                                          J, 13 bytes



                                                                                          ,.@(>:^|.)@i.


                                                                                          Try it online!






                                                                                          share|improve this answer















                                                                                          J, 10 bytes



                                                                                          (>:^|.)@i.


                                                                                          Try it online!



                                                                                          If we really need to separate the numbers by a newline:




                                                                                          J, 13 bytes



                                                                                          ,.@(>:^|.)@i.


                                                                                          Try it online!







                                                                                          share|improve this answer














                                                                                          share|improve this answer



                                                                                          share|improve this answer








                                                                                          edited 2 days ago

























                                                                                          answered 2 days ago









                                                                                          Galen Ivanov

                                                                                          6,00211032




                                                                                          6,00211032






















                                                                                              up vote
                                                                                              3
                                                                                              down vote













                                                                                              PHP, 32 bytes



                                                                                              while($argn)echo++$i**--$argn,_;


                                                                                              Run as pipe with -nR or try it online.






                                                                                              share|improve this answer

























                                                                                                up vote
                                                                                                3
                                                                                                down vote













                                                                                                PHP, 32 bytes



                                                                                                while($argn)echo++$i**--$argn,_;


                                                                                                Run as pipe with -nR or try it online.






                                                                                                share|improve this answer























                                                                                                  up vote
                                                                                                  3
                                                                                                  down vote










                                                                                                  up vote
                                                                                                  3
                                                                                                  down vote









                                                                                                  PHP, 32 bytes



                                                                                                  while($argn)echo++$i**--$argn,_;


                                                                                                  Run as pipe with -nR or try it online.






                                                                                                  share|improve this answer












                                                                                                  PHP, 32 bytes



                                                                                                  while($argn)echo++$i**--$argn,_;


                                                                                                  Run as pipe with -nR or try it online.







                                                                                                  share|improve this answer












                                                                                                  share|improve this answer



                                                                                                  share|improve this answer










                                                                                                  answered 2 days ago









                                                                                                  Titus

                                                                                                  12.9k11237




                                                                                                  12.9k11237






















                                                                                                      up vote
                                                                                                      3
                                                                                                      down vote














                                                                                                      Octave, 18 bytes





                                                                                                      @(n)(t=1:n).^(n-t)


                                                                                                      Try it online!



                                                                                                      Thanks Luis Mendo, using internal variable saves 3 bytes.






                                                                                                      share|improve this answer



























                                                                                                        up vote
                                                                                                        3
                                                                                                        down vote














                                                                                                        Octave, 18 bytes





                                                                                                        @(n)(t=1:n).^(n-t)


                                                                                                        Try it online!



                                                                                                        Thanks Luis Mendo, using internal variable saves 3 bytes.






                                                                                                        share|improve this answer

























                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote










                                                                                                          up vote
                                                                                                          3
                                                                                                          down vote










                                                                                                          Octave, 18 bytes





                                                                                                          @(n)(t=1:n).^(n-t)


                                                                                                          Try it online!



                                                                                                          Thanks Luis Mendo, using internal variable saves 3 bytes.






                                                                                                          share|improve this answer















                                                                                                          Octave, 18 bytes





                                                                                                          @(n)(t=1:n).^(n-t)


                                                                                                          Try it online!



                                                                                                          Thanks Luis Mendo, using internal variable saves 3 bytes.







                                                                                                          share|improve this answer














                                                                                                          share|improve this answer



                                                                                                          share|improve this answer








                                                                                                          edited 2 days ago

























                                                                                                          answered Nov 28 at 5:32









                                                                                                          tsh

                                                                                                          8,08011346




                                                                                                          8,08011346






















                                                                                                              up vote
                                                                                                              2
                                                                                                              down vote














                                                                                                              Wolfram Language (Mathematica), 24 20 18 bytes



                                                                                                              (x=Range@#)^(#-x)&


                                                                                                              Try it online!



                                                                                                              -4 thanks @lirtosiast.






                                                                                                              share|improve this answer



























                                                                                                                up vote
                                                                                                                2
                                                                                                                down vote














                                                                                                                Wolfram Language (Mathematica), 24 20 18 bytes



                                                                                                                (x=Range@#)^(#-x)&


                                                                                                                Try it online!



                                                                                                                -4 thanks @lirtosiast.






                                                                                                                share|improve this answer

























                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote










                                                                                                                  up vote
                                                                                                                  2
                                                                                                                  down vote










                                                                                                                  Wolfram Language (Mathematica), 24 20 18 bytes



                                                                                                                  (x=Range@#)^(#-x)&


                                                                                                                  Try it online!



                                                                                                                  -4 thanks @lirtosiast.






                                                                                                                  share|improve this answer















                                                                                                                  Wolfram Language (Mathematica), 24 20 18 bytes



                                                                                                                  (x=Range@#)^(#-x)&


                                                                                                                  Try it online!



                                                                                                                  -4 thanks @lirtosiast.







                                                                                                                  share|improve this answer














                                                                                                                  share|improve this answer



                                                                                                                  share|improve this answer








                                                                                                                  edited Nov 28 at 4:34

























                                                                                                                  answered Nov 28 at 4:31









                                                                                                                  Shieru Asakoto

                                                                                                                  2,380314




                                                                                                                  2,380314






















                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote














                                                                                                                      MathGolf, 6 bytes



                                                                                                                      rx╒m#


                                                                                                                      Try it online!






                                                                                                                      share|improve this answer





















                                                                                                                      • I have implemented reverse subtraction, multiplication and division, but it looks like a reverse power operator could come in handy?
                                                                                                                        – maxb
                                                                                                                        2 days ago















                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote














                                                                                                                      MathGolf, 6 bytes



                                                                                                                      rx╒m#


                                                                                                                      Try it online!






                                                                                                                      share|improve this answer





















                                                                                                                      • I have implemented reverse subtraction, multiplication and division, but it looks like a reverse power operator could come in handy?
                                                                                                                        – maxb
                                                                                                                        2 days ago













                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote










                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote










                                                                                                                      MathGolf, 6 bytes



                                                                                                                      rx╒m#


                                                                                                                      Try it online!






                                                                                                                      share|improve this answer













                                                                                                                      MathGolf, 6 bytes



                                                                                                                      rx╒m#


                                                                                                                      Try it online!







                                                                                                                      share|improve this answer












                                                                                                                      share|improve this answer



                                                                                                                      share|improve this answer










                                                                                                                      answered Nov 28 at 5:00









                                                                                                                      Jo King

                                                                                                                      19.8k245105




                                                                                                                      19.8k245105












                                                                                                                      • I have implemented reverse subtraction, multiplication and division, but it looks like a reverse power operator could come in handy?
                                                                                                                        – maxb
                                                                                                                        2 days ago


















                                                                                                                      • I have implemented reverse subtraction, multiplication and division, but it looks like a reverse power operator could come in handy?
                                                                                                                        – maxb
                                                                                                                        2 days ago
















                                                                                                                      I have implemented reverse subtraction, multiplication and division, but it looks like a reverse power operator could come in handy?
                                                                                                                      – maxb
                                                                                                                      2 days ago




                                                                                                                      I have implemented reverse subtraction, multiplication and division, but it looks like a reverse power operator could come in handy?
                                                                                                                      – maxb
                                                                                                                      2 days ago










                                                                                                                      up vote
                                                                                                                      2
                                                                                                                      down vote














                                                                                                                      Python 2, 40 bytes





                                                                                                                      lambda n:[i**(n-i)for i in range(1,n+1)]   #Outputs a list


                                                                                                                      Try it online!




                                                                                                                      Python 2, 41 bytes





                                                                                                                      n,i=input(),0
                                                                                                                      exec"print(n-i)**i;i+=1;"*n #Prints in reversed order


                                                                                                                      Try it online!






                                                                                                                      share|improve this answer

























                                                                                                                        up vote
                                                                                                                        2
                                                                                                                        down vote














                                                                                                                        Python 2, 40 bytes





                                                                                                                        lambda n:[i**(n-i)for i in range(1,n+1)]   #Outputs a list


                                                                                                                        Try it online!




                                                                                                                        Python 2, 41 bytes





                                                                                                                        n,i=input(),0
                                                                                                                        exec"print(n-i)**i;i+=1;"*n #Prints in reversed order


                                                                                                                        Try it online!






                                                                                                                        share|improve this answer























                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote










                                                                                                                          up vote
                                                                                                                          2
                                                                                                                          down vote










                                                                                                                          Python 2, 40 bytes





                                                                                                                          lambda n:[i**(n-i)for i in range(1,n+1)]   #Outputs a list


                                                                                                                          Try it online!




                                                                                                                          Python 2, 41 bytes





                                                                                                                          n,i=input(),0
                                                                                                                          exec"print(n-i)**i;i+=1;"*n #Prints in reversed order


                                                                                                                          Try it online!






                                                                                                                          share|improve this answer













                                                                                                                          Python 2, 40 bytes





                                                                                                                          lambda n:[i**(n-i)for i in range(1,n+1)]   #Outputs a list


                                                                                                                          Try it online!




                                                                                                                          Python 2, 41 bytes





                                                                                                                          n,i=input(),0
                                                                                                                          exec"print(n-i)**i;i+=1;"*n #Prints in reversed order


                                                                                                                          Try it online!







                                                                                                                          share|improve this answer












                                                                                                                          share|improve this answer



                                                                                                                          share|improve this answer










                                                                                                                          answered Nov 28 at 5:58









                                                                                                                          Vedant Kandoi

                                                                                                                          76021




                                                                                                                          76021






















                                                                                                                              up vote
                                                                                                                              2
                                                                                                                              down vote














                                                                                                                              Ruby, 27 bytes





                                                                                                                              ->n{(1..n).map{|r|r**n-=1}}


                                                                                                                              Try it online!






                                                                                                                              share|improve this answer

























                                                                                                                                up vote
                                                                                                                                2
                                                                                                                                down vote














                                                                                                                                Ruby, 27 bytes





                                                                                                                                ->n{(1..n).map{|r|r**n-=1}}


                                                                                                                                Try it online!






                                                                                                                                share|improve this answer























                                                                                                                                  up vote
                                                                                                                                  2
                                                                                                                                  down vote










                                                                                                                                  up vote
                                                                                                                                  2
                                                                                                                                  down vote










                                                                                                                                  Ruby, 27 bytes





                                                                                                                                  ->n{(1..n).map{|r|r**n-=1}}


                                                                                                                                  Try it online!






                                                                                                                                  share|improve this answer













                                                                                                                                  Ruby, 27 bytes





                                                                                                                                  ->n{(1..n).map{|r|r**n-=1}}


                                                                                                                                  Try it online!







                                                                                                                                  share|improve this answer












                                                                                                                                  share|improve this answer



                                                                                                                                  share|improve this answer










                                                                                                                                  answered Nov 28 at 7:06









                                                                                                                                  G B

                                                                                                                                  7,5861328




                                                                                                                                  7,5861328






















                                                                                                                                      up vote
                                                                                                                                      2
                                                                                                                                      down vote














                                                                                                                                      Retina, 35 bytes



                                                                                                                                      .+
                                                                                                                                      *
                                                                                                                                      _
                                                                                                                                      $$.($.'*$($.>`$*)_¶
                                                                                                                                      %~`^
                                                                                                                                      .+¶


                                                                                                                                      Try it online! Explanation:



                                                                                                                                      .+
                                                                                                                                      *


                                                                                                                                      Convert the input to unary.



                                                                                                                                      _


                                                                                                                                      Match each position. This then sets several replacement variables. $` becomes the left of the match; $>` modifies this to be the left and match; $.>` modifies this to take the length, i.e. the current index. $' meanwhile is the right of the match, so $.' is the length i.e. the current exponent.



                                                                                                                                      $$.($.'*$($.>`$*)_¶


                                                                                                                                      Create a string $.( plus $.' repetitions of $.>`* plus _. For an example, for an index of 2 in an original input of 5, $.' is 3 and $.>` is 2 so the resulting string is $.(2*2*2*_. This conveniently is a Retina replacement expression that caluclates 2³. Each string is output on its own line.



                                                                                                                                      %~`^
                                                                                                                                      .+¶


                                                                                                                                      For each line generated by the previous stage, prefix a line .+ to it, turning it into a replacement stage, and evaluate that stage, thereby calculating the expression.






                                                                                                                                      share|improve this answer

























                                                                                                                                        up vote
                                                                                                                                        2
                                                                                                                                        down vote














                                                                                                                                        Retina, 35 bytes



                                                                                                                                        .+
                                                                                                                                        *
                                                                                                                                        _
                                                                                                                                        $$.($.'*$($.>`$*)_¶
                                                                                                                                        %~`^
                                                                                                                                        .+¶


                                                                                                                                        Try it online! Explanation:



                                                                                                                                        .+
                                                                                                                                        *


                                                                                                                                        Convert the input to unary.



                                                                                                                                        _


                                                                                                                                        Match each position. This then sets several replacement variables. $` becomes the left of the match; $>` modifies this to be the left and match; $.>` modifies this to take the length, i.e. the current index. $' meanwhile is the right of the match, so $.' is the length i.e. the current exponent.



                                                                                                                                        $$.($.'*$($.>`$*)_¶


                                                                                                                                        Create a string $.( plus $.' repetitions of $.>`* plus _. For an example, for an index of 2 in an original input of 5, $.' is 3 and $.>` is 2 so the resulting string is $.(2*2*2*_. This conveniently is a Retina replacement expression that caluclates 2³. Each string is output on its own line.



                                                                                                                                        %~`^
                                                                                                                                        .+¶


                                                                                                                                        For each line generated by the previous stage, prefix a line .+ to it, turning it into a replacement stage, and evaluate that stage, thereby calculating the expression.






                                                                                                                                        share|improve this answer























                                                                                                                                          up vote
                                                                                                                                          2
                                                                                                                                          down vote










                                                                                                                                          up vote
                                                                                                                                          2
                                                                                                                                          down vote










                                                                                                                                          Retina, 35 bytes



                                                                                                                                          .+
                                                                                                                                          *
                                                                                                                                          _
                                                                                                                                          $$.($.'*$($.>`$*)_¶
                                                                                                                                          %~`^
                                                                                                                                          .+¶


                                                                                                                                          Try it online! Explanation:



                                                                                                                                          .+
                                                                                                                                          *


                                                                                                                                          Convert the input to unary.



                                                                                                                                          _


                                                                                                                                          Match each position. This then sets several replacement variables. $` becomes the left of the match; $>` modifies this to be the left and match; $.>` modifies this to take the length, i.e. the current index. $' meanwhile is the right of the match, so $.' is the length i.e. the current exponent.



                                                                                                                                          $$.($.'*$($.>`$*)_¶


                                                                                                                                          Create a string $.( plus $.' repetitions of $.>`* plus _. For an example, for an index of 2 in an original input of 5, $.' is 3 and $.>` is 2 so the resulting string is $.(2*2*2*_. This conveniently is a Retina replacement expression that caluclates 2³. Each string is output on its own line.



                                                                                                                                          %~`^
                                                                                                                                          .+¶


                                                                                                                                          For each line generated by the previous stage, prefix a line .+ to it, turning it into a replacement stage, and evaluate that stage, thereby calculating the expression.






                                                                                                                                          share|improve this answer













                                                                                                                                          Retina, 35 bytes



                                                                                                                                          .+
                                                                                                                                          *
                                                                                                                                          _
                                                                                                                                          $$.($.'*$($.>`$*)_¶
                                                                                                                                          %~`^
                                                                                                                                          .+¶


                                                                                                                                          Try it online! Explanation:



                                                                                                                                          .+
                                                                                                                                          *


                                                                                                                                          Convert the input to unary.



                                                                                                                                          _


                                                                                                                                          Match each position. This then sets several replacement variables. $` becomes the left of the match; $>` modifies this to be the left and match; $.>` modifies this to take the length, i.e. the current index. $' meanwhile is the right of the match, so $.' is the length i.e. the current exponent.



                                                                                                                                          $$.($.'*$($.>`$*)_¶


                                                                                                                                          Create a string $.( plus $.' repetitions of $.>`* plus _. For an example, for an index of 2 in an original input of 5, $.' is 3 and $.>` is 2 so the resulting string is $.(2*2*2*_. This conveniently is a Retina replacement expression that caluclates 2³. Each string is output on its own line.



                                                                                                                                          %~`^
                                                                                                                                          .+¶


                                                                                                                                          For each line generated by the previous stage, prefix a line .+ to it, turning it into a replacement stage, and evaluate that stage, thereby calculating the expression.







                                                                                                                                          share|improve this answer












                                                                                                                                          share|improve this answer



                                                                                                                                          share|improve this answer










                                                                                                                                          answered 2 days ago









                                                                                                                                          Neil

                                                                                                                                          78.4k744175




                                                                                                                                          78.4k744175






















                                                                                                                                              up vote
                                                                                                                                              2
                                                                                                                                              down vote













                                                                                                                                              QBasic, 3533 bytes



                                                                                                                                              Thank you @Neil for 2 bytes!



                                                                                                                                              INPUT a
                                                                                                                                              FOR b=1TO a
                                                                                                                                              ?b^(a-b)
                                                                                                                                              NEXT


                                                                                                                                              Slightly expanded version on REPL.IT because the interpreter in't entirely up-to-spec.



                                                                                                                                              Output



                                                                                                                                              QBasic (qb.js)
                                                                                                                                              Copyright (c) 2010 Steve Hanov

                                                                                                                                              5
                                                                                                                                              1
                                                                                                                                              8
                                                                                                                                              9
                                                                                                                                              4
                                                                                                                                              1





                                                                                                                                              share|improve this answer























                                                                                                                                              • Save 2 bytes by outputting the list in the correct order! (b^(a-b) for b=1..a)
                                                                                                                                                – Neil
                                                                                                                                                2 days ago










                                                                                                                                              • @Neil Thanks, I've worked it in!
                                                                                                                                                – steenbergh
                                                                                                                                                2 days ago















                                                                                                                                              up vote
                                                                                                                                              2
                                                                                                                                              down vote













                                                                                                                                              QBasic, 3533 bytes



                                                                                                                                              Thank you @Neil for 2 bytes!



                                                                                                                                              INPUT a
                                                                                                                                              FOR b=1TO a
                                                                                                                                              ?b^(a-b)
                                                                                                                                              NEXT


                                                                                                                                              Slightly expanded version on REPL.IT because the interpreter in't entirely up-to-spec.



                                                                                                                                              Output



                                                                                                                                              QBasic (qb.js)
                                                                                                                                              Copyright (c) 2010 Steve Hanov

                                                                                                                                              5
                                                                                                                                              1
                                                                                                                                              8
                                                                                                                                              9
                                                                                                                                              4
                                                                                                                                              1





                                                                                                                                              share|improve this answer























                                                                                                                                              • Save 2 bytes by outputting the list in the correct order! (b^(a-b) for b=1..a)
                                                                                                                                                – Neil
                                                                                                                                                2 days ago










                                                                                                                                              • @Neil Thanks, I've worked it in!
                                                                                                                                                – steenbergh
                                                                                                                                                2 days ago













                                                                                                                                              up vote
                                                                                                                                              2
                                                                                                                                              down vote










                                                                                                                                              up vote
                                                                                                                                              2
                                                                                                                                              down vote









                                                                                                                                              QBasic, 3533 bytes



                                                                                                                                              Thank you @Neil for 2 bytes!



                                                                                                                                              INPUT a
                                                                                                                                              FOR b=1TO a
                                                                                                                                              ?b^(a-b)
                                                                                                                                              NEXT


                                                                                                                                              Slightly expanded version on REPL.IT because the interpreter in't entirely up-to-spec.



                                                                                                                                              Output



                                                                                                                                              QBasic (qb.js)
                                                                                                                                              Copyright (c) 2010 Steve Hanov

                                                                                                                                              5
                                                                                                                                              1
                                                                                                                                              8
                                                                                                                                              9
                                                                                                                                              4
                                                                                                                                              1





                                                                                                                                              share|improve this answer














                                                                                                                                              QBasic, 3533 bytes



                                                                                                                                              Thank you @Neil for 2 bytes!



                                                                                                                                              INPUT a
                                                                                                                                              FOR b=1TO a
                                                                                                                                              ?b^(a-b)
                                                                                                                                              NEXT


                                                                                                                                              Slightly expanded version on REPL.IT because the interpreter in't entirely up-to-spec.



                                                                                                                                              Output



                                                                                                                                              QBasic (qb.js)
                                                                                                                                              Copyright (c) 2010 Steve Hanov

                                                                                                                                              5
                                                                                                                                              1
                                                                                                                                              8
                                                                                                                                              9
                                                                                                                                              4
                                                                                                                                              1






                                                                                                                                              share|improve this answer














                                                                                                                                              share|improve this answer



                                                                                                                                              share|improve this answer








                                                                                                                                              edited 2 days ago

























                                                                                                                                              answered 2 days ago









                                                                                                                                              steenbergh

                                                                                                                                              6,79411739




                                                                                                                                              6,79411739












                                                                                                                                              • Save 2 bytes by outputting the list in the correct order! (b^(a-b) for b=1..a)
                                                                                                                                                – Neil
                                                                                                                                                2 days ago










                                                                                                                                              • @Neil Thanks, I've worked it in!
                                                                                                                                                – steenbergh
                                                                                                                                                2 days ago


















                                                                                                                                              • Save 2 bytes by outputting the list in the correct order! (b^(a-b) for b=1..a)
                                                                                                                                                – Neil
                                                                                                                                                2 days ago










                                                                                                                                              • @Neil Thanks, I've worked it in!
                                                                                                                                                – steenbergh
                                                                                                                                                2 days ago
















                                                                                                                                              Save 2 bytes by outputting the list in the correct order! (b^(a-b) for b=1..a)
                                                                                                                                              – Neil
                                                                                                                                              2 days ago




                                                                                                                                              Save 2 bytes by outputting the list in the correct order! (b^(a-b) for b=1..a)
                                                                                                                                              – Neil
                                                                                                                                              2 days ago












                                                                                                                                              @Neil Thanks, I've worked it in!
                                                                                                                                              – steenbergh
                                                                                                                                              2 days ago




                                                                                                                                              @Neil Thanks, I've worked it in!
                                                                                                                                              – steenbergh
                                                                                                                                              2 days ago










                                                                                                                                              up vote
                                                                                                                                              2
                                                                                                                                              down vote














                                                                                                                                              F# (.NET Core), 42 bytes





                                                                                                                                              let f x=Seq.map(fun y->pown y (x-y))[1..x]


                                                                                                                                              Try it online!






                                                                                                                                              share|improve this answer

























                                                                                                                                                up vote
                                                                                                                                                2
                                                                                                                                                down vote














                                                                                                                                                F# (.NET Core), 42 bytes





                                                                                                                                                let f x=Seq.map(fun y->pown y (x-y))[1..x]


                                                                                                                                                Try it online!






                                                                                                                                                share|improve this answer























                                                                                                                                                  up vote
                                                                                                                                                  2
                                                                                                                                                  down vote










                                                                                                                                                  up vote
                                                                                                                                                  2
                                                                                                                                                  down vote










                                                                                                                                                  F# (.NET Core), 42 bytes





                                                                                                                                                  let f x=Seq.map(fun y->pown y (x-y))[1..x]


                                                                                                                                                  Try it online!






                                                                                                                                                  share|improve this answer













                                                                                                                                                  F# (.NET Core), 42 bytes





                                                                                                                                                  let f x=Seq.map(fun y->pown y (x-y))[1..x]


                                                                                                                                                  Try it online!







                                                                                                                                                  share|improve this answer












                                                                                                                                                  share|improve this answer



                                                                                                                                                  share|improve this answer










                                                                                                                                                  answered 2 days ago









                                                                                                                                                  dana

                                                                                                                                                  25114




                                                                                                                                                  25114






















                                                                                                                                                      up vote
                                                                                                                                                      2
                                                                                                                                                      down vote














                                                                                                                                                      JavaScript (Node.js), 33 32 bytes





                                                                                                                                                      n=>(g=i=>--n?++i**n+[,g(i)]:1)``


                                                                                                                                                      Try it online!



                                                                                                                                                      -3 bytes with credits to @Shaggy, and -1 byte by @l4m2!




                                                                                                                                                      JavaScript (Node.js), 36 bytes





                                                                                                                                                      f=(n,i=1)=>n--?[i++**n,...f(n,i)]:


                                                                                                                                                      Try it online!




                                                                                                                                                      JavaScript (Node.js), 37 bytes





                                                                                                                                                      n=>[...Array(n)].map(x=>++i**--n,i=0)


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer























                                                                                                                                                      • 33 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        2 days ago










                                                                                                                                                      • 32
                                                                                                                                                        – l4m2
                                                                                                                                                        2 days ago















                                                                                                                                                      up vote
                                                                                                                                                      2
                                                                                                                                                      down vote














                                                                                                                                                      JavaScript (Node.js), 33 32 bytes





                                                                                                                                                      n=>(g=i=>--n?++i**n+[,g(i)]:1)``


                                                                                                                                                      Try it online!



                                                                                                                                                      -3 bytes with credits to @Shaggy, and -1 byte by @l4m2!




                                                                                                                                                      JavaScript (Node.js), 36 bytes





                                                                                                                                                      f=(n,i=1)=>n--?[i++**n,...f(n,i)]:


                                                                                                                                                      Try it online!




                                                                                                                                                      JavaScript (Node.js), 37 bytes





                                                                                                                                                      n=>[...Array(n)].map(x=>++i**--n,i=0)


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer























                                                                                                                                                      • 33 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        2 days ago










                                                                                                                                                      • 32
                                                                                                                                                        – l4m2
                                                                                                                                                        2 days ago













                                                                                                                                                      up vote
                                                                                                                                                      2
                                                                                                                                                      down vote










                                                                                                                                                      up vote
                                                                                                                                                      2
                                                                                                                                                      down vote










                                                                                                                                                      JavaScript (Node.js), 33 32 bytes





                                                                                                                                                      n=>(g=i=>--n?++i**n+[,g(i)]:1)``


                                                                                                                                                      Try it online!



                                                                                                                                                      -3 bytes with credits to @Shaggy, and -1 byte by @l4m2!




                                                                                                                                                      JavaScript (Node.js), 36 bytes





                                                                                                                                                      f=(n,i=1)=>n--?[i++**n,...f(n,i)]:


                                                                                                                                                      Try it online!




                                                                                                                                                      JavaScript (Node.js), 37 bytes





                                                                                                                                                      n=>[...Array(n)].map(x=>++i**--n,i=0)


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer















                                                                                                                                                      JavaScript (Node.js), 33 32 bytes





                                                                                                                                                      n=>(g=i=>--n?++i**n+[,g(i)]:1)``


                                                                                                                                                      Try it online!



                                                                                                                                                      -3 bytes with credits to @Shaggy, and -1 byte by @l4m2!




                                                                                                                                                      JavaScript (Node.js), 36 bytes





                                                                                                                                                      f=(n,i=1)=>n--?[i++**n,...f(n,i)]:


                                                                                                                                                      Try it online!




                                                                                                                                                      JavaScript (Node.js), 37 bytes





                                                                                                                                                      n=>[...Array(n)].map(x=>++i**--n,i=0)


                                                                                                                                                      Try it online!







                                                                                                                                                      share|improve this answer














                                                                                                                                                      share|improve this answer



                                                                                                                                                      share|improve this answer








                                                                                                                                                      edited 2 days ago

























                                                                                                                                                      answered Nov 28 at 4:15









                                                                                                                                                      Shieru Asakoto

                                                                                                                                                      2,380314




                                                                                                                                                      2,380314












                                                                                                                                                      • 33 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        2 days ago










                                                                                                                                                      • 32
                                                                                                                                                        – l4m2
                                                                                                                                                        2 days ago


















                                                                                                                                                      • 33 bytes
                                                                                                                                                        – Shaggy
                                                                                                                                                        2 days ago










                                                                                                                                                      • 32
                                                                                                                                                        – l4m2
                                                                                                                                                        2 days ago
















                                                                                                                                                      33 bytes
                                                                                                                                                      – Shaggy
                                                                                                                                                      2 days ago




                                                                                                                                                      33 bytes
                                                                                                                                                      – Shaggy
                                                                                                                                                      2 days ago












                                                                                                                                                      32
                                                                                                                                                      – l4m2
                                                                                                                                                      2 days ago




                                                                                                                                                      32
                                                                                                                                                      – l4m2
                                                                                                                                                      2 days ago










                                                                                                                                                      up vote
                                                                                                                                                      2
                                                                                                                                                      down vote














                                                                                                                                                      C# (Visual C# Interactive Compiler), 46 bytes





                                                                                                                                                      x=>new int[x].Select((_,i)=>Math.Pow(i+1,--x))


                                                                                                                                                      Try it online!






                                                                                                                                                      share|improve this answer

























                                                                                                                                                        up vote
                                                                                                                                                        2
                                                                                                                                                        down vote














                                                                                                                                                        C# (Visual C# Interactive Compiler), 46 bytes





                                                                                                                                                        x=>new int[x].Select((_,i)=>Math.Pow(i+1,--x))


                                                                                                                                                        Try it online!






                                                                                                                                                        share|improve this answer























                                                                                                                                                          up vote
                                                                                                                                                          2
                                                                                                                                                          down vote










                                                                                                                                                          up vote
                                                                                                                                                          2
                                                                                                                                                          down vote










                                                                                                                                                          C# (Visual C# Interactive Compiler), 46 bytes





                                                                                                                                                          x=>new int[x].Select((_,i)=>Math.Pow(i+1,--x))


                                                                                                                                                          Try it online!






                                                                                                                                                          share|improve this answer













                                                                                                                                                          C# (Visual C# Interactive Compiler), 46 bytes





                                                                                                                                                          x=>new int[x].Select((_,i)=>Math.Pow(i+1,--x))


                                                                                                                                                          Try it online!







                                                                                                                                                          share|improve this answer












                                                                                                                                                          share|improve this answer



                                                                                                                                                          share|improve this answer










                                                                                                                                                          answered 2 days ago









                                                                                                                                                          dana

                                                                                                                                                          25114




                                                                                                                                                          25114






















                                                                                                                                                              up vote
                                                                                                                                                              2
                                                                                                                                                              down vote














                                                                                                                                                              MATL, 5 bytes



                                                                                                                                                              :Gy-^


                                                                                                                                                              Try it online!



                                                                                                                                                              Explanation



                                                                                                                                                              Consider input 5 as an example.



                                                                                                                                                              :     % Implicit input. Range
                                                                                                                                                              % STACK: [1 2 3 4 5]
                                                                                                                                                              G % Push input again
                                                                                                                                                              % STACK: [1 2 3 4 5], 5
                                                                                                                                                              y % Duplicate from below
                                                                                                                                                              % STACK: [1 2 3 4 5], 5, [1 2 3 4 5]
                                                                                                                                                              - % Subtract, element-wise
                                                                                                                                                              % STACK: [1 2 3 4 5], [4 3 2 1 0]
                                                                                                                                                              ^ % Power, element-wise. Implicit display
                                                                                                                                                              % STACK: [1 8 9 4 1]





                                                                                                                                                              share|improve this answer

























                                                                                                                                                                up vote
                                                                                                                                                                2
                                                                                                                                                                down vote














                                                                                                                                                                MATL, 5 bytes



                                                                                                                                                                :Gy-^


                                                                                                                                                                Try it online!



                                                                                                                                                                Explanation



                                                                                                                                                                Consider input 5 as an example.



                                                                                                                                                                :     % Implicit input. Range
                                                                                                                                                                % STACK: [1 2 3 4 5]
                                                                                                                                                                G % Push input again
                                                                                                                                                                % STACK: [1 2 3 4 5], 5
                                                                                                                                                                y % Duplicate from below
                                                                                                                                                                % STACK: [1 2 3 4 5], 5, [1 2 3 4 5]
                                                                                                                                                                - % Subtract, element-wise
                                                                                                                                                                % STACK: [1 2 3 4 5], [4 3 2 1 0]
                                                                                                                                                                ^ % Power, element-wise. Implicit display
                                                                                                                                                                % STACK: [1 8 9 4 1]





                                                                                                                                                                share|improve this answer























                                                                                                                                                                  up vote
                                                                                                                                                                  2
                                                                                                                                                                  down vote










                                                                                                                                                                  up vote
                                                                                                                                                                  2
                                                                                                                                                                  down vote










                                                                                                                                                                  MATL, 5 bytes



                                                                                                                                                                  :Gy-^


                                                                                                                                                                  Try it online!



                                                                                                                                                                  Explanation



                                                                                                                                                                  Consider input 5 as an example.



                                                                                                                                                                  :     % Implicit input. Range
                                                                                                                                                                  % STACK: [1 2 3 4 5]
                                                                                                                                                                  G % Push input again
                                                                                                                                                                  % STACK: [1 2 3 4 5], 5
                                                                                                                                                                  y % Duplicate from below
                                                                                                                                                                  % STACK: [1 2 3 4 5], 5, [1 2 3 4 5]
                                                                                                                                                                  - % Subtract, element-wise
                                                                                                                                                                  % STACK: [1 2 3 4 5], [4 3 2 1 0]
                                                                                                                                                                  ^ % Power, element-wise. Implicit display
                                                                                                                                                                  % STACK: [1 8 9 4 1]





                                                                                                                                                                  share|improve this answer













                                                                                                                                                                  MATL, 5 bytes



                                                                                                                                                                  :Gy-^


                                                                                                                                                                  Try it online!



                                                                                                                                                                  Explanation



                                                                                                                                                                  Consider input 5 as an example.



                                                                                                                                                                  :     % Implicit input. Range
                                                                                                                                                                  % STACK: [1 2 3 4 5]
                                                                                                                                                                  G % Push input again
                                                                                                                                                                  % STACK: [1 2 3 4 5], 5
                                                                                                                                                                  y % Duplicate from below
                                                                                                                                                                  % STACK: [1 2 3 4 5], 5, [1 2 3 4 5]
                                                                                                                                                                  - % Subtract, element-wise
                                                                                                                                                                  % STACK: [1 2 3 4 5], [4 3 2 1 0]
                                                                                                                                                                  ^ % Power, element-wise. Implicit display
                                                                                                                                                                  % STACK: [1 8 9 4 1]






                                                                                                                                                                  share|improve this answer












                                                                                                                                                                  share|improve this answer



                                                                                                                                                                  share|improve this answer










                                                                                                                                                                  answered 2 days ago









                                                                                                                                                                  Luis Mendo

                                                                                                                                                                  73.8k885290




                                                                                                                                                                  73.8k885290






















                                                                                                                                                                      up vote
                                                                                                                                                                      2
                                                                                                                                                                      down vote













                                                                                                                                                                      Java, 59 Bytes



                                                                                                                                                                      for(int i=1;a+1>i;i++)System.out.println(Math.pow(i,a-i));





                                                                                                                                                                      share|improve this answer























                                                                                                                                                                      • Welcome to PPCG. It looks like this requires "input" be assigned to the predefined variable a, which we don't allow.
                                                                                                                                                                        – Shaggy
                                                                                                                                                                        yesterday












                                                                                                                                                                      • Hello, here's a fix for you: n->{for(int i=0;i++<n;)System.out.println(Math.pow(i,n-i));} 60 bytes (code and test cases in the link)
                                                                                                                                                                        – Olivier Grégoire
                                                                                                                                                                        21 hours ago

















                                                                                                                                                                      up vote
                                                                                                                                                                      2
                                                                                                                                                                      down vote













                                                                                                                                                                      Java, 59 Bytes



                                                                                                                                                                      for(int i=1;a+1>i;i++)System.out.println(Math.pow(i,a-i));





                                                                                                                                                                      share|improve this answer























                                                                                                                                                                      • Welcome to PPCG. It looks like this requires "input" be assigned to the predefined variable a, which we don't allow.
                                                                                                                                                                        – Shaggy
                                                                                                                                                                        yesterday












                                                                                                                                                                      • Hello, here's a fix for you: n->{for(int i=0;i++<n;)System.out.println(Math.pow(i,n-i));} 60 bytes (code and test cases in the link)
                                                                                                                                                                        – Olivier Grégoire
                                                                                                                                                                        21 hours ago















                                                                                                                                                                      up vote
                                                                                                                                                                      2
                                                                                                                                                                      down vote










                                                                                                                                                                      up vote
                                                                                                                                                                      2
                                                                                                                                                                      down vote









                                                                                                                                                                      Java, 59 Bytes



                                                                                                                                                                      for(int i=1;a+1>i;i++)System.out.println(Math.pow(i,a-i));





                                                                                                                                                                      share|improve this answer














                                                                                                                                                                      Java, 59 Bytes



                                                                                                                                                                      for(int i=1;a+1>i;i++)System.out.println(Math.pow(i,a-i));






                                                                                                                                                                      share|improve this answer














                                                                                                                                                                      share|improve this answer



                                                                                                                                                                      share|improve this answer








                                                                                                                                                                      edited yesterday









                                                                                                                                                                      Shaggy

                                                                                                                                                                      18.4k21663




                                                                                                                                                                      18.4k21663










                                                                                                                                                                      answered 2 days ago









                                                                                                                                                                      isaace

                                                                                                                                                                      1614




                                                                                                                                                                      1614












                                                                                                                                                                      • Welcome to PPCG. It looks like this requires "input" be assigned to the predefined variable a, which we don't allow.
                                                                                                                                                                        – Shaggy
                                                                                                                                                                        yesterday












                                                                                                                                                                      • Hello, here's a fix for you: n->{for(int i=0;i++<n;)System.out.println(Math.pow(i,n-i));} 60 bytes (code and test cases in the link)
                                                                                                                                                                        – Olivier Grégoire
                                                                                                                                                                        21 hours ago




















                                                                                                                                                                      • Welcome to PPCG. It looks like this requires "input" be assigned to the predefined variable a, which we don't allow.
                                                                                                                                                                        – Shaggy
                                                                                                                                                                        yesterday












                                                                                                                                                                      • Hello, here's a fix for you: n->{for(int i=0;i++<n;)System.out.println(Math.pow(i,n-i));} 60 bytes (code and test cases in the link)
                                                                                                                                                                        – Olivier Grégoire
                                                                                                                                                                        21 hours ago


















                                                                                                                                                                      Welcome to PPCG. It looks like this requires "input" be assigned to the predefined variable a, which we don't allow.
                                                                                                                                                                      – Shaggy
                                                                                                                                                                      yesterday






                                                                                                                                                                      Welcome to PPCG. It looks like this requires "input" be assigned to the predefined variable a, which we don't allow.
                                                                                                                                                                      – Shaggy
                                                                                                                                                                      yesterday














                                                                                                                                                                      Hello, here's a fix for you: n->{for(int i=0;i++<n;)System.out.println(Math.pow(i,n-i));} 60 bytes (code and test cases in the link)
                                                                                                                                                                      – Olivier Grégoire
                                                                                                                                                                      21 hours ago






                                                                                                                                                                      Hello, here's a fix for you: n->{for(int i=0;i++<n;)System.out.println(Math.pow(i,n-i));} 60 bytes (code and test cases in the link)
                                                                                                                                                                      – Olivier Grégoire
                                                                                                                                                                      21 hours ago












                                                                                                                                                                      up vote
                                                                                                                                                                      2
                                                                                                                                                                      down vote














                                                                                                                                                                      Jelly, 4 bytes



                                                                                                                                                                      *ạ¥€


                                                                                                                                                                      Try it online!






                                                                                                                                                                      share|improve this answer

























                                                                                                                                                                        up vote
                                                                                                                                                                        2
                                                                                                                                                                        down vote














                                                                                                                                                                        Jelly, 4 bytes



                                                                                                                                                                        *ạ¥€


                                                                                                                                                                        Try it online!






                                                                                                                                                                        share|improve this answer























                                                                                                                                                                          up vote
                                                                                                                                                                          2
                                                                                                                                                                          down vote










                                                                                                                                                                          up vote
                                                                                                                                                                          2
                                                                                                                                                                          down vote










                                                                                                                                                                          Jelly, 4 bytes



                                                                                                                                                                          *ạ¥€


                                                                                                                                                                          Try it online!






                                                                                                                                                                          share|improve this answer













                                                                                                                                                                          Jelly, 4 bytes



                                                                                                                                                                          *ạ¥€


                                                                                                                                                                          Try it online!







                                                                                                                                                                          share|improve this answer












                                                                                                                                                                          share|improve this answer



                                                                                                                                                                          share|improve this answer










                                                                                                                                                                          answered yesterday









                                                                                                                                                                          Erik the Outgolfer

                                                                                                                                                                          30.8k429102




                                                                                                                                                                          30.8k429102






















                                                                                                                                                                              up vote
                                                                                                                                                                              1
                                                                                                                                                                              down vote














                                                                                                                                                                              Clean, 37 bytes



                                                                                                                                                                              import StdEnv
                                                                                                                                                                              $n=[i^(n-i)\i<-[1..n]]


                                                                                                                                                                              Try it online!



                                                                                                                                                                              Defines $ :: Int -> [Int] taking an integer and returning the list of results.



                                                                                                                                                                              $ n                // function $ of n
                                                                                                                                                                              = [i ^ (n-i) // i to the power of n minus i
                                                                                                                                                                              \ i <- [1..n] // for each i in 1 to n
                                                                                                                                                                              ]





                                                                                                                                                                              share|improve this answer



























                                                                                                                                                                                up vote
                                                                                                                                                                                1
                                                                                                                                                                                down vote














                                                                                                                                                                                Clean, 37 bytes



                                                                                                                                                                                import StdEnv
                                                                                                                                                                                $n=[i^(n-i)\i<-[1..n]]


                                                                                                                                                                                Try it online!



                                                                                                                                                                                Defines $ :: Int -> [Int] taking an integer and returning the list of results.



                                                                                                                                                                                $ n                // function $ of n
                                                                                                                                                                                = [i ^ (n-i) // i to the power of n minus i
                                                                                                                                                                                \ i <- [1..n] // for each i in 1 to n
                                                                                                                                                                                ]





                                                                                                                                                                                share|improve this answer

























                                                                                                                                                                                  up vote
                                                                                                                                                                                  1
                                                                                                                                                                                  down vote










                                                                                                                                                                                  up vote
                                                                                                                                                                                  1
                                                                                                                                                                                  down vote










                                                                                                                                                                                  Clean, 37 bytes



                                                                                                                                                                                  import StdEnv
                                                                                                                                                                                  $n=[i^(n-i)\i<-[1..n]]


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Defines $ :: Int -> [Int] taking an integer and returning the list of results.



                                                                                                                                                                                  $ n                // function $ of n
                                                                                                                                                                                  = [i ^ (n-i) // i to the power of n minus i
                                                                                                                                                                                  \ i <- [1..n] // for each i in 1 to n
                                                                                                                                                                                  ]





                                                                                                                                                                                  share|improve this answer















                                                                                                                                                                                  Clean, 37 bytes



                                                                                                                                                                                  import StdEnv
                                                                                                                                                                                  $n=[i^(n-i)\i<-[1..n]]


                                                                                                                                                                                  Try it online!



                                                                                                                                                                                  Defines $ :: Int -> [Int] taking an integer and returning the list of results.



                                                                                                                                                                                  $ n                // function $ of n
                                                                                                                                                                                  = [i ^ (n-i) // i to the power of n minus i
                                                                                                                                                                                  \ i <- [1..n] // for each i in 1 to n
                                                                                                                                                                                  ]






                                                                                                                                                                                  share|improve this answer














                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                  share|improve this answer








                                                                                                                                                                                  edited Nov 28 at 4:26

























                                                                                                                                                                                  answered Nov 28 at 4:12









                                                                                                                                                                                  Οurous

                                                                                                                                                                                  5,99311032




                                                                                                                                                                                  5,99311032






















                                                                                                                                                                                      up vote
                                                                                                                                                                                      1
                                                                                                                                                                                      down vote














                                                                                                                                                                                      R, 34 bytes





                                                                                                                                                                                      x=1:scan();cat(x^rev(x-1),sep=',')


                                                                                                                                                                                      Try it online!






                                                                                                                                                                                      share|improve this answer





















                                                                                                                                                                                      • Is the default "sep" not a space? Would that not work?
                                                                                                                                                                                        – stuart stevenson
                                                                                                                                                                                        yesterday








                                                                                                                                                                                      • 1




                                                                                                                                                                                        @stuartstevenson "Output will be a list of numbers, delimited by either commas or new lines."
                                                                                                                                                                                        – Giuseppe
                                                                                                                                                                                        yesterday















                                                                                                                                                                                      up vote
                                                                                                                                                                                      1
                                                                                                                                                                                      down vote














                                                                                                                                                                                      R, 34 bytes





                                                                                                                                                                                      x=1:scan();cat(x^rev(x-1),sep=',')


                                                                                                                                                                                      Try it online!






                                                                                                                                                                                      share|improve this answer





















                                                                                                                                                                                      • Is the default "sep" not a space? Would that not work?
                                                                                                                                                                                        – stuart stevenson
                                                                                                                                                                                        yesterday








                                                                                                                                                                                      • 1




                                                                                                                                                                                        @stuartstevenson "Output will be a list of numbers, delimited by either commas or new lines."
                                                                                                                                                                                        – Giuseppe
                                                                                                                                                                                        yesterday













                                                                                                                                                                                      up vote
                                                                                                                                                                                      1
                                                                                                                                                                                      down vote










                                                                                                                                                                                      up vote
                                                                                                                                                                                      1
                                                                                                                                                                                      down vote










                                                                                                                                                                                      R, 34 bytes





                                                                                                                                                                                      x=1:scan();cat(x^rev(x-1),sep=',')


                                                                                                                                                                                      Try it online!






                                                                                                                                                                                      share|improve this answer













                                                                                                                                                                                      R, 34 bytes





                                                                                                                                                                                      x=1:scan();cat(x^rev(x-1),sep=',')


                                                                                                                                                                                      Try it online!







                                                                                                                                                                                      share|improve this answer












                                                                                                                                                                                      share|improve this answer



                                                                                                                                                                                      share|improve this answer










                                                                                                                                                                                      answered Nov 28 at 4:42









                                                                                                                                                                                      Giuseppe

                                                                                                                                                                                      16.1k31052




                                                                                                                                                                                      16.1k31052












                                                                                                                                                                                      • Is the default "sep" not a space? Would that not work?
                                                                                                                                                                                        – stuart stevenson
                                                                                                                                                                                        yesterday








                                                                                                                                                                                      • 1




                                                                                                                                                                                        @stuartstevenson "Output will be a list of numbers, delimited by either commas or new lines."
                                                                                                                                                                                        – Giuseppe
                                                                                                                                                                                        yesterday


















                                                                                                                                                                                      • Is the default "sep" not a space? Would that not work?
                                                                                                                                                                                        – stuart stevenson
                                                                                                                                                                                        yesterday








                                                                                                                                                                                      • 1




                                                                                                                                                                                        @stuartstevenson "Output will be a list of numbers, delimited by either commas or new lines."
                                                                                                                                                                                        – Giuseppe
                                                                                                                                                                                        yesterday
















                                                                                                                                                                                      Is the default "sep" not a space? Would that not work?
                                                                                                                                                                                      – stuart stevenson
                                                                                                                                                                                      yesterday






                                                                                                                                                                                      Is the default "sep" not a space? Would that not work?
                                                                                                                                                                                      – stuart stevenson
                                                                                                                                                                                      yesterday






                                                                                                                                                                                      1




                                                                                                                                                                                      1




                                                                                                                                                                                      @stuartstevenson "Output will be a list of numbers, delimited by either commas or new lines."
                                                                                                                                                                                      – Giuseppe
                                                                                                                                                                                      yesterday




                                                                                                                                                                                      @stuartstevenson "Output will be a list of numbers, delimited by either commas or new lines."
                                                                                                                                                                                      – Giuseppe
                                                                                                                                                                                      yesterday










                                                                                                                                                                                      up vote
                                                                                                                                                                                      1
                                                                                                                                                                                      down vote














                                                                                                                                                                                      05AB1E, 5 bytes



                                                                                                                                                                                      LD<Rm


                                                                                                                                                                                      Port of @lirtosiast's Jelly answer.



                                                                                                                                                                                      Try it online.



                                                                                                                                                                                      Explanation:





                                                                                                                                                                                      L      # List in the range [1, (implicit) input integer]
                                                                                                                                                                                      # i.e. 5 → [1,2,3,4,5]
                                                                                                                                                                                      D< # Duplicate this list, and subtract 1 to make the range [0, input)
                                                                                                                                                                                      # i.e. [1,2,3,4,5] → [0,1,2,3,4]
                                                                                                                                                                                      R # Reverse it to make the range (input, 0]
                                                                                                                                                                                      # i.e. [0,1,2,3,4] → [4,3,2,1,0]
                                                                                                                                                                                      m # Take the power of the numbers in the lists (at the same indices)
                                                                                                                                                                                      # (and output implicitly)
                                                                                                                                                                                      # i.e. [1,2,3,4,5] and [4,3,2,1,0] → [1,8,9,4,1]





                                                                                                                                                                                      share|improve this answer

























                                                                                                                                                                                        up vote
                                                                                                                                                                                        1
                                                                                                                                                                                        down vote














                                                                                                                                                                                        05AB1E, 5 bytes



                                                                                                                                                                                        LD<Rm


                                                                                                                                                                                        Port of @lirtosiast's Jelly answer.



                                                                                                                                                                                        Try it online.



                                                                                                                                                                                        Explanation:





                                                                                                                                                                                        L      # List in the range [1, (implicit) input integer]
                                                                                                                                                                                        # i.e. 5 → [1,2,3,4,5]
                                                                                                                                                                                        D< # Duplicate this list, and subtract 1 to make the range [0, input)
                                                                                                                                                                                        # i.e. [1,2,3,4,5] → [0,1,2,3,4]
                                                                                                                                                                                        R # Reverse it to make the range (input, 0]
                                                                                                                                                                                        # i.e. [0,1,2,3,4] → [4,3,2,1,0]
                                                                                                                                                                                        m # Take the power of the numbers in the lists (at the same indices)
                                                                                                                                                                                        # (and output implicitly)
                                                                                                                                                                                        # i.e. [1,2,3,4,5] and [4,3,2,1,0] → [1,8,9,4,1]





                                                                                                                                                                                        share|improve this answer























                                                                                                                                                                                          up vote
                                                                                                                                                                                          1
                                                                                                                                                                                          down vote










                                                                                                                                                                                          up vote
                                                                                                                                                                                          1
                                                                                                                                                                                          down vote










                                                                                                                                                                                          05AB1E, 5 bytes



                                                                                                                                                                                          LD<Rm


                                                                                                                                                                                          Port of @lirtosiast's Jelly answer.



                                                                                                                                                                                          Try it online.



                                                                                                                                                                                          Explanation:





                                                                                                                                                                                          L      # List in the range [1, (implicit) input integer]
                                                                                                                                                                                          # i.e. 5 → [1,2,3,4,5]
                                                                                                                                                                                          D< # Duplicate this list, and subtract 1 to make the range [0, input)
                                                                                                                                                                                          # i.e. [1,2,3,4,5] → [0,1,2,3,4]
                                                                                                                                                                                          R # Reverse it to make the range (input, 0]
                                                                                                                                                                                          # i.e. [0,1,2,3,4] → [4,3,2,1,0]
                                                                                                                                                                                          m # Take the power of the numbers in the lists (at the same indices)
                                                                                                                                                                                          # (and output implicitly)
                                                                                                                                                                                          # i.e. [1,2,3,4,5] and [4,3,2,1,0] → [1,8,9,4,1]





                                                                                                                                                                                          share|improve this answer













                                                                                                                                                                                          05AB1E, 5 bytes



                                                                                                                                                                                          LD<Rm


                                                                                                                                                                                          Port of @lirtosiast's Jelly answer.



                                                                                                                                                                                          Try it online.



                                                                                                                                                                                          Explanation:





                                                                                                                                                                                          L      # List in the range [1, (implicit) input integer]
                                                                                                                                                                                          # i.e. 5 → [1,2,3,4,5]
                                                                                                                                                                                          D< # Duplicate this list, and subtract 1 to make the range [0, input)
                                                                                                                                                                                          # i.e. [1,2,3,4,5] → [0,1,2,3,4]
                                                                                                                                                                                          R # Reverse it to make the range (input, 0]
                                                                                                                                                                                          # i.e. [0,1,2,3,4] → [4,3,2,1,0]
                                                                                                                                                                                          m # Take the power of the numbers in the lists (at the same indices)
                                                                                                                                                                                          # (and output implicitly)
                                                                                                                                                                                          # i.e. [1,2,3,4,5] and [4,3,2,1,0] → [1,8,9,4,1]






                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                          share|improve this answer










                                                                                                                                                                                          answered 2 days ago









                                                                                                                                                                                          Kevin Cruijssen

                                                                                                                                                                                          34.6k554182




                                                                                                                                                                                          34.6k554182






















                                                                                                                                                                                              up vote
                                                                                                                                                                                              1
                                                                                                                                                                                              down vote














                                                                                                                                                                                              Lua, 43 41 bytes



                                                                                                                                                                                              -2 bytes thanks to @Shaggy





                                                                                                                                                                                              s=io.read()for i=1,s do print(i^(s-i))end


                                                                                                                                                                                              Try it online!






                                                                                                                                                                                              share|improve this answer



















                                                                                                                                                                                              • 1




                                                                                                                                                                                                I don't think you need the +0; seems to work without it.
                                                                                                                                                                                                – Shaggy
                                                                                                                                                                                                2 days ago















                                                                                                                                                                                              up vote
                                                                                                                                                                                              1
                                                                                                                                                                                              down vote














                                                                                                                                                                                              Lua, 43 41 bytes



                                                                                                                                                                                              -2 bytes thanks to @Shaggy





                                                                                                                                                                                              s=io.read()for i=1,s do print(i^(s-i))end


                                                                                                                                                                                              Try it online!






                                                                                                                                                                                              share|improve this answer



















                                                                                                                                                                                              • 1




                                                                                                                                                                                                I don't think you need the +0; seems to work without it.
                                                                                                                                                                                                – Shaggy
                                                                                                                                                                                                2 days ago













                                                                                                                                                                                              up vote
                                                                                                                                                                                              1
                                                                                                                                                                                              down vote










                                                                                                                                                                                              up vote
                                                                                                                                                                                              1
                                                                                                                                                                                              down vote










                                                                                                                                                                                              Lua, 43 41 bytes



                                                                                                                                                                                              -2 bytes thanks to @Shaggy





                                                                                                                                                                                              s=io.read()for i=1,s do print(i^(s-i))end


                                                                                                                                                                                              Try it online!






                                                                                                                                                                                              share|improve this answer















                                                                                                                                                                                              Lua, 43 41 bytes



                                                                                                                                                                                              -2 bytes thanks to @Shaggy





                                                                                                                                                                                              s=io.read()for i=1,s do print(i^(s-i))end


                                                                                                                                                                                              Try it online!







                                                                                                                                                                                              share|improve this answer














                                                                                                                                                                                              share|improve this answer



                                                                                                                                                                                              share|improve this answer








                                                                                                                                                                                              edited 2 days ago

























                                                                                                                                                                                              answered 2 days ago









                                                                                                                                                                                              ouflak

                                                                                                                                                                                              193311




                                                                                                                                                                                              193311








                                                                                                                                                                                              • 1




                                                                                                                                                                                                I don't think you need the +0; seems to work without it.
                                                                                                                                                                                                – Shaggy
                                                                                                                                                                                                2 days ago














                                                                                                                                                                                              • 1




                                                                                                                                                                                                I don't think you need the +0; seems to work without it.
                                                                                                                                                                                                – Shaggy
                                                                                                                                                                                                2 days ago








                                                                                                                                                                                              1




                                                                                                                                                                                              1




                                                                                                                                                                                              I don't think you need the +0; seems to work without it.
                                                                                                                                                                                              – Shaggy
                                                                                                                                                                                              2 days ago




                                                                                                                                                                                              I don't think you need the +0; seems to work without it.
                                                                                                                                                                                              – Shaggy
                                                                                                                                                                                              2 days ago










                                                                                                                                                                                              up vote
                                                                                                                                                                                              1
                                                                                                                                                                                              down vote













                                                                                                                                                                                              R, 22 bytes



                                                                                                                                                                                              n=scan();(1:n)^(n:1-1)


                                                                                                                                                                                              Fairly self-explanatory; note that the : operator is higher precendence than the - operator so that n:1-1 is shorter than (n-1):0



                                                                                                                                                                                              If we are allowed to start at 0, then we can lose two bytes by using (0:n)^(n:0) avoiding the need for a -1.






                                                                                                                                                                                              share|improve this answer

























                                                                                                                                                                                                up vote
                                                                                                                                                                                                1
                                                                                                                                                                                                down vote













                                                                                                                                                                                                R, 22 bytes



                                                                                                                                                                                                n=scan();(1:n)^(n:1-1)


                                                                                                                                                                                                Fairly self-explanatory; note that the : operator is higher precendence than the - operator so that n:1-1 is shorter than (n-1):0



                                                                                                                                                                                                If we are allowed to start at 0, then we can lose two bytes by using (0:n)^(n:0) avoiding the need for a -1.






                                                                                                                                                                                                share|improve this answer























                                                                                                                                                                                                  up vote
                                                                                                                                                                                                  1
                                                                                                                                                                                                  down vote










                                                                                                                                                                                                  up vote
                                                                                                                                                                                                  1
                                                                                                                                                                                                  down vote









                                                                                                                                                                                                  R, 22 bytes



                                                                                                                                                                                                  n=scan();(1:n)^(n:1-1)


                                                                                                                                                                                                  Fairly self-explanatory; note that the : operator is higher precendence than the - operator so that n:1-1 is shorter than (n-1):0



                                                                                                                                                                                                  If we are allowed to start at 0, then we can lose two bytes by using (0:n)^(n:0) avoiding the need for a -1.






                                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                                  R, 22 bytes



                                                                                                                                                                                                  n=scan();(1:n)^(n:1-1)


                                                                                                                                                                                                  Fairly self-explanatory; note that the : operator is higher precendence than the - operator so that n:1-1 is shorter than (n-1):0



                                                                                                                                                                                                  If we are allowed to start at 0, then we can lose two bytes by using (0:n)^(n:0) avoiding the need for a -1.







                                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                                  answered 2 days ago









                                                                                                                                                                                                  JDL

                                                                                                                                                                                                  1,275410




                                                                                                                                                                                                  1,275410






















                                                                                                                                                                                                      up vote
                                                                                                                                                                                                      1
                                                                                                                                                                                                      down vote














                                                                                                                                                                                                      Charcoal, 9 bytes



                                                                                                                                                                                                      I⮌ENX⁻θιι


                                                                                                                                                                                                      Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                                         N        Input as a number
                                                                                                                                                                                                      E Map over implicit range
                                                                                                                                                                                                      ι Current value
                                                                                                                                                                                                      ⁻ Subtracted from
                                                                                                                                                                                                      θ First input
                                                                                                                                                                                                      X Raised to power
                                                                                                                                                                                                      ι Current value
                                                                                                                                                                                                      ⮌ Reverse list
                                                                                                                                                                                                      I Cast to string
                                                                                                                                                                                                      Implicitly print on separate lines





                                                                                                                                                                                                      share|improve this answer

























                                                                                                                                                                                                        up vote
                                                                                                                                                                                                        1
                                                                                                                                                                                                        down vote














                                                                                                                                                                                                        Charcoal, 9 bytes



                                                                                                                                                                                                        I⮌ENX⁻θιι


                                                                                                                                                                                                        Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                                           N        Input as a number
                                                                                                                                                                                                        E Map over implicit range
                                                                                                                                                                                                        ι Current value
                                                                                                                                                                                                        ⁻ Subtracted from
                                                                                                                                                                                                        θ First input
                                                                                                                                                                                                        X Raised to power
                                                                                                                                                                                                        ι Current value
                                                                                                                                                                                                        ⮌ Reverse list
                                                                                                                                                                                                        I Cast to string
                                                                                                                                                                                                        Implicitly print on separate lines





                                                                                                                                                                                                        share|improve this answer























                                                                                                                                                                                                          up vote
                                                                                                                                                                                                          1
                                                                                                                                                                                                          down vote










                                                                                                                                                                                                          up vote
                                                                                                                                                                                                          1
                                                                                                                                                                                                          down vote










                                                                                                                                                                                                          Charcoal, 9 bytes



                                                                                                                                                                                                          I⮌ENX⁻θιι


                                                                                                                                                                                                          Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                                             N        Input as a number
                                                                                                                                                                                                          E Map over implicit range
                                                                                                                                                                                                          ι Current value
                                                                                                                                                                                                          ⁻ Subtracted from
                                                                                                                                                                                                          θ First input
                                                                                                                                                                                                          X Raised to power
                                                                                                                                                                                                          ι Current value
                                                                                                                                                                                                          ⮌ Reverse list
                                                                                                                                                                                                          I Cast to string
                                                                                                                                                                                                          Implicitly print on separate lines





                                                                                                                                                                                                          share|improve this answer













                                                                                                                                                                                                          Charcoal, 9 bytes



                                                                                                                                                                                                          I⮌ENX⁻θιι


                                                                                                                                                                                                          Try it online! Link is to verbose version of code. Explanation:



                                                                                                                                                                                                             N        Input as a number
                                                                                                                                                                                                          E Map over implicit range
                                                                                                                                                                                                          ι Current value
                                                                                                                                                                                                          ⁻ Subtracted from
                                                                                                                                                                                                          θ First input
                                                                                                                                                                                                          X Raised to power
                                                                                                                                                                                                          ι Current value
                                                                                                                                                                                                          ⮌ Reverse list
                                                                                                                                                                                                          I Cast to string
                                                                                                                                                                                                          Implicitly print on separate lines






                                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                                          share|improve this answer










                                                                                                                                                                                                          answered 2 days ago









                                                                                                                                                                                                          Neil

                                                                                                                                                                                                          78.4k744175




                                                                                                                                                                                                          78.4k744175






















                                                                                                                                                                                                              up vote
                                                                                                                                                                                                              1
                                                                                                                                                                                                              down vote














                                                                                                                                                                                                              C# (Visual C# Interactive Compiler), 55 bytes





                                                                                                                                                                                                              v=>Enumerable.Range(0,v--).Select(i=>Math.Pow(i+1,v--))


                                                                                                                                                                                                              Try it online!






                                                                                                                                                                                                              share|improve this answer

























                                                                                                                                                                                                                up vote
                                                                                                                                                                                                                1
                                                                                                                                                                                                                down vote














                                                                                                                                                                                                                C# (Visual C# Interactive Compiler), 55 bytes





                                                                                                                                                                                                                v=>Enumerable.Range(0,v--).Select(i=>Math.Pow(i+1,v--))


                                                                                                                                                                                                                Try it online!






                                                                                                                                                                                                                share|improve this answer























                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  1
                                                                                                                                                                                                                  down vote










                                                                                                                                                                                                                  up vote
                                                                                                                                                                                                                  1
                                                                                                                                                                                                                  down vote










                                                                                                                                                                                                                  C# (Visual C# Interactive Compiler), 55 bytes





                                                                                                                                                                                                                  v=>Enumerable.Range(0,v--).Select(i=>Math.Pow(i+1,v--))


                                                                                                                                                                                                                  Try it online!






                                                                                                                                                                                                                  share|improve this answer













                                                                                                                                                                                                                  C# (Visual C# Interactive Compiler), 55 bytes





                                                                                                                                                                                                                  v=>Enumerable.Range(0,v--).Select(i=>Math.Pow(i+1,v--))


                                                                                                                                                                                                                  Try it online!







                                                                                                                                                                                                                  share|improve this answer












                                                                                                                                                                                                                  share|improve this answer



                                                                                                                                                                                                                  share|improve this answer










                                                                                                                                                                                                                  answered 2 days ago









                                                                                                                                                                                                                  auhmaan

                                                                                                                                                                                                                  86637




                                                                                                                                                                                                                  86637






















                                                                                                                                                                                                                      up vote
                                                                                                                                                                                                                      1
                                                                                                                                                                                                                      down vote














                                                                                                                                                                                                                      Perl 5 -n, 21 bytes





                                                                                                                                                                                                                      say++$**--$_ while$_


                                                                                                                                                                                                                      Try it online!






                                                                                                                                                                                                                      share|improve this answer

























                                                                                                                                                                                                                        up vote
                                                                                                                                                                                                                        1
                                                                                                                                                                                                                        down vote














                                                                                                                                                                                                                        Perl 5 -n, 21 bytes





                                                                                                                                                                                                                        say++$**--$_ while$_


                                                                                                                                                                                                                        Try it online!






                                                                                                                                                                                                                        share|improve this answer























                                                                                                                                                                                                                          up vote
                                                                                                                                                                                                                          1
                                                                                                                                                                                                                          down vote










                                                                                                                                                                                                                          up vote
                                                                                                                                                                                                                          1
                                                                                                                                                                                                                          down vote










                                                                                                                                                                                                                          Perl 5 -n, 21 bytes





                                                                                                                                                                                                                          say++$**--$_ while$_


                                                                                                                                                                                                                          Try it online!






                                                                                                                                                                                                                          share|improve this answer













                                                                                                                                                                                                                          Perl 5 -n, 21 bytes





                                                                                                                                                                                                                          say++$**--$_ while$_


                                                                                                                                                                                                                          Try it online!







                                                                                                                                                                                                                          share|improve this answer












                                                                                                                                                                                                                          share|improve this answer



                                                                                                                                                                                                                          share|improve this answer










                                                                                                                                                                                                                          answered 2 days ago









                                                                                                                                                                                                                          Xcali

                                                                                                                                                                                                                          5,030520




                                                                                                                                                                                                                          5,030520






















                                                                                                                                                                                                                              1 2
                                                                                                                                                                                                                              next









                                                                                                                                                                                                                              Embodiment of Ignorance is a new contributor. Be nice, and check out our Code of Conduct.










                                                                                                                                                                                                                              draft saved

                                                                                                                                                                                                                              draft discarded


















                                                                                                                                                                                                                              Embodiment of Ignorance is a new contributor. Be nice, and check out our Code of Conduct.













                                                                                                                                                                                                                              Embodiment of Ignorance is a new contributor. Be nice, and check out our Code of Conduct.












                                                                                                                                                                                                                              Embodiment of Ignorance is a new contributor. Be nice, and check out our Code of Conduct.
















                                                                                                                                                                                                                              If this is an answer to a challenge…




                                                                                                                                                                                                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                                                                                                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                                                                                                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                                                                                                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                                                                                                                                              More generally…




                                                                                                                                                                                                                              • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                                                                                                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).






                                                                                                                                                                                                                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                                                                                                                                                                                              Please pay close attention to the following guidance:


                                                                                                                                                                                                                              • Please be sure to answer the question. Provide details and share your research!

                                                                                                                                                                                                                              But avoid



                                                                                                                                                                                                                              • Asking for help, clarification, or responding to other answers.

                                                                                                                                                                                                                              • Making statements based on opinion; back them up with references or personal experience.


                                                                                                                                                                                                                              To learn more, see our tips on writing great answers.




                                                                                                                                                                                                                              draft saved


                                                                                                                                                                                                                              draft discarded














                                                                                                                                                                                                                              StackExchange.ready(
                                                                                                                                                                                                                              function () {
                                                                                                                                                                                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f176666%2fgiven-an-input-print-all-exponents-where-the-base-and-power-sum-to-the-input%23new-answer', 'question_page');
                                                                                                                                                                                                                              }
                                                                                                                                                                                                                              );

                                                                                                                                                                                                                              Post as a guest















                                                                                                                                                                                                                              Required, but never shown





















































                                                                                                                                                                                                                              Required, but never shown














                                                                                                                                                                                                                              Required, but never shown












                                                                                                                                                                                                                              Required, but never shown







                                                                                                                                                                                                                              Required, but never shown

































                                                                                                                                                                                                                              Required, but never shown














                                                                                                                                                                                                                              Required, but never shown












                                                                                                                                                                                                                              Required, but never shown







                                                                                                                                                                                                                              Required, but never shown







                                                                                                                                                                                                                              Popular posts from this blog

                                                                                                                                                                                                                              "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                                                                                                                                                                                                              Alcedinidae

                                                                                                                                                                                                                              RAC Tourist Trophy