Using two linked programs, output ordinal numbers up to nOutputting ordinal numbers (1st, 2nd, 3rd)Output the first 200 primes using TeXMultiply two numbers without using any numbersHow many letters in this word?Integer goes back and forth through timeMultiply two numbersFind the numbers and calculate outputOutput this sequence of numbersCollatz's First ConjectureNumber letter countsThe Highest Dice

How can I tell if there was a power cut when I was out?

Are rockets faster than airplanes?

How to repair basic cable/wire issue for household appliances

What is "ass door"?

Are symplectomorphisms of Weil–Petersson symplectic form induced from surface diffeomorphisms?

What's the explanation for this joke about a three-legged dog that walks into a bar?

What exactly makes a General Products hull nearly indestructible?

Why can't a country print its own money to spend it only abroad?

Why are MEMS in QFN packages?

What kind of world would drive brains to evolve high-throughput sensory?

Idioms: Should it be " the internet is a seemingly infinite well of information" or "the internet is a seemingly infinite wealth of information"

Who controls a summoned steed’s familiar?

High income and difficulty during interviews

How can I deal with someone that wants to kill something that isn't supposed to be killed?

Why does the salt in the oceans not sink to the bottom?

How important is a good quality camera for good photography?

what to say when a company asks you why someone (a friend) who was fired left?

What was the rationale behind 36 bit computer architectures?

Why is a dedicated QA team member necessary?

Sextortion with actual password not found in leaks

dos2unix is unable to convert typescript file to unix format

Bug in Lualatex: not printing characters from calculation

Are gangsters hired to attack people at a train station classified as a terrorist attack?

Is it okay to paraphrase other authors' literature reviews?



Using two linked programs, output ordinal numbers up to n


Outputting ordinal numbers (1st, 2nd, 3rd)Output the first 200 primes using TeXMultiply two numbers without using any numbersHow many letters in this word?Integer goes back and forth through timeMultiply two numbersFind the numbers and calculate outputOutput this sequence of numbersCollatz's First ConjectureNumber letter countsThe Highest Dice






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








19












$begingroup$



...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order.




enter image description here



From Wikipedia.



Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed to 2nd.



The challenge of ordinal numbers has been brought up before, particularly in this entry. In this challenge, ordinals are merely a vehicle to facilitate the unique conditions detailed below.




Part 1



You must make a program that, when given the input of n must output anything.
n will always be a positive, non-zero integer no larger than 999.



Valid output includes but is not limited to:



  • Any output to stdout / stderr / etc

  • Creation of files / folders / etc

  • A graphical interface or images of any kind

Anything goes.




Part 2



You must make a program that uses the output of part 1's program to output a sequence of ordinal numbers, starting from 1 (first), up to whatever n was parsed in part 1.



General Conditions:



  • The total bytes for part 2 must not exceed the total bytes for part 1 (less than or equal to).

Output conditions:



  • Not case sensitive.

  • Output must contain only the ordinal sequence (only characters a-Z) and whitespace (newlines allowed).

  • Can be output to any source, so long as it is visible either during or after execution.

  • Program does not need to terminate so long as its output is correct.

  • Output is not required to have any grammar, but may optionally include it (hyphens, commas, "ands", etc). nine hundred ninety ninth is just as acceptable as nine hundred and ninety-ninth.

Sample Output



Where n is 8



FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH



Scoring



The hierarchy of win conditions is:




  1. The lowest number of bytes in part 1

  2. The lowest number of bytes in part 2



Entry #1 | Part 1 = 32 bytes, Part 2 = 22 bytes
Entry #2 | Part 1 = 31 bytes, part 2 = 30 bytes

Entry #2 wins - Part 1 contains 31 bytes vs 32 bytes

---

Entry #1 | Part 1 = 21 bytes, Part 2 = 33 bytes
Entry #2 | Part 1 = 80 bytes, Part 2 = 70 bytes

Entry #2 wins - Entry #1 disqualified (Part 2 contains more bytes than Part 1)

---

Entry #1 | Part 1 = 50 bytes, Part 2 = 49 bytes
Entry #2 | Part 1 = 50 bytes, Part 2 = 50 bytes

Entry #1 wins - Part 1 is equal, Part 2 contains 49 bytes vs 50 bytes









share|improve this question











$endgroup$







  • 5




    $begingroup$
    What's the point in part 1 (as in, why couldn't this challenge just be scored on shortest submission for part 2)? Also, in your second scoring example, isn't the first entry invalid (part 2 > part 1), and if not, wouldn't it beat the second entry? Also, I recommend having at least a link to a formal ruleset for defining ordinals; for example, is 111 supposed to say one hundred and eleventh or one hundred eleventh?
    $endgroup$
    – HyperNeutrino
    Jul 15 at 1:02






  • 3




    $begingroup$
    @HyperNeutrino I think the idea is to try to split the work between the two as evenly as possible while golfing -- if I make p1 output [30, 'second'] for 32 then p2 has less work to do that if it had output, just 32.
    $endgroup$
    – Jonathan Allan
    Jul 15 at 1:09






  • 4




    $begingroup$
    Maybe I'm missing something stupid, but of the last two entries in the scoring examples, why doesn't entry 1 win? part 1 has same bytes, part 2 is less than or equal to part 1 for both, and entry 1 part 2 has less bytes than entry 2 part 2.
    $endgroup$
    – Patrick Roberts
    Jul 15 at 9:02










  • $begingroup$
    @PatrickRoberts Because Part 2 must contain equal or fewer bytes to Part 1. Since Part 1 is 21 bytes, but Part 2 is 33 bytes, Entry #1 is disqualified. Unfortunately, that information is tucked away and not explicitly stated in the win conditions at the moment.
    $endgroup$
    – Chronocidal
    Jul 15 at 11:38











  • $begingroup$
    @PatrickRoberts This is important, because otherwise you could use a language that implicitly passes input as output when a 0 byte program is run for Part 1
    $endgroup$
    – Chronocidal
    Jul 15 at 11:43

















19












$begingroup$



...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order.




enter image description here



From Wikipedia.



Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed to 2nd.



The challenge of ordinal numbers has been brought up before, particularly in this entry. In this challenge, ordinals are merely a vehicle to facilitate the unique conditions detailed below.




Part 1



You must make a program that, when given the input of n must output anything.
n will always be a positive, non-zero integer no larger than 999.



Valid output includes but is not limited to:



  • Any output to stdout / stderr / etc

  • Creation of files / folders / etc

  • A graphical interface or images of any kind

Anything goes.




Part 2



You must make a program that uses the output of part 1's program to output a sequence of ordinal numbers, starting from 1 (first), up to whatever n was parsed in part 1.



General Conditions:



  • The total bytes for part 2 must not exceed the total bytes for part 1 (less than or equal to).

