New answers tagged

1

Poetic, 324 bytes the i/o case of HELLO a good i/o drill is:say a HELLO i said HELLO,saying it in Poetic i code in Poetic,a good way to write a poem a special piece for you a special piece in machine writing for you i already think i do pretty well writing for the machine poem Poetic program syntax is nice a perfect sorta poem and a program Try it online! ...


-1

Ruby, 15 bytes with the p function: p"hello world!"


0

Canvas, 40 bytes A{3+{╷¹╷3×+*×/×}]⁵-*_∔{4×|×]∔{║L»‾◂∔ ××] Try it here!


3

Pyke, 29 bytes EF 73 77 59 25 54 25 75 09 60 84 58 22 23 61 82 73 82 72 00 24 52 40 7E 5F 39 39 73 EF Try it here!, Ungolfed with full tests .o - map(ord, input) s - sum(^) wY%T% - (^ % 57) % 10 // wY is 57 ...


1

C (gcc), 103 bytes I hash the first four bytes of the string to determine the index into the array (the hash function is not optimal, but works well enough: there's probably a more efficient one, but it would likely be bigger!) After the index is computed, I then print the four (or five) characters of the prefix and end with "eon". It's more compact than a ...


1

Perl 5 -p -MList::Util=pairfirst, 84 bytes $_=(pairfirst{/$a/}D,Umbr,E,Jolt,Fa,Sylv,Fi,Flar,G,Leaf,I,Glac,P,Esp,W,Vapor)[1].eon Try it online!


2

Jelly, 43 bytes “ȦF³ḢẎŻṣ>[ɲ$Ɱ'⁻⁹ḋm¿:ṪœeḂɲẆy$\»Ḳ;€“°9»ŻɓO’Sị Try it online! Or see the test-suite. How? First makes the list ['Jolt', 'Leaf', 'Umbr', 'Esp', 'Vapor', 'Sylv', 'Flar', 'Glac'], adds 'eon' to each, and prepends a zero to the list. Then gets the ASCII code-points of the characters in the input list, subtracts one from each, sums those up ...


3

Java 8, 84 bytes t->"Leaf Esp Umbr Vapor Sylv Flar Jolt Glac".split(" ")[t.chars().sum()%64%9]+"eon" Port of @JoKing's Perl answer. Try it online.


4

05AB1E, 47 40 38 bytes .•‡ιÏSnÛ@¥I´4óȬ–[и)h‘j"õújв•#ć«™sÇ<Oè -7 bytes by porting @JoKing's ord-sum % 64 trick. -2 bytes thanks to @JonathanAllan by using the ord-sum - length on the input-type instead. Try it online or verify all test cases. Explanation: .•‡ιÏSnÛ@¥I´4óȬ–[и)h‘j"õújв• "# Push compressed string "eon glac jolt leaf umbr ...


4

ink, 111 110 bytes =e(t) { -t?"W":Vapor -t?"E":Jolt -t?"P":Esp -t?"y":Sylv -t?"D":Umbr -t?"G":Leaf -t?"I":Glac -1:Flar }<>eon->-> Try it online! Explanation =e(t) // Define a stitch e which takes a parameter t { // An if block - finds the first condition that is true and doeses the associated thing -t?"W":Vapor // If "...


1

Julia 1.0, 85 83 75 bytes f(s)=strip("VUEJGSFLamsolylepbplalaaor tcvrfr"[6hash(s)%47%8+1:8:33])*"eon" Try it online!


3

Charcoal, 50 bytes §⪪”↶2'⧴mB⁼“↷⁻o⊟HtωhJ№↘Tθ⁼σ4Þχ℅)Zh” ⌕rtFhDscy§S⁴eon Try it online! Link is to verbose version of code. Explanation: §⪪”↶2'⧴mB⁼“↷⁻o⊟HtωhJ№↘Tθ⁼σ4Þχ℅)Zh” Split the compressed string Vapor Jolt Flar Esp Umbr Leaf Glac Sylv on spaces and index into it using... ⌕rtFhDscy§S⁴ ... the index of the fourth character of the input (taken ...


15

Python 2, 77 76 bytes lambda s:'VFULJSGEalmeoylspaballaporrftvc'[hash(s)%3695%8::8]+'reon'[s<'V':] Try it online!


13

Perl 6, 72 67 65 64 bytes {<Sylv Esp Glac Jolt Leaf Umbr Flar Vapor>[:36($_)%537%8]~'eon'} Try it online! A golf to all unique indexes by parsing the string as base 36 and moduloing it. I've left a version that just uses the sum below so other answer that may not have the same short base converting code that Perl 6/Raku does. There is also base 35 ...


7

Ruby -p, 89 67 bytes Direct port of Jo King's Perl answer. By sheer coincidence, the byte count is even the same. The byte counts are no longer the same as Jo King has switched to using a technique that cannot be tersely replicated in Ruby. $_=%w"Leaf Esp Umbr Vapor 0 Sylv Flar Jolt Glac"[$_.sum%64%9]+'eon' Try it online! Original Version, Ruby -p, 89 ...


2

C (gcc) with libquadmath, 107 2 bytes saved thanks to @ceilingcat. This uses __float128 to get the required precision. #import<quadmath.h> s[9];main(i){for(;i<13;puts(s))quadmath_snprintf(s,36,"%.99Qf",expq(logq(M_PIq)/i++));} Try it online! I was curious to try this using the GNU MPFR library too: C (gcc) with libmpfr, 123 13 bytes saved ...


2

R + Rmpfr, 80 bytes Requires package Rmpfr. mpfr("1.00000000238982476721842284052415179434",30 *log2(10))^(479001600/(1:12)) Gives the following, with truncations mine and some minor formatting 12 'mpfr' numbers of precision 99 bits 3.1415926535897932384... 1.7724538509055160272... 1.4645918875615232630... 1.3313353638003897127... 1....


2

C (gcc -lm), 171 131 122 bytes Shaved off 40 49 bytes thanks to ceilingcat. i;p(){for(;i<12;)printf("%.14f%d ",pow(acos(~fesetround(1024)),1./++i),L"纀罶𗭧얡꜇𒃮𗁡𘅻胛𓗙𑃅"[i]);} Try it online! Output: 3.1415926535897932384 1.7724538509055160272 1.4645918875615232630 1.3313353638003897127 1.2572741156691850593 1.2102032422537642759 1.1776640300231973966 ...


1

APL (Dyalog Extended), 22 bytes (⌽0,⍳25)⌽⌽↑{∊⍺' '⍵}\⎕A Try it online! Output of above function. Explanation: ⎕A is the uppercase alphabet character vector. {∊⍺' '⍵} is a 1 character shorter version of {⍺,' ',⍵} which puts a space between arguments ⍺ and ⍵. Reducing / this function over ⎕A would result in the uppercase alphabet with spaces between, 'A B ...


1

Poetic, 899 bytes ill be honest with you i expect a big solitude i guess i had a guilt my own idea being:i was real alone,i was a lonely human also,i am still o,i guess i was expecting a shift i figured,surely i know i am tired of silence now i dreamed for a shift a magical desire cant come i am barely a man,so i guess i see why a woman i see ignores myself ...


1

Julia 1.0, 51 bytes [' '^i*join(('Z'-i:-1:'B').*' ')*'A' for i=25:-1:0] Try it online!


0

C (gcc), 205 bytes My solution quickly converged on something extremely close to ceilingcat's golfed version of OP's implementation, but output does differ slightly when it comes to leading spaces on each line, since I worked from the text found in OP's post, which does not exactly match the output of the reference implementation, most likely due to OP ...


1

Octave, 23 bytes vpa(pi,22).^(1./(1:12)) Try it online! Declares a variable precision arithmetic (VPA) pi. Octave then cleverly infers that the double constant pi actually means pi, not whatever the double constant contains.


-2

C#, 2489 bytes I know I am not going to win on size but this was interesting to build. Key Code: Enumerable.Range(1,12).Select(x => Math.Pow(Math.PI,1.0/x)) .ToList().ForEach(x => Console.WriteLine(DoubleConverter.ToExactString(x))); I did not know about C#'s limitiations on double printing before. link DotNet Fiddle Complete code: ...


-1

T-SQL, 75 bytes declare @ float set @=1while @<=12begin select power(pi(),1/@)set @=@+1 end Not exact, but it works :)


1

Java 10, 316 299 268 259 bytes v->Math.PI+"2384 1.7724538509055160272 1.4645918875615232630 1.3313353638003897127 1.2572741156691850593 1.2102032422537642759 1.1776640300231973966 1.1538350678499894305 1.1356352767378998683 1.1212823532318632987 1.1096740829646979321 1.1000923789635869829" -40 bytes by just hard-coding the output instead of calculating ...


6

Python 3, 61 69 63 bytes Variant of Jitse's answer, who wants to stick to standard libraries. As mentioned by @Seb & @Jitse, Rational or E/E are needed because 1/i isn't precise enough as float. from sympy import*;i=E/E while i<13:print(N(pi**(1/i),99));i+=1 Try it online! As a bonus, sympy allows to output 99 decimals with the same byte count as ...


0

Wren, 246 bytes System.print((99..1).map{|i|"~ on the wall, ~.\n%(i>1?"Take one down and pass it around":"Go to the store and buy some more"), %(i>1?i-1:99) bottle%(i!=2?"s":"") of beer on the wall.".replace("~","%(i) bottle%(i>1?"s":"") of beer")}.join("\n\n")) Try it online!


4

Ruby -rbigdecimal/math, 65 50 bytes Conveniently, even though BigMath.PI(9) only guarantees precision up to 9 digits, it actually is precise up to 26, which is enough to calculate the exponents, which use the builtin Rational fractions instead of floats to ensure the precision is still good enough. (Also, making a Rational saves a byte over dividing it ...


1

J, 31 bytes (|.@;:inv,~' '#~26-#)\u:65+i.26 Try it online!


1

Jelly, 46 bytes 12İ€ØP*×ȷ19Ḟ+“Ṿẏ⁽)¬ọƓỴ³ɲỊUị&ıİḣl’ḃ4ȷ¤_2ȷD;"€”. Try it online! Similar to some other answers, but encodes the difference between the Jelly answer and the correct answer (with big integer arithmetic). Full explanation to follow.


1

Python 3, 146 bytes import math for i in range(1,13):print(str(math.pi**(1/i))[:~(i==2)]+str([32384,60272,2630,7127,'0593',2759,3966,4305,8683,2987,9321,69829][i-1])) Try it online! This uses a similar method to Arnauld's JavaScript solution, by using the inbuilt pi value with the extra precision added to the end.


2

cQuents, 268 bytes #1&"3.1415926535897932384 1.7724538509055160272 1.4645918875615232630 1.3313353638003897127 1.2572741156691850593 1.2102032422537642759 1.1776640300231973966 1.1538350678499894305 1.1356352767378998683 1.1212823532318632987 1.1096740829646979321 1.1000923789635869829" Try it online! There is no way to get more precision out of ...


5

bc -l, 28 for(;i<12;)e(l(4*a(1))/++i) Try it online!


2

Canvas, 30 bytes 6«{“≥αyHT.─C¹„1.0000ŗ┤“^m„┘÷^] Don't try it here! It'll take a while to calculate all those digits (it took ~15 minutes to run for me). Rather, here's a version of the same code, only outputting the last 3 items. Computes C ^ (27720/N) where C is the hard-coded constant pi^(1/27720) = 1.000041297024626834690309 and N is looped over from 1 ...


12

Julia 1.0, 18 bytes @.π^(big(1)/1:12) Try it online! (big(1)./1:12) divides a BigInt 1 by each of 1 thru 12, then π.^ raises pi to each of those values. So long as there is one BigInt or BigFloat involved in each computation, it will calculate the result at that precision. The @. macro transforms the code to add dots to every function call (thus the dots ...


2

k4, 24 bytes (-26-!26)$|:',\.Q.A,'" " explanation: .Q.A,'" " /append space to each capital letter ("A ";"B "; "C "; ... ) ,\ /join scan, join each element successively and return intermediate results ("A ";"A B ";"A B C "; ... ) |:' /reverse each (-26-!26)$ /left-pad each with -26 -27 ...


14

Bash + bc + coreutils, 51, 40, 39, 36 bytes following @ChristianSievers comment |cut -c -21 could be removed. -3 bytes thanks to @DigitalTrauma. echo "e(l(4*a(1))/"{1..12}");"|bc -l Try it online! Some explanations bc -l define math functions and set scale to 20, see man bc for more details a() atan function, so 4*a(1) is pi e() exp function l() log ...


8

Wolfram Language (Mathematica), 22 20 19 bytes -2 bytes thanks to game0ver -1 byte thanks to LegionMammal978 Pi^(1`11/Range@12)& Try it online!


2

Pari/GP, 20 bytes vector(12,n,Pi^n^-1) Try it online! (TIO needs some supporting code, but this works as is in the REPL.


7

05AB1E (legacy), 47 43 40 bytes •u¬Œo¡õ≠ÎĆζw1Á4¼©éßw–xùó1O•5ôεžqN>zm16£ì -7 bytes thanks to @Grimy. Try it online. Uses the legacy version, because for some reason the new version outputs \$1.0\$ for \$\pi^{\frac{1}{1}}\$.. :S Explanation: •u¬Œo¡õ≠ÎĆζw1Á4¼©éßw–xùó1O• # Push compressed integer ...


5

Python 3, 91 bytes import fractions as f;p=f.Decimal('%s2384'%f.math.pi);i=p/p while i<13:print(p**i**-1);i+=1 Try it online! -23 bytes thanks to flornquake


19

JavaScript (ES7), 121 bytes Computes as many digits as the precision of IEEE 754 allows and hardcodes the other ones. _=>[32384,60272,2630,7127,[n=0]+593,2759,3966,4305,8683,2987,9321,69829].map(v=>(Math.PI**(1/++n)+'').slice(0,~(n==2))+v) Try it online! Commented _ => // input is ignored [ 32384, 60272, 2630, 7127, //...


18

APL (Dyalog Extended), 9 8 bytesSBCS (⍳12)√○1 Try it online! (⎕PP←34 is Print Precision: 34 digits; ⎕FR←1287 is Float Representation: 128-bit decimal) ○1 \$π×1\$ (…)√ take the following roots of that:  ⍳12 ɩndices 1 through 12


0

C (gcc), 255 244 239 bytes b,c;main(a){for(;a="TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBLOFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"[b++];)for(;a-->64;putchar(++c%80?33-b%2:10));} Slightly bugfixed and golfed version of OP's reference implementation. Try it online! ...


0

Jelly, 12 bytes ØAa⁶ḊÐƤżKƤUY A full program which prints the result Try it online! How? ØAa⁶ḊÐƤżKƤUY - Main Link: no arguments ØA - (set left to) uppercase alphabet say:['A','B','C'] ⁶ - space character ' ' a - AND (vectorises) [' ',' ',' ',] ÐƤ - for postfixes: Ḋ ...


1

ink, 286 bytes -(c){ -c>11 and c<21: {eleven|twelve|thir|four|fif|six|seven|eigh|nine}{||teen} -c%10==1: ~temp t="{zero|ten|twenty|thirty|forty|{&half {third|fourth|fifth}|{three|four|five}} times twenty}" {t} -1: {&one|two|three|four|five|six|seven|eight|nine}{c>19: and {t}} } {c<100:->c}one hundred Try it online! Ink has sequences ...


1

P is for Python 3, 32 chars -> Score: 38 print('%c'*26%(*range(97,123),)) I'm on fire. This is based in my 2011 answer which is before Python 3.5 added starred tuple unpacking, making it smaller that that one.... EXCEPT for Python 2 also got a smaller version today which is unbeatable :)


1

T is for Triangular, 19 bytes → 19+10 = 29 ,5,D@"*i.jC>"dj>F+/ Try it online! Ungolfed: , 5 , D @ " * i . j C > " d j > F + / The process here is, Push 65 Push 27 j is a conditional NorthWest IP switch; it changes to NW if the top value of the stack is not 0. This means we have the equivalent of looping from 26 to 0 (...


1

P is for Pyth, 1 character -> Score: 5 G Try it out! That's it - just 1 letter. This is how it works: The variable G is by default initialised to abcdefghijklmnopqrstuvwxyz in this language. By default, the value returned by a program is printed out to the standard output.


Top 50 recent answers are included