The Nth Gryphon Number Announcing the arrival of Valued Associate #679: Cesar Manara ...

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

How to run automated tests after each commit?

How to pronounce 伝統色

Can you explain what "processes and tools" means in the first Agile principle?

What is the meaning of 'breadth' in breadth first search?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

How were pictures turned from film to a big picture in a picture frame before digital scanning?

Amount of permutations on an NxNxN Rubik's Cube

Why can't I install Tomboy in Ubuntu Mate 19.04?

How to play a character with a disability or mental disorder without being offensive?

How to compare two different files line by line in unix?

What order were files/directories outputted in dir?

What happened to Thoros of Myr's flaming sword?

Proof of work - 51% attack

QGIS virtual layer functionality does not seem to support memory layers

Should there be a hyphen in the construction "IT affin"?

What is the home of drows in Flanaess?

How would a mousetrap for use in space work?

What initially awakened the Balrog?

Maximum summed subsequences with non-adjacent items

Why is it faster to reheat something than it is to cook it?

Antipodal Land Area Calculation

Is it fair for a professor to grade us on the possession of past papers?

Converted a Scalar function to a TVF function for parallel execution-Still running in Serial mode



The Nth Gryphon Number



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
The PPCG Site design is on its way - help us make it awesome!
Sandbox for Proposed ChallengesReturn the nth digit of the sequence of aliquot seriesOutput the nth rational number according to the Stern-Brocot sequenceNumbers divisible by the sum and product of their digitsDisplay OEIS sequencesLinear interpolation of the Fibonacci sequenceSwap the SequenceSeeking Secret Swapping SequencesCan even numbers become prime?Back to the Basics of MathX Steps Forward, 1 Step Back












3












$begingroup$


I came up with a series of numbers the other day and decided to check what the OEIS number for it was. Much to my surprise, the sequence did not appear to be in the OEIS database, so I decided to name the sequence after myself (note that someone else who's a lot smarter than me has probably already come up with this, and if someone finds the actual name of this sequence, please comment and I'll change the question title). As I couldn't find the sequence anywhere, I decided to name it after myself, hence "Gryphon Numbers".



A Gryphon number is a number of the form $a+a^2+...+a^x$, where both $a$ and $x$ are integers greater than or equal to two, and the Gryphon sequence is the set of all Gryphon numbers in ascending order. If there are multiple ways of forming a Gryphon number (the first example is $30$, which is both $2+2^2+2^3+2^4$ and $5+5^2$) the number is only counted once in the sequence. The first few Gryphon numbers are: $6, 12, 14, 20, 30, 39, 42, 56, 62, 72$.



Your Task:



Write a program or function that receives an integer $n$ as input and outputs the $n$th Gryphon number.



Input:



An integer between 0 and 10000 (inclusive). You may treat the sequence as either 0-indexed or 1-indexed, whichever you prefer. Please state which indexing system you use in your answer to avoid confusion.



Output:



The Gryphon number corresponding to the input.



Test Cases:



Please note that this assumes the sequence is 0-indexed. If your program assumes a 1-indexed sequence, don't forget to increment all the input numbers.



Input:    Output:
0 ---> 6
3 ---> 20
4 ---> 30
10 ---> 84


Scoring:



This is code-golf, so the lowest score in bytes wins.










share|improve this question











$endgroup$








  • 2




    $begingroup$
    How about bigger test cases like 2000 or 10000?
    $endgroup$
    – J42161217
    1 hour ago
















3












$begingroup$


I came up with a series of numbers the other day and decided to check what the OEIS number for it was. Much to my surprise, the sequence did not appear to be in the OEIS database, so I decided to name the sequence after myself (note that someone else who's a lot smarter than me has probably already come up with this, and if someone finds the actual name of this sequence, please comment and I'll change the question title). As I couldn't find the sequence anywhere, I decided to name it after myself, hence "Gryphon Numbers".



A Gryphon number is a number of the form $a+a^2+...+a^x$, where both $a$ and $x$ are integers greater than or equal to two, and the Gryphon sequence is the set of all Gryphon numbers in ascending order. If there are multiple ways of forming a Gryphon number (the first example is $30$, which is both $2+2^2+2^3+2^4$ and $5+5^2$) the number is only counted once in the sequence. The first few Gryphon numbers are: $6, 12, 14, 20, 30, 39, 42, 56, 62, 72$.



Your Task:



Write a program or function that receives an integer $n$ as input and outputs the $n$th Gryphon number.



Input:



An integer between 0 and 10000 (inclusive). You may treat the sequence as either 0-indexed or 1-indexed, whichever you prefer. Please state which indexing system you use in your answer to avoid confusion.



Output:



The Gryphon number corresponding to the input.



Test Cases:



Please note that this assumes the sequence is 0-indexed. If your program assumes a 1-indexed sequence, don't forget to increment all the input numbers.