Output conditions:



  • Not case sensitive.

  • Output must contain only the ordinal sequence (only characters a-Z) and whitespace (newlines allowed).

  • Can be output to any source, so long as it is visible either during or after execution.

  • Program does not need to terminate so long as its output is correct.

  • Output is not required to have any grammar, but may optionally include it (hyphens, commas, "ands", etc). nine hundred ninety ninth is just as acceptable as nine hundred and ninety-ninth.

Sample Output



Where n is 8



FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH



Scoring



The hierarchy of win conditions is:




  1. The lowest number of bytes in part 1

  2. The lowest number of bytes in part 2



Entry #1 | Part 1 = 32 bytes, Part 2 = 22 bytes
Entry #2 | Part 1 = 31 bytes, part 2 = 30 bytes

Entry #2 wins - Part 1 contains 31 bytes vs 32 bytes

---

Entry #1 | Part 1 = 21 bytes, Part 2 = 33 bytes
Entry #2 | Part 1 = 80 bytes, Part 2 = 70 bytes

Entry #2 wins - Entry #1 disqualified (Part 2 contains more bytes than Part 1)

---

Entry #1 | Part 1 = 50 bytes, Part 2 = 49 bytes
Entry #2 | Part 1 = 50 bytes, Part 2 = 50 bytes

Entry #1 wins - Part 1 is equal, Part 2 contains 49 bytes vs 50 bytes









share|improve this question











$endgroup$







  • 5




    $begingroup$
    What's the point in part 1 (as in, why couldn't this challenge just be scored on shortest submission for part 2)? Also, in your second scoring example, isn't the first entry invalid (part 2 > part 1), and if not, wouldn't it beat the second entry? Also, I recommend having at least a link to a formal ruleset for defining ordinals; for example, is 111 supposed to say one hundred and eleventh or one hundred eleventh?
    $endgroup$
    – HyperNeutrino
    Jul 15 at 1:02






  • 3




    $begingroup$
    @HyperNeutrino I think the idea is to try to split the work between the two as evenly as possible while golfing -- if I make p1 output [30, 'second'] for 32 then p2 has less work to do that if it had output, just 32.
    $endgroup$
    – Jonathan Allan
    Jul 15 at 1:09






  • 4




    $begingroup$
    Maybe I'm missing something stupid, but of the last two entries in the scoring examples, why doesn't entry 1 win? part 1 has same bytes, part 2 is less than or equal to part 1 for both, and entry 1 part 2 has less bytes than entry 2 part 2.
    $endgroup$
    – Patrick Roberts
    Jul 15 at 9:02










  • $begingroup$
    @PatrickRoberts Because Part 2 must contain equal or fewer bytes to Part 1. Since Part 1 is 21 bytes, but Part 2 is 33 bytes, Entry #1 is disqualified. Unfortunately, that information is tucked away and not explicitly stated in the win conditions at the moment.
    $endgroup$
    – Chronocidal
    Jul 15 at 11:38











  • $begingroup$
    @PatrickRoberts This is important, because otherwise you could use a language that implicitly passes input as output when a 0 byte program is run for Part 1
    $endgroup$
    – Chronocidal
    Jul 15 at 11:43













19












19








19


2



$begingroup$



...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order.




enter image description here



From Wikipedia.



Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed to 2nd.



The challenge of ordinal numbers has been brought up before, particularly in this entry. In this challenge, ordinals are merely a vehicle to facilitate the unique conditions detailed below.




Part 1



You must make a program that, when given the input of n must output anything.
n will always be a positive, non-zero integer no larger than 999.



Valid output includes but is not limited to:



  • Any output to stdout / stderr / etc

  • Creation of files / folders / etc

  • A graphical interface or images of any kind

Anything goes.




Part 2



You must make a program that uses the output of part 1's program to output a sequence of ordinal numbers, starting from 1 (first), up to whatever n was parsed in part 1.



General Conditions:



  • The total bytes for part 2 must not exceed the total bytes for part 1 (less than or equal to).

Output conditions:



  • Not case sensitive.

  • Output must contain only the ordinal sequence (only characters a-Z) and whitespace (newlines allowed).

  • Can be output to any source, so long as it is visible either during or after execution.

  • Program does not need to terminate so long as its output is correct.

  • Output is not required to have any grammar, but may optionally include it (hyphens, commas, "ands", etc). nine hundred ninety ninth is just as acceptable as nine hundred and ninety-ninth.

Sample Output



Where n is 8



FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH



Scoring



The hierarchy of win conditions is:




  1. The lowest number of bytes in part 1

  2. The lowest number of bytes in part 2



Entry #1 | Part 1 = 32 bytes, Part 2 = 22 bytes
Entry #2 | Part 1 = 31 bytes, part 2 = 30 bytes

Entry #2 wins - Part 1 contains 31 bytes vs 32 bytes

---

Entry #1 | Part 1 = 21 bytes, Part 2 = 33 bytes
Entry #2 | Part 1 = 80 bytes, Part 2 = 70 bytes

Entry #2 wins - Entry #1 disqualified (Part 2 contains more bytes than Part 1)

---

Entry #1 | Part 1 = 50 bytes, Part 2 = 49 bytes
Entry #2 | Part 1 = 50 bytes, Part 2 = 50 bytes

Entry #1 wins - Part 1 is equal, Part 2 contains 49 bytes vs 50 bytes









share|improve this question











$endgroup$





...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order.




enter image description here



From Wikipedia.



Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed to 2nd.



The challenge of ordinal numbers has been brought up before, particularly in this entry. In this challenge, ordinals are merely a vehicle to facilitate the unique conditions detailed below.




Part 1



You must make a program that, when given the input of n must output anything.
n will always be a positive, non-zero integer no larger than 999.



Valid output includes but is not limited to:



  • Any output to stdout / stderr / etc

  • Creation of files / folders / etc

  • A graphical interface or images of any kind

Anything goes.




Part 2



You must make a program that uses the output of part 1's program to output a sequence of ordinal numbers, starting from 1 (first), up to whatever n was parsed in part 1.



General Conditions:



  • The total bytes for part 2 must not exceed the total bytes for part 1 (less than or equal to).

Output conditions:



  • Not case sensitive.

  • Output must contain only the ordinal sequence (only characters a-Z) and whitespace (newlines allowed).

  • Can be output to any source, so long as it is visible either during or after execution.

  • Program does not need to terminate so long as its output is correct.

  • Output is not required to have any grammar, but may optionally include it (hyphens, commas, "ands", etc). nine hundred ninety ninth is just as acceptable as nine hundred and ninety-ninth.

Sample Output



Where n is 8



FIRST SECOND THIRD FOURTH FIFTH SIXTH SEVENTH EIGHTH



Scoring



The hierarchy of win conditions is:




  1. The lowest number of bytes in part 1

  2. The lowest number of bytes in part 2



Entry #1 | Part 1 = 32 bytes, Part 2 = 22 bytes
Entry #2 | Part 1 = 31 bytes, part 2 = 30 bytes

Entry #2 wins - Part 1 contains 31 bytes vs 32 bytes

---

Entry #1 | Part 1 = 21 bytes, Part 2 = 33 bytes
Entry #2 | Part 1 = 80 bytes, Part 2 = 70 bytes

Entry #2 wins - Entry #1 disqualified (Part 2 contains more bytes than Part 1)

---

Entry #1 | Part 1 = 50 bytes, Part 2 = 49 bytes
Entry #2 | Part 1 = 50 bytes, Part 2 = 50 bytes

Entry #1 wins - Part 1 is equal, Part 2 contains 49 bytes vs 50 bytes






code-golf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 15 at 13:24









Chronocidal

5211 silver badge4 bronze badges




5211 silver badge4 bronze badges










asked Jul 15 at 0:34









BDMBDM

2648 bronze badges




2648 bronze badges







  • 5




    $begingroup$
    What's the point in part 1 (as in, why couldn't this challenge just be scored on shortest submission for part 2)? Also, in your second scoring example, isn't the first entry invalid (part 2 > part 1), and if not, wouldn't it beat the second entry? Also, I recommend having at least a link to a formal ruleset for defining ordinals; for example, is 111 supposed to say one hundred and eleventh or one hundred eleventh?
    $endgroup$
    – HyperNeutrino
    Jul 15 at 1:02






  • 3




    $begingroup$
    @HyperNeutrino I think the idea is to try to split the work between the two as evenly as possible while golfing -- if I make p1 output [30, 'second'] for 32 then p2 has less work to do that if it had output, just 32.
    $endgroup$
    – Jonathan Allan
    Jul 15 at 1:09






  • 4




    $begingroup$
    Maybe I'm missing something stupid, but of the last two entries in the scoring examples, why doesn't entry 1 win? part 1 has same bytes, part 2 is less than or equal to part 1 for both, and entry 1 part 2 has less bytes than entry 2 part 2.
    $endgroup$
    – Patrick Roberts
    Jul 15 at 9:02










  • $begingroup$
    @PatrickRoberts Because Part 2 must contain equal or fewer bytes to Part 1. Since Part 1 is 21 bytes, but Part 2 is 33 bytes, Entry #1 is disqualified. Unfortunately, that information is tucked away and not explicitly stated in the win conditions at the moment.
    $endgroup$
    – Chronocidal
    Jul 15 at 11:38











  • $begingroup$
    @PatrickRoberts This is important, because otherwise you could use a language that implicitly passes input as output when a 0 byte program is run for Part 1
    $endgroup$
    – Chronocidal
    Jul 15 at 11:43












  • 5




    $begingroup$
    What's the point in part 1 (as in, why couldn't this challenge just be scored on shortest submission for part 2)? Also, in your second scoring example, isn't the first entry invalid (part 2 > part 1), and if not, wouldn't it beat the second entry? Also, I recommend having at least a link to a formal ruleset for defining ordinals; for example, is 111 supposed to say one hundred and eleventh or one hundred eleventh?
    $endgroup$
    – HyperNeutrino
    Jul 15 at 1:02






  • 3




    $begingroup$
    @HyperNeutrino I think the idea is to try to split the work between the two as evenly as possible while golfing -- if I make p1 output [30, 'second'] for 32 then p2 has less work to do that if it had output, just 32.
    $endgroup$
    – Jonathan Allan
    Jul 15 at 1:09






  • 4




    $begingroup$
    Maybe I'm missing something stupid, but of the last two entries in the scoring examples, why doesn't entry 1 win? part 1 has same bytes, part 2 is less than or equal to part 1 for both, and entry 1 part 2 has less bytes than entry 2 part 2.
    $endgroup$
    – Patrick Roberts
    Jul 15 at 9:02










  • $begingroup$
    @PatrickRoberts Because Part 2 must contain equal or fewer bytes to Part 1. Since Part 1 is 21 bytes, but Part 2 is 33 bytes, Entry #1 is disqualified. Unfortunately, that information is tucked away and not explicitly stated in the win conditions at the moment.
    $endgroup$
    – Chronocidal
    Jul 15 at 11:38











  • $begingroup$
    @PatrickRoberts This is important, because otherwise you could use a language that implicitly passes input as output when a 0 byte program is run for Part 1
    $endgroup$
    – Chronocidal
    Jul 15 at 11:43







5




5




$begingroup$
What's the point in part 1 (as in, why couldn't this challenge just be scored on shortest submission for part 2)? Also, in your second scoring example, isn't the first entry invalid (part 2 > part 1), and if not, wouldn't it beat the second entry? Also, I recommend having at least a link to a formal ruleset for defining ordinals; for example, is 111 supposed to say one hundred and eleventh or one hundred eleventh?
$endgroup$
– HyperNeutrino
Jul 15 at 1:02




$begingroup$
What's the point in part 1 (as in, why couldn't this challenge just be scored on shortest submission for part 2)? Also, in your second scoring example, isn't the first entry invalid (part 2 > part 1), and if not, wouldn't it beat the second entry? Also, I recommend having at least a link to a formal ruleset for defining ordinals; for example, is 111 supposed to say one hundred and eleventh or one hundred eleventh?
$endgroup$
– HyperNeutrino
Jul 15 at 1:02




3




3




$begingroup$
@HyperNeutrino I think the idea is to try to split the work between the two as evenly as possible while golfing -- if I make p1 output [30, 'second'] for 32 then p2 has less work to do that if it had output, just 32.
$endgroup$
– Jonathan Allan
Jul 15 at 1:09




$begingroup$
@HyperNeutrino I think the idea is to try to split the work between the two as evenly as possible while golfing -- if I make p1 output [30, 'second'] for 32 then p2 has less work to do that if it had output, just 32.
$endgroup$
– Jonathan Allan
Jul 15 at 1:09




4




4




$begingroup$
Maybe I'm missing something stupid, but of the last two entries in the scoring examples, why doesn't entry 1 win? part 1 has same bytes, part 2 is less than or equal to part 1 for both, and entry 1 part 2 has less bytes than entry 2 part 2.
$endgroup$
– Patrick Roberts
Jul 15 at 9:02




$begingroup$
Maybe I'm missing something stupid, but of the last two entries in the scoring examples, why doesn't entry 1 win? part 1 has same bytes, part 2 is less than or equal to part 1 for both, and entry 1 part 2 has less bytes than entry 2 part 2.
$endgroup$
– Patrick Roberts
Jul 15 at 9:02












$begingroup$
@PatrickRoberts Because Part 2 must contain equal or fewer bytes to Part 1. Since Part 1 is 21 bytes, but Part 2 is 33 bytes, Entry #1 is disqualified. Unfortunately, that information is tucked away and not explicitly stated in the win conditions at the moment.
$endgroup$
– Chronocidal
Jul 15 at 11:38