Input:    Output:
0 ---> 6
3 ---> 20
4 ---> 30
10 ---> 84


Scoring:



This is code-golf, so the lowest score in bytes wins.










share|improve this question











$endgroup$








  • 2




    $begingroup$
    How about bigger test cases like 2000 or 10000?
    $endgroup$
    – J42161217
    1 hour ago














3












3








3





$begingroup$


I came up with a series of numbers the other day and decided to check what the OEIS number for it was. Much to my surprise, the sequence did not appear to be in the OEIS database, so I decided to name the sequence after myself (note that someone else who's a lot smarter than me has probably already come up with this, and if someone finds the actual name of this sequence, please comment and I'll change the question title). As I couldn't find the sequence anywhere, I decided to name it after myself, hence "Gryphon Numbers".



A Gryphon number is a number of the form $a+a^2+...+a^x$, where both $a$ and $x$ are integers greater than or equal to two, and the Gryphon sequence is the set of all Gryphon numbers in ascending order. If there are multiple ways of forming a Gryphon number (the first example is $30$, which is both $2+2^2+2^3+2^4$ and $5+5^2$) the number is only counted once in the sequence. The first few Gryphon numbers are: $6, 12, 14, 20, 30, 39, 42, 56, 62, 72$.



Your Task:



Write a program or function that receives an integer $n$ as input and outputs the $n$th Gryphon number.



Input:



An integer between 0 and 10000 (inclusive). You may treat the sequence as either 0-indexed or 1-indexed, whichever you prefer. Please state which indexing system you use in your answer to avoid confusion.



Output:



The Gryphon number corresponding to the input.



Test Cases:



Please note that this assumes the sequence is 0-indexed. If your program assumes a 1-indexed sequence, don't forget to increment all the input numbers.



Input:    Output:
0 ---> 6
3 ---> 20
4 ---> 30
10 ---> 84


Scoring:



This is code-golf, so the lowest score in bytes wins.










share|improve this question











$endgroup$




I came up with a series of numbers the other day and decided to check what the OEIS number for it was. Much to my surprise, the sequence did not appear to be in the OEIS database, so I decided to name the sequence after myself (note that someone else who's a lot smarter than me has probably already come up with this, and if someone finds the actual name of this sequence, please comment and I'll change the question title). As I couldn't find the sequence anywhere, I decided to name it after myself, hence "Gryphon Numbers".



A Gryphon number is a number of the form $a+a^2+...+a^x$, where both $a$ and $x$ are integers greater than or equal to two, and the Gryphon sequence is the set of all Gryphon numbers in ascending order. If there are multiple ways of forming a Gryphon number (the first example is $30$, which is both $2+2^2+2^3+2^4$ and $5+5^2$) the number is only counted once in the sequence. The first few Gryphon numbers are: $6, 12, 14, 20, 30, 39, 42, 56, 62, 72$.



Your Task:



Write a program or function that receives an integer $n$ as input and outputs the $n$th Gryphon number.



Input:



An integer between 0 and 10000 (inclusive). You may treat the sequence as either 0-indexed or 1-indexed, whichever you prefer. Please state which indexing system you use in your answer to avoid confusion.



Output:



The Gryphon number corresponding to the input.



Test Cases:



Please note that this assumes the sequence is 0-indexed. If your program assumes a 1-indexed sequence, don't forget to increment all the input numbers.



Input:    Output:
0 ---> 6
3 ---> 20
4 ---> 30
10 ---> 84


Scoring:



This is code-golf, so the lowest score in bytes wins.







code-golf sequence






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 42 mins ago









Giuseppe

17.9k31155




17.9k31155










asked 1 hour ago









GryphonGryphon

3,55412165




3,55412165








  • 2




    $begingroup$
    How about bigger test cases like 2000 or 10000?
    $endgroup$
    – J42161217
    1 hour ago














  • 2




    $begingroup$
    How about bigger test cases like 2000 or 10000?
    $endgroup$
    – J42161217
    1 hour ago








2




2




$begingroup$
How about bigger test cases like 2000 or 10000?
$endgroup$
– J42161217
1 hour ago




$begingroup$
How about bigger test cases like 2000 or 10000?
$endgroup$
– J42161217
1 hour ago










3 Answers
3






active

oldest

votes


















2












$begingroup$


MATL, 16 13 bytes



:Qtt!^Ys+uSG)


1-based.



Try it online!



Explanation



Consider input n = 3 as an example.