$begingroup$
@PatrickRoberts Because Part 2 must contain equal or fewer bytes to Part 1. Since Part 1 is 21 bytes, but Part 2 is 33 bytes, Entry #1 is disqualified. Unfortunately, that information is tucked away and not explicitly stated in the win conditions at the moment.
$endgroup$
– Chronocidal
Jul 15 at 11:38













$begingroup$
@PatrickRoberts This is important, because otherwise you could use a language that implicitly passes input as output when a 0 byte program is run for Part 1
$endgroup$
– Chronocidal
Jul 15 at 11:43




$begingroup$
@PatrickRoberts This is important, because otherwise you could use a language that implicitly passes input as output when a 0 byte program is run for Part 1
$endgroup$
– Chronocidal
Jul 15 at 11:43










6 Answers
6






active

oldest

votes


















13












$begingroup$


Sledgehammer 0.5.1 / Sledgehammer 0.5.1, 10 bytes



Program 1 (10 bytes):



⣘⢷⠾⣃⢖⣎⢅⡨⠱⢳


Decompresses into this Wolfram Language function:



Range[#1], "Ordinal" &


Program 2 (7 bytes):



⡾⡁⢚⣷⣬⠤⣾


Decompresses into this Wolfram Language function:



StringRiffle[IntegerName @@ #1, " "] &


Try it online!






share|improve this answer









$endgroup$




















    9












    $begingroup$


    R (with english package), 16 bytes / 16 bytes



     Part 1, 16 bytes





    f=function(n)1:n


    Part 2, 16 bytes





    english::ordinal


    Requires the english package (which is not installed on TIO, unfortunately).



    english::ordinal(f(22)) outputs first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth nineteenth twentieth twenty first twenty second.



    Of course, part 1 could be made much shorter (3 bytes: seq), but that would go against the constraint that part 2 has to be no longer than part 1.






    share|improve this answer











    $endgroup$












    • $begingroup$
      @Giuseppe Sure. Although I would argue that CRAN packages are part of R, and so should be allowed as long as we count the characters needed to load and attach them.
      $endgroup$
      – Robin Ryder
      Jul 16 at 20:07










    • $begingroup$
      I believe meta consensus is that using an external library essentially counts as "another language"; see for instance this post which is about compiler flags, but has a note about Python external libraries. The answer here is instructive with many examples but I can't seem to use the search function on meta to find the definitive statement.
      $endgroup$
      – Giuseppe
      Jul 16 at 21:21











    • $begingroup$
      @Giuseppe Continued in chat: chat.stackexchange.com/transcript/message/51052875#51052875
      $endgroup$
      – Robin Ryder
      Jul 17 at 8:06


















    8












    $begingroup$


    Wolfram Language (Mathematica) (both parts), 18 bytes / 15 bytes



    -5/-1 thanks to lirtosiast



    Part 1, 18 bytes



    Range@#|"Ordinal"&


    Part 2, 15 bytes



    IntegerName@@#&


    Try it online!



    Two functions which output via return value.






    share|improve this answer











    $endgroup$








    • 2




      $begingroup$
      Range@#|"Ordinal"& is shorter, and IntegerName vectorizes over the first argument. I think space-separated output might be required, though.
      $endgroup$
      – lirtosiast
      Jul 15 at 4:33


















    4












    $begingroup$

    Python 3(part 1 & part 2)



    Unfortunately Nodebox is very wordy... there is not much room for golfing.



    Part 1 76 bytes



    for i in range ( 1 , int ( input ( ) ) + 1 ) : print ( i ,end=" ")


    Part 2 (Uses the NodeBox library) 76 bytes



    import en.number as n
    for i in input().split():print(n.ordinal(n.spoken(i)))





    share|improve this answer











    $endgroup$








    • 5




      $begingroup$
      Your answer must be valid; in this case, your part 2 is longer than your part 1, which is invalid. You cannot mark an answer as "non-competing" and submit an invalid submission; the "non-competing" label is a deprecated label for challenges submitted in languages or language versions that postdate the challenge, which used to be typically disallowed, but allowed under "non-competing" status for interesting submissions anyway.
      $endgroup$
      – HyperNeutrino
      Jul 15 at 2:52






    • 1




      $begingroup$
      @HyperNeutrino Sorry, I thought the rules required Part 1 to be shorter than Part 2. I marked this as non-competing because it used a library to solve this problem.
      $endgroup$
      – A__
      Jul 15 at 2:59






    • 2




      $begingroup$
      Technically, using external libraries seems to be alright: codegolf.meta.stackexchange.com/q/188
      $endgroup$
      – Jono 2906
      Jul 15 at 3:41






    • 1




      $begingroup$
      import en.number as n saves you four bytes in each part.
      $endgroup$
      – Khuldraeseth na'Barya
      Jul 15 at 21:41


















    1












    $begingroup$

    JavaScript (Node.js), 47 bytes / 47 bytes



    Two functions in the same Node.js environment, invoked like g(f(n)). Uses the npm package number-to-words.



    Part 1, 47 bytes (40 bytes + 7 spaces)



    n=>H=>for(i=0;i<n;)console.log(H(++i)) 


    Part 2, 47 bytes



    F=>F(require("number-to-words").toWordsOrdinal)


    Try it on Runkit!




    JavaScript (Node.js), 48 bytes / 43 bytes



    Part 1, 48 bytes



    n=>[n,require("number-to-words").toWordsOrdinal]


    Part 2, 43 bytes



    ([n,F])=>for(i=0;i<n;)console.log(F(++i))


    Try it on Runkit!






    share|improve this answer











    $endgroup$




















      1












      $begingroup$

      Perl 5.10 / Common Lisp, 34 / 26 bytes



      So, Common Lisp format has this as a built-in, because of course it does.



      Program 1 (34 bytes)



      say"(format t"~:r "$_)"for 1..<>


      Perl does all the iterating. The equivalent Common Lisp code ((dotimes(i(read)) ...)) is longer than the much golfier Perl ... for 1..<>. Perl outputs a bunch of Common Lisp code.



      Program 2 (26 bytes)



      (loop(eval(read nil nil)))


      It's a REPL, minus the P. It reads standard input and, well, executes it. Doesn't terminate, but the rules explicitly say that's fine.






      share|improve this answer









      $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%2f188363%2fusing-two-linked-programs-output-ordinal-numbers-up-to-n%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        6 Answers
        6






        active

        oldest

        votes








        6 Answers
        6






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        13












        $begingroup$


        Sledgehammer 0.5.1 / Sledgehammer 0.5.1, 10 bytes



        Program 1 (10 bytes):



        ⣘⢷⠾⣃⢖⣎⢅⡨⠱⢳


        Decompresses into this Wolfram Language function:



        Range[#1], "Ordinal" &


        Program 2 (7 bytes):



        ⡾⡁⢚⣷⣬⠤⣾


        Decompresses into this Wolfram Language function:



        StringRiffle[IntegerName @@ #1, " "] &


        Try it online!






        share|improve this answer









        $endgroup$

















          13












          $begingroup$


          Sledgehammer 0.5.1 / Sledgehammer 0.5.1, 10 bytes



          Program 1 (10 bytes):



          ⣘⢷⠾⣃⢖⣎⢅⡨⠱⢳


          Decompresses into this Wolfram Language function:



          Range[#1], "Ordinal" &


          Program 2 (7 bytes):



          ⡾⡁⢚⣷⣬⠤⣾


          Decompresses into this Wolfram Language function:



          StringRiffle[IntegerName @@ #1, " "] &


          Try it online!






          share|improve this answer









          $endgroup$















            13












            13








            13





            $begingroup$


            Sledgehammer 0.5.1 / Sledgehammer 0.5.1, 10 bytes



            Program 1 (10 bytes):



            ⣘⢷⠾⣃⢖⣎⢅⡨⠱⢳


            Decompresses into this Wolfram Language function:



            Range[#1], "Ordinal" &


            Program 2 (7 bytes):



            ⡾⡁⢚⣷⣬⠤⣾


            Decompresses into this Wolfram Language function:



            StringRiffle[IntegerName @@ #1, " "] &


            Try it online!






            share|improve this answer









            $endgroup$




            Sledgehammer 0.5.1 / Sledgehammer 0.5.1, 10 bytes



            Program 1 (10 bytes):



            ⣘⢷⠾⣃⢖⣎⢅⡨⠱⢳


            Decompresses into this Wolfram Language function:



            Range[#1], "Ordinal" &


            Program 2 (7 bytes):



            ⡾⡁⢚⣷⣬⠤⣾


            Decompresses into this Wolfram Language function:



            StringRiffle[IntegerName @@ #1, " "] &


            Try it online!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 15 at 4:30









            lirtosiastlirtosiast

            19.1k4 gold badges42 silver badges114 bronze badges




            19.1k4 gold badges42 silver badges114 bronze badges























                9












                $begingroup$


                R (with english package), 16 bytes / 16 bytes



                 Part 1, 16 bytes





                f=function(n)1:n


                Part 2, 16 bytes





                english::ordinal


                Requires the english package (which is not installed on TIO, unfortunately).



                english::ordinal(f(22)) outputs first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth nineteenth twentieth twenty first twenty second.



                Of course, part 1 could be made much shorter (3 bytes: seq), but that would go against the constraint that part 2 has to be no longer than part 1.






                share|improve this answer











                $endgroup$












                • $begingroup$
                  @Giuseppe Sure. Although I would argue that CRAN packages are part of R, and so should be allowed as long as we count the characters needed to load and attach them.
                  $endgroup$
                  – Robin Ryder
                  Jul 16 at 20:07










                • $begingroup$
                  I believe meta consensus is that using an external library essentially counts as "another language"; see for instance this post which is about compiler flags, but has a note about Python external libraries. The answer here is instructive with many examples but I can't seem to use the search function on meta to find the definitive statement.
                  $endgroup$
                  – Giuseppe
                  Jul 16 at 21:21











                • $begingroup$
                  @Giuseppe Continued in chat: chat.stackexchange.com/transcript/message/51052875#51052875
                  $endgroup$
                  – Robin Ryder
                  Jul 17 at 8:06















                9












                $begingroup$


                R (with english package), 16 bytes / 16 bytes



                 Part 1, 16 bytes





                f=function(n)1:n


                Part 2, 16 bytes





                english::ordinal


                Requires the english package (which is not installed on TIO, unfortunately).



                english::ordinal(f(22)) outputs first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth nineteenth twentieth twenty first twenty second.



                Of course, part 1 could be made much shorter (3 bytes: seq), but that would go against the constraint that part 2 has to be no longer than part 1.






                share|improve this answer











                $endgroup$












                • $begingroup$
                  @Giuseppe Sure. Although I would argue that CRAN packages are part of R, and so should be allowed as long as we count the characters needed to load and attach them.
                  $endgroup$
                  – Robin Ryder
                  Jul 16 at 20:07










                • $begingroup$
                  I believe meta consensus is that using an external library essentially counts as "another language"; see for instance this post which is about compiler flags, but has a note about Python external libraries. The answer here is instructive with many examples but I can't seem to use the search function on meta to find the definitive statement.
                  $endgroup$
                  – Giuseppe
                  Jul 16 at 21:21











                • $begingroup$
                  @Giuseppe Continued in chat: chat.stackexchange.com/transcript/message/51052875#51052875
                  $endgroup$
                  – Robin Ryder
                  Jul 17 at 8:06













                9












                9








                9





                $begingroup$


                R (with english package), 16 bytes / 16 bytes



                 Part 1, 16 bytes





                f=function(n)1:n


                Part 2, 16 bytes





                english::ordinal


                Requires the english package (which is not installed on TIO, unfortunately).



                english::ordinal(f(22)) outputs first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth nineteenth twentieth twenty first twenty second.



                Of course, part 1 could be made much shorter (3 bytes: seq), but that would go against the constraint that part 2 has to be no longer than part 1.






                share|improve this answer











                $endgroup$




                R (with english package), 16 bytes / 16 bytes



                 Part 1, 16 bytes





                f=function(n)1:n


                Part 2, 16 bytes





                english::ordinal


                Requires the english package (which is not installed on TIO, unfortunately).



                english::ordinal(f(22)) outputs first second third fourth fifth sixth seventh eighth ninth tenth eleventh twelfth thirteenth fourteenth fifteenth sixteenth seventeenth eighteenth nineteenth twentieth twenty first twenty second.



                Of course, part 1 could be made much shorter (3 bytes: seq), but that would go against the constraint that part 2 has to be no longer than part 1.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jul 16 at 20:08

























                answered Jul 15 at 12:20









                Robin RyderRobin Ryder

                2,8914 silver badges24 bronze badges




                2,8914 silver badges24 bronze badges











                • $begingroup$
                  @Giuseppe Sure. Although I would argue that CRAN packages are part of R, and so should be allowed as long as we count the characters needed to load and attach them.
                  $endgroup$
                  – Robin Ryder
                  Jul 16 at 20:07










                • $begingroup$
                  I believe meta consensus is that using an external library essentially counts as "another language"; see for instance this post which is about compiler flags, but has a note about Python external libraries. The answer here is instructive with many examples but I can't seem to use the search function on meta to find the definitive statement.
                  $endgroup$
                  – Giuseppe
                  Jul 16 at 21:21











                • $begingroup$
                  @Giuseppe Continued in chat: chat.stackexchange.com/transcript/message/51052875#51052875
                  $endgroup$
                  – Robin Ryder
                  Jul 17 at 8:06
















                • $begingroup$
                  @Giuseppe Sure. Although I would argue that CRAN packages are part of R, and so should be allowed as long as we count the characters needed to load and attach them.
                  $endgroup$
                  – Robin Ryder
                  Jul 16 at 20:07










                • $begingroup$
                  I believe meta consensus is that using an external library essentially counts as "another language"; see for instance this post which is about compiler flags, but has a note about Python external libraries. The answer here is instructive with many examples but I can't seem to use the search function on meta to find the definitive statement.
                  $endgroup$
                  – Giuseppe
                  Jul 16 at 21:21











                • $begingroup$
                  @Giuseppe Continued in chat: chat.stackexchange.com/transcript/message/51052875#51052875
                  $endgroup$
                  – Robin Ryder
                  Jul 17 at 8:06















                $begingroup$
                @Giuseppe Sure. Although I would argue that CRAN packages are part of R, and so should be allowed as long as we count the characters needed to load and attach them.
                $endgroup$
                – Robin Ryder
                Jul 16 at 20:07




                $begingroup$
                @Giuseppe Sure. Although I would argue that CRAN packages are part of R, and so should be allowed as long as we count the characters needed to load and attach them.
                $endgroup$
                – Robin Ryder
                Jul 16 at 20:07












                $begingroup$
                I believe meta consensus is that using an external library essentially counts as "another language"; see for instance this post which is about compiler flags, but has a note about Python external libraries. The answer here is instructive with many examples but I can't seem to use the search function on meta to find the definitive statement.
                $endgroup$
                – Giuseppe
                Jul 16 at 21:21





                $begingroup$
                I believe meta consensus is that using an external library essentially counts as "another language"; see for instance this post which is about compiler flags, but has a note about Python external libraries. The answer here is instructive with many examples but I can't seem to use the search function on meta to find the definitive statement.
                $endgroup$
                – Giuseppe
                Jul 16 at 21:21













                $begingroup$
                @Giuseppe Continued in chat: chat.stackexchange.com/transcript/message/51052875#51052875
                $endgroup$
                – Robin Ryder
                Jul 17 at 8:06




                $begingroup$
                @Giuseppe Continued in chat: chat.stackexchange.com/transcript/message/51052875#51052875
                $endgroup$
                – Robin Ryder
                Jul 17 at 8:06











                8












                $begingroup$


                Wolfram Language (Mathematica) (both parts), 18 bytes / 15 bytes



                -5/-1 thanks to lirtosiast



                Part 1, 18 bytes



                Range@#|"Ordinal"&


                Part 2, 15 bytes



                IntegerName@@#&


                Try it online!



                Two functions which output via return value.






                share|improve this answer











                $endgroup$








                • 2




                  $begingroup$
                  Range@#|"Ordinal"& is shorter, and IntegerName vectorizes over the first argument. I think space-separated output might be required, though.
                  $endgroup$
                  – lirtosiast
                  Jul 15 at 4:33















                8












                $begingroup$


                Wolfram Language (Mathematica) (both parts), 18 bytes / 15 bytes



                -5/-1 thanks to lirtosiast



                Part 1, 18 bytes



                Range@#|"Ordinal"&


                Part 2, 15 bytes



                IntegerName@@#&


                Try it online!



                Two functions which output via return value.






                share|improve this answer











                $endgroup$








                • 2




                  $begingroup$
                  Range@#|"Ordinal"& is shorter, and IntegerName vectorizes over the first argument. I think space-separated output might be required, though.
                  $endgroup$
                  – lirtosiast
                  Jul 15 at 4:33













                8












                8








                8





                $begingroup$


                Wolfram Language (Mathematica) (both parts), 18 bytes / 15 bytes



                -5/-1 thanks to lirtosiast



                Part 1, 18 bytes



                Range@#|"Ordinal"&


                Part 2, 15 bytes



                IntegerName@@#&


                Try it online!



                Two functions which output via return value.






                share|improve this answer











                $endgroup$




                Wolfram Language (Mathematica) (both parts), 18 bytes / 15 bytes



                -5/-1 thanks to lirtosiast



                Part 1, 18 bytes



                Range@#|"Ordinal"&


                Part 2, 15 bytes



                IntegerName@@#&


                Try it online!



                Two functions which output via return value.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jul 15 at 4:57

























                answered Jul 15 at 4:03









                attinatattinat

                1,7072 silver badges9 bronze badges




                1,7072 silver badges9 bronze badges







                • 2




                  $begingroup$
                  Range@#|"Ordinal"& is shorter, and IntegerName vectorizes over the first argument. I think space-separated output might be required, though.
                  $endgroup$
                  – lirtosiast
                  Jul 15 at 4:33












                • 2




                  $begingroup$
                  Range@#|"Ordinal"& is shorter, and IntegerName vectorizes over the first argument. I think space-separated output might be required, though.
                  $endgroup$
                  – lirtosiast
                  Jul 15 at 4:33







                2




                2




                $begingroup$
                Range@#|"Ordinal"& is shorter, and IntegerName vectorizes over the first argument. I think space-separated output might be required, though.
                $endgroup$
                – lirtosiast
                Jul 15 at 4:33




                $begingroup$
                Range@#|"Ordinal"& is shorter, and IntegerName vectorizes over the first argument. I think space-separated output might be required, though.
                $endgroup$
                – lirtosiast
                Jul 15 at 4:33











                4












                $begingroup$

                Python 3(part 1 & part 2)



                Unfortunately Nodebox is very wordy... there is not much room for golfing.



                Part 1 76 bytes



                for i in range ( 1 , int ( input ( ) ) + 1 ) : print ( i ,end=" ")


                Part 2 (Uses the NodeBox library) 76 bytes



                import en.number as n
                for i in input().split():print(n.ordinal(n.spoken(i)))





                share|improve this answer











                $endgroup$








                • 5




                  $begingroup$
                  Your answer must be valid; in this case, your part 2 is longer than your part 1, which is invalid. You cannot mark an answer as "non-competing" and submit an invalid submission; the "non-competing" label is a deprecated label for challenges submitted in languages or language versions that postdate the challenge, which used to be typically disallowed, but allowed under "non-competing" status for interesting submissions anyway.
                  $endgroup$
                  – HyperNeutrino
                  Jul 15 at 2:52






                • 1




                  $begingroup$
                  @HyperNeutrino Sorry, I thought the rules required Part 1 to be shorter than Part 2. I marked this as non-competing because it used a library to solve this problem.
                  $endgroup$
                  – A__
                  Jul 15 at 2:59






                • 2




                  $begingroup$
                  Technically, using external libraries seems to be alright: codegolf.meta.stackexchange.com/q/188
                  $endgroup$
                  – Jono 2906
                  Jul 15 at 3:41






                • 1




                  $begingroup$
                  import en.number as n saves you four bytes in each part.
                  $endgroup$
                  – Khuldraeseth na'Barya
                  Jul 15 at 21:41















                4












                $begingroup$

                Python 3(part 1 & part 2)



                Unfortunately Nodebox is very wordy... there is not much room for golfing.



                Part 1 76 bytes



                for i in range ( 1 , int ( input ( ) ) + 1 ) : print ( i ,end=" ")


                Part 2 (Uses the NodeBox library) 76 bytes



                import en.number as n
                for i in input().split():print(n.ordinal(n.spoken(i)))





                share|improve this answer











                $endgroup$








                • 5




                  $begingroup$
                  Your answer must be valid; in this case, your part 2 is longer than your part 1, which is invalid. You cannot mark an answer as "non-competing" and submit an invalid submission; the "non-competing" label is a deprecated label for challenges submitted in languages or language versions that postdate the challenge, which used to be typically disallowed, but allowed under "non-competing" status for interesting submissions anyway.
                  $endgroup$
                  – HyperNeutrino
                  Jul 15 at 2:52






                • 1




                  $begingroup$
                  @HyperNeutrino Sorry, I thought the rules required Part 1 to be shorter than Part 2. I marked this as non-competing because it used a library to solve this problem.
                  $endgroup$
                  – A__
                  Jul 15 at 2:59






                • 2




                  $begingroup$
                  Technically, using external libraries seems to be alright: codegolf.meta.stackexchange.com/q/188
                  $endgroup$
                  – Jono 2906
                  Jul 15 at 3:41






                • 1




                  $begingroup$
                  import en.number as n saves you four bytes in each part.
                  $endgroup$
                  – Khuldraeseth na'Barya
                  Jul 15 at 21:41













                4












                4








                4





                $begingroup$

                Python 3(part 1 & part 2)



                Unfortunately Nodebox is very wordy... there is not much room for golfing.



                Part 1 76 bytes



                for i in range ( 1 , int ( input ( ) ) + 1 ) : print ( i ,end=" ")


                Part 2 (Uses the NodeBox library) 76 bytes



                import en.number as n
                for i in input().split():print(n.ordinal(n.spoken(i)))





                share|improve this answer











                $endgroup$



                Python 3(part 1 & part 2)



                Unfortunately Nodebox is very wordy... there is not much room for golfing.



                Part 1 76 bytes



                for i in range ( 1 , int ( input ( ) ) + 1 ) : print ( i ,end=" ")


                Part 2 (Uses the NodeBox library) 76 bytes



                import en.number as n
                for i in input().split():print(n.ordinal(n.spoken(i)))






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jul 16 at 5:10

























                answered Jul 15 at 2:45









                A__A__

                5931 silver badge14 bronze badges




                5931 silver badge14 bronze badges







                • 5




                  $begingroup$
                  Your answer must be valid; in this case, your part 2 is longer than your part 1, which is invalid. You cannot mark an answer as "non-competing" and submit an invalid submission; the "non-competing" label is a deprecated label for challenges submitted in languages or language versions that postdate the challenge, which used to be typically disallowed, but allowed under "non-competing" status for interesting submissions anyway.
                  $endgroup$
                  – HyperNeutrino
                  Jul 15 at 2:52






                • 1




                  $begingroup$
                  @HyperNeutrino Sorry, I thought the rules required Part 1 to be shorter than Part 2. I marked this as non-competing because it used a library to solve this problem.
                  $endgroup$
                  – A__
                  Jul 15 at 2:59






                • 2




                  $begingroup$
                  Technically, using external libraries seems to be alright: codegolf.meta.stackexchange.com/q/188
                  $endgroup$
                  – Jono 2906
                  Jul 15 at 3:41






                • 1




                  $begingroup$
                  import en.number as n saves you four bytes in each part.
                  $endgroup$
                  – Khuldraeseth na'Barya
                  Jul 15 at 21:41












                • 5




                  $begingroup$
                  Your answer must be valid; in this case, your part 2 is longer than your part 1, which is invalid. You cannot mark an answer as "non-competing" and submit an invalid submission; the "non-competing" label is a deprecated label for challenges submitted in languages or language versions that postdate the challenge, which used to be typically disallowed, but allowed under "non-competing" status for interesting submissions anyway.
                  $endgroup$
                  – HyperNeutrino
                  Jul 15 at 2:52






                • 1




                  $begingroup$
                  @HyperNeutrino Sorry, I thought the rules required Part 1 to be shorter than Part 2. I marked this as non-competing because it used a library to solve this problem.
                  $endgroup$
                  – A__
                  Jul 15 at 2:59






                • 2




                  $begingroup$
                  Technically, using external libraries seems to be alright: codegolf.meta.stackexchange.com/q/188
                  $endgroup$
                  – Jono 2906
                  Jul 15 at 3:41






                • 1




                  $begingroup$
                  import en.number as n saves you four bytes in each part.
                  $endgroup$
                  – Khuldraeseth na'Barya
                  Jul 15 at 21:41







                5




                5




                $begingroup$
                Your answer must be valid; in this case, your part 2 is longer than your part 1, which is invalid. You cannot mark an answer as "non-competing" and submit an invalid submission; the "non-competing" label is a deprecated label for challenges submitted in languages or language versions that postdate the challenge, which used to be typically disallowed, but allowed under "non-competing" status for interesting submissions anyway.
                $endgroup$
                – HyperNeutrino
                Jul 15 at 2:52




                $begingroup$
                Your answer must be valid; in this case, your part 2 is longer than your part 1, which is invalid. You cannot mark an answer as "non-competing" and submit an invalid submission; the "non-competing" label is a deprecated label for challenges submitted in languages or language versions that postdate the challenge, which used to be typically disallowed, but allowed under "non-competing" status for interesting submissions anyway.
                $endgroup$
                – HyperNeutrino
                Jul 15 at 2:52




                1




                1




                $begingroup$
                @HyperNeutrino Sorry, I thought the rules required Part 1 to be shorter than Part 2. I marked this as non-competing because it used a library to solve this problem.
                $endgroup$
                – A__
                Jul 15 at 2:59




                $begingroup$
                @HyperNeutrino Sorry, I thought the rules required Part 1 to be shorter than Part 2. I marked this as non-competing because it used a library to solve this problem.
                $endgroup$
                – A__
                Jul 15 at 2:59




                2




                2




                $begingroup$
                Technically, using external libraries seems to be alright: codegolf.meta.stackexchange.com/q/188
                $endgroup$
                – Jono 2906
                Jul 15 at 3:41




                $begingroup$
                Technically, using external libraries seems to be alright: codegolf.meta.stackexchange.com/q/188
                $endgroup$
                – Jono 2906
                Jul 15 at 3:41




                1




                1




                $begingroup$
                import en.number as n saves you four bytes in each part.
                $endgroup$
                – Khuldraeseth na'Barya
                Jul 15 at 21:41




                $begingroup$
                import en.number as n saves you four bytes in each part.
                $endgroup$
                – Khuldraeseth na'Barya
                Jul 15 at 21:41











                1












                $begingroup$

                JavaScript (Node.js), 47 bytes / 47 bytes



                Two functions in the same Node.js environment, invoked like g(f(n)). Uses the npm package number-to-words.



                Part 1, 47 bytes (40 bytes + 7 spaces)



                n=>H=>for(i=0;i<n;)console.log(H(++i)) 


                Part 2, 47 bytes



                F=>F(require("number-to-words").toWordsOrdinal)


                Try it on Runkit!




                JavaScript (Node.js), 48 bytes / 43 bytes



                Part 1, 48 bytes



                n=>[n,require("number-to-words").toWordsOrdinal]


                Part 2, 43 bytes



                ([n,F])=>for(i=0;i<n;)console.log(F(++i))


                Try it on Runkit!






                share|improve this answer











                $endgroup$

















                  1












                  $begingroup$

                  JavaScript (Node.js), 47 bytes / 47 bytes



                  Two functions in the same Node.js environment, invoked like g(f(n)). Uses the npm package number-to-words.



                  Part 1, 47 bytes (40 bytes + 7 spaces)



                  n=>H=>for(i=0;i<n;)console.log(H(++i)) 


                  Part 2, 47 bytes



                  F=>F(require("number-to-words").toWordsOrdinal)


                  Try it on Runkit!




                  JavaScript (Node.js), 48 bytes / 43 bytes



                  Part 1, 48 bytes



                  n=>[n,require("number-to-words").toWordsOrdinal]


                  Part 2, 43 bytes



                  ([n,F])=>for(i=0;i<n;)console.log(F(++i))


                  Try it on Runkit!






                  share|improve this answer











                  $endgroup$















                    1












                    1








                    1





                    $begingroup$

                    JavaScript (Node.js), 47 bytes / 47 bytes



                    Two functions in the same Node.js environment, invoked like g(f(n)). Uses the npm package number-to-words.



                    Part 1, 47 bytes (40 bytes + 7 spaces)



                    n=>H=>for(i=0;i<n;)console.log(H(++i)) 


                    Part 2, 47 bytes



                    F=>F(require("number-to-words").toWordsOrdinal)


                    Try it on Runkit!




                    JavaScript (Node.js), 48 bytes / 43 bytes



                    Part 1, 48 bytes



                    n=>[n,require("number-to-words").toWordsOrdinal]


                    Part 2, 43 bytes



                    ([n,F])=>for(i=0;i<n;)console.log(F(++i))


                    Try it on Runkit!






                    share|improve this answer











                    $endgroup$



                    JavaScript (Node.js), 47 bytes / 47 bytes



                    Two functions in the same Node.js environment, invoked like g(f(n)). Uses the npm package number-to-words.



                    Part 1, 47 bytes (40 bytes + 7 spaces)



                    n=>H=>for(i=0;i<n;)console.log(H(++i)) 


                    Part 2, 47 bytes



                    F=>F(require("number-to-words").toWordsOrdinal)


                    Try it on Runkit!




                    JavaScript (Node.js), 48 bytes / 43 bytes



                    Part 1, 48 bytes



                    n=>[n,require("number-to-words").toWordsOrdinal]


                    Part 2, 43 bytes



                    ([n,F])=>for(i=0;i<n;)console.log(F(++i))


                    Try it on Runkit!







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jul 16 at 21:16

























                    answered Jul 16 at 19:27









                    darrylyeodarrylyeo

                    5,48410 silver badges34 bronze badges




                    5,48410 silver badges34 bronze badges





















                        1












                        $begingroup$

                        Perl 5.10 / Common Lisp, 34 / 26 bytes



                        So, Common Lisp format has this as a built-in, because of course it does.



                        Program 1 (34 bytes)



                        say"(format t"~:r "$_)"for 1..<>


                        Perl does all the iterating. The equivalent Common Lisp code ((dotimes(i(read)) ...)) is longer than the much golfier Perl ... for 1..<>. Perl outputs a bunch of Common Lisp code.



                        Program 2 (26 bytes)



                        (loop(eval(read nil nil)))


                        It's a REPL, minus the P. It reads standard input and, well, executes it. Doesn't terminate, but the rules explicitly say that's fine.






                        share|improve this answer









                        $endgroup$

















                          1












                          $begingroup$

                          Perl 5.10 / Common Lisp, 34 / 26 bytes



                          So, Common Lisp format has this as a built-in, because of course it does.



                          Program 1 (34 bytes)



                          say"(format t"~:r "$_)"for 1..<>


                          Perl does all the iterating. The equivalent Common Lisp code ((dotimes(i(read)) ...)) is longer than the much golfier Perl ... for 1..<>. Perl outputs a bunch of Common Lisp code.



                          Program 2 (26 bytes)



                          (loop(eval(read nil nil)))


                          It's a REPL, minus the P. It reads standard input and, well, executes it. Doesn't terminate, but the rules explicitly say that's fine.






                          share|improve this answer









                          $endgroup$















                            1












                            1








                            1





                            $begingroup$

                            Perl 5.10 / Common Lisp, 34 / 26 bytes



                            So, Common Lisp format has this as a built-in, because of course it does.



                            Program 1 (34 bytes)



                            say"(format t"~:r "$_)"for 1..<>


                            Perl does all the iterating. The equivalent Common Lisp code ((dotimes(i(read)) ...)) is longer than the much golfier Perl ... for 1..<>. Perl outputs a bunch of Common Lisp code.



                            Program 2 (26 bytes)



                            (loop(eval(read nil nil)))


                            It's a REPL, minus the P. It reads standard input and, well, executes it. Doesn't terminate, but the rules explicitly say that's fine.






                            share|improve this answer









                            $endgroup$



                            Perl 5.10 / Common Lisp, 34 / 26 bytes



                            So, Common Lisp format has this as a built-in, because of course it does.



                            Program 1 (34 bytes)



                            say"(format t"~:r "$_)"for 1..<>


                            Perl does all the iterating. The equivalent Common Lisp code ((dotimes(i(read)) ...)) is longer than the much golfier Perl ... for 1..<>. Perl outputs a bunch of Common Lisp code.



                            Program 2 (26 bytes)



                            (loop(eval(read nil nil)))


                            It's a REPL, minus the P. It reads standard input and, well, executes it. Doesn't terminate, but the rules explicitly say that's fine.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jul 16 at 21:25









                            Silvio MayoloSilvio Mayolo

                            1,4579 silver badges17 bronze badges




                            1,4579 silver badges17 bronze badges



























                                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%2f188363%2fusing-two-linked-programs-output-ordinal-numbers-up-to-n%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

                                Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                                Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                                Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form