:    % Implicit input: n. Range
% STACK: [1 2 3]
Q % Add 1, element-wise
% STACK: [2 3 4]
tt % Duplicate twice, transpose
% STACK: [2 3 4], [2 3 4], [2;
3;
4]
^ % Power, element-wise with broadcast
% STACK: [2 3 4], [ 4 9 16;
8 27 64;
16 81 256]
Ys % Cumulative sum of each column
% STACK: [2 3 4], [ 4 9 16;
12 36 80;
28 117 336]
+ % Add, element-wise with broadcast
% STACK: [ 6 12 20;
14 39 84
30 120 340]
u % Unique elements. Gives a column vector
% STACK: [ 6;
14;
30;
12;
···
340]
S % Sort
% STACK: [ 6;
12
14;
20;
···
340]
G) % Push input again, index. This gets the n-th element. Implicit display
% STACK: 14





share|improve this answer











$endgroup$









  • 1




    $begingroup$
    What the hell, this is amazing!
    $endgroup$
    – IQuick 143
    39 mins ago



















0












$begingroup$


Wolfram Language (Mathematica), 59 bytes



Union[Join@@Table[Sum[n^k,{k,j}],{j,2,30},{n,2,7!2}]][[#]]&


Try it online!



1-indexed






share|improve this answer









$endgroup$





















    0












    $begingroup$


    Jelly, 9 bytes



    bṖ’ḅi-µ#Ṫ


    A full program which reads a (1-indexed) integer from STDIN and prints the result.



    Try it online!





    share









    $endgroup$














      Your Answer






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


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f183491%2fthe-nth-gryphon-number%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2












      $begingroup$


      MATL, 16 13 bytes



      :Qtt!^Ys+uSG)


      1-based.



      Try it online!



      Explanation



      Consider input n = 3 as an example.



      :    % Implicit input: n. Range
      % STACK: [1 2 3]
      Q % Add 1, element-wise
      % STACK: [2 3 4]
      tt % Duplicate twice, transpose
      % STACK: [2 3 4], [2 3 4], [2;
      3;
      4]
      ^ % Power, element-wise with broadcast
      % STACK: [2 3 4], [ 4 9 16;
      8 27 64;
      16 81 256]
      Ys % Cumulative sum of each column
      % STACK: [2 3 4], [ 4 9 16;
      12 36 80;
      28 117 336]
      + % Add, element-wise with broadcast
      % STACK: [ 6 12 20;
      14 39 84
      30 120 340]
      u % Unique elements. Gives a column vector
      % STACK: [ 6;
      14;
      30;
      12;
      ···
      340]
      S % Sort
      % STACK: [ 6;
      12
      14;
      20;
      ···
      340]
      G) % Push input again, index. This gets the n-th element. Implicit display
      % STACK: 14





      share|improve this answer











      $endgroup$









      • 1




        $begingroup$
        What the hell, this is amazing!
        $endgroup$
        – IQuick 143
        39 mins ago
















      2












      $begingroup$


      MATL, 16 13 bytes



      :Qtt!^Ys+uSG)


      1-based.



      Try it online!



      Explanation



      Consider input n = 3 as an example.



      :    % Implicit input: n. Range
      % STACK: [1 2 3]
      Q % Add 1, element-wise
      % STACK: [2 3 4]
      tt % Duplicate twice, transpose
      % STACK: [2 3 4], [2 3 4], [2;
      3;
      4]
      ^ % Power, element-wise with broadcast
      % STACK: [2 3 4], [ 4 9 16;
      8 27 64;
      16 81 256]
      Ys % Cumulative sum of each column
      % STACK: [2 3 4], [ 4 9 16;
      12 36 80;
      28 117 336]
      + % Add, element-wise with broadcast
      % STACK: [ 6 12 20;
      14 39 84
      30 120 340]
      u % Unique elements. Gives a column vector
      % STACK: [ 6;
      14;
      30;
      12;
      ···
      340]
      S % Sort
      % STACK: [ 6;
      12
      14;
      20;
      ···
      340]
      G) % Push input again, index. This gets the n-th element. Implicit display
      % STACK: 14





      share|improve this answer











      $endgroup$









      • 1




        $begingroup$
        What the hell, this is amazing!
        $endgroup$
        – IQuick 143
        39 mins ago














      2












      2








      2





      $begingroup$


      MATL, 16 13 bytes



      :Qtt!^Ys+uSG)


      1-based.



      Try it online!



      Explanation



      Consider input n = 3 as an example.



      :    % Implicit input: n. Range
      % STACK: [1 2 3]
      Q % Add 1, element-wise
      % STACK: [2 3 4]
      tt % Duplicate twice, transpose
      % STACK: [2 3 4], [2 3 4], [2;
      3;
      4]
      ^ % Power, element-wise with broadcast
      % STACK: [2 3 4], [ 4 9 16;
      8 27 64;
      16 81 256]
      Ys % Cumulative sum of each column
      % STACK: [2 3 4], [ 4 9 16;
      12 36 80;
      28 117 336]
      + % Add, element-wise with broadcast
      % STACK: [ 6 12 20;
      14 39 84
      30 120 340]
      u % Unique elements. Gives a column vector
      % STACK: [ 6;
      14;
      30;
      12;
      ···
      340]
      S % Sort
      % STACK: [ 6;
      12
      14;
      20;
      ···
      340]
      G) % Push input again, index. This gets the n-th element. Implicit display
      % STACK: 14





      share|improve this answer











      $endgroup$




      MATL, 16 13 bytes



      :Qtt!^Ys+uSG)


      1-based.



      Try it online!



      Explanation



      Consider input n = 3 as an example.



      :    % Implicit input: n. Range
      % STACK: [1 2 3]
      Q % Add 1, element-wise
      % STACK: [2 3 4]
      tt % Duplicate twice, transpose
      % STACK: [2 3 4], [2 3 4], [2;
      3;
      4]
      ^ % Power, element-wise with broadcast
      % STACK: [2 3 4], [ 4 9 16;
      8 27 64;
      16 81 256]
      Ys % Cumulative sum of each column
      % STACK: [2 3 4], [ 4 9 16;
      12 36 80;
      28 117 336]
      + % Add, element-wise with broadcast
      % STACK: [ 6 12 20;
      14 39 84
      30 120 340]
      u % Unique elements. Gives a column vector
      % STACK: [ 6;
      14;
      30;
      12;
      ···
      340]
      S % Sort
      % STACK: [ 6;
      12
      14;
      20;
      ···
      340]
      G) % Push input again, index. This gets the n-th element. Implicit display
      % STACK: 14






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 45 mins ago

























      answered 56 mins ago









      Luis MendoLuis Mendo

      75.4k889293




      75.4k889293








      • 1




        $begingroup$
        What the hell, this is amazing!
        $endgroup$
        – IQuick 143
        39 mins ago














      • 1




        $begingroup$
        What the hell, this is amazing!
        $endgroup$
        – IQuick 143
        39 mins ago








      1




      1




      $begingroup$
      What the hell, this is amazing!
      $endgroup$
      – IQuick 143
      39 mins ago




      $begingroup$
      What the hell, this is amazing!
      $endgroup$
      – IQuick 143
      39 mins ago











      0












      $begingroup$


      Wolfram Language (Mathematica), 59 bytes



      Union[Join@@Table[Sum[n^k,{k,j}],{j,2,30},{n,2,7!2}]][[#]]&


      Try it online!



      1-indexed






      share|improve this answer









      $endgroup$


















        0












        $begingroup$


        Wolfram Language (Mathematica), 59 bytes



        Union[Join@@Table[Sum[n^k,{k,j}],{j,2,30},{n,2,7!2}]][[#]]&


        Try it online!



        1-indexed






        share|improve this answer









        $endgroup$
















          0












          0








          0





          $begingroup$


          Wolfram Language (Mathematica), 59 bytes



          Union[Join@@Table[Sum[n^k,{k,j}],{j,2,30},{n,2,7!2}]][[#]]&


          Try it online!



          1-indexed






          share|improve this answer









          $endgroup$




          Wolfram Language (Mathematica), 59 bytes



          Union[Join@@Table[Sum[n^k,{k,j}],{j,2,30},{n,2,7!2}]][[#]]&


          Try it online!



          1-indexed







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 43 mins ago









          J42161217J42161217

          14.2k21353




          14.2k21353























              0












              $begingroup$


              Jelly, 9 bytes



              bṖ’ḅi-µ#Ṫ


              A full program which reads a (1-indexed) integer from STDIN and prints the result.



              Try it online!





              share









              $endgroup$


















                0












                $begingroup$


                Jelly, 9 bytes



                bṖ’ḅi-µ#Ṫ


                A full program which reads a (1-indexed) integer from STDIN and prints the result.



                Try it online!





                share









                $endgroup$
















                  0












                  0








                  0





                  $begingroup$


                  Jelly, 9 bytes



                  bṖ’ḅi-µ#Ṫ


                  A full program which reads a (1-indexed) integer from STDIN and prints the result.



                  Try it online!





                  share









                  $endgroup$




                  Jelly, 9 bytes



                  bṖ’ḅi-µ#Ṫ


                  A full program which reads a (1-indexed) integer from STDIN and prints the result.



                  Try it online!






                  share











                  share


                  share










                  answered 8 mins ago









                  Jonathan AllanJonathan Allan

                  54.5k537174




                  54.5k537174






























                      draft saved

                      draft discarded




















































                      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).





                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f183491%2fthe-nth-gryphon-number%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

                      ORA-01691 (unable to extend lob segment) even though my tablespace has AUTOEXTEND onORA-01692: unable to...

                      Always On Availability groups resolving state after failover - Remote harden of transaction...

                      Circunscripción electoral de Guipúzcoa Referencias Menú de navegaciónLas claves del sistema electoral en...