Euro coins and notes

As the majority of nations using the Euro have the , as the decimal separator, you must use it also.

The task is to output all the values of the Euro coins and notes in ascending order. You must also put the trailing ,00 on the integer values.

0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,00 500,00

I accept both output to stdout or a function returning an array/list. If output is to stdout, the acceptable separators between values are: space, tab, or newline.

There will be no accepted answer, unless I see some one I find very creative.

, so I want to know shortest answer by language.

Update:

Leading 0 zeros are not acceptable. Sorry, I should make it clear before.

Update 2:

It is also acceptable a function returning a string.

• can there be a trailing space? Commented Sep 2, 2017 at 15:41
• @dzaima: yes. :) Commented Sep 2, 2017 at 15:44
• Are leading zeros acceptable (like 000,01 etc.)? Commented Sep 2, 2017 at 22:40
• The accepted answer is the answer that wins the challenge. You can either accept the shortest answer or no answer at all, but not an arbitrary one. Commented Sep 4, 2017 at 0:56
• @KevinCruijssen: See Dennis' answer for reference: codegolf.stackexchange.com/a/141484/29325 Commented Sep 4, 2017 at 11:45

Pure Bash, 48

s={1,2,5}
eval echo 0,0$s 0,${s}0 ${s}{,0,00},00  • Well played! You got the check mark! Commented Sep 3, 2017 at 22:46 • I never noticed the pattern... and I've been using the currency over 15 years.. Commented Sep 4, 2017 at 8:08 • @StephanBijzitter many currencies work like that. – Maya Commented Sep 4, 2017 at 19:48 Japt, 23 22 bytes -1 byte thanks to @Shaggy 5Æ#}ì ®eX-2 x2 d".," c  Returns an array of strings. Try it online! with the -R flag to output array items on separate lines. • Go multiline for 22 bytes. Commented Sep 2, 2017 at 22:20 Python 2, 72 bytes print[('%.2f'%(10**(x/3-2)*(5>>~x%3))).replace(*'.,')for x in range(15)]  Try it online! The expression 5>>~x%3 maps the non-negative integers to 1, 2, 5, 1, 2, 5 It works because 5, 2, 1 are the successive right-bitshifts of 5 (0b1010b100b1); we cycle through them backwards. Charcoal, 36 bytes ＥＥ×125⁵⁺⁺×0⁻²÷κ³ι×0÷κ³⁺⁺✂ι⁰±²¦¹,✂ι±²  Try it online! Link is to verbose version of code. Explanation:  125 String 125 × ⁵ Repeated 5 times Ｅ Map over each character ÷κ³ ÷κ³ Integer divide loop index by 3 ⁻² Subtract from 2 ×0 ×0 Repeat the string 0 x times ⁺⁺ ι Concatenate with the character Ｅ Map over each resulting string ✂ι⁰±²¦¹ Slice off the last two digits ✂ι±² Extract the last two digits ⁺⁺ , Concatenate with a comma Implicitly print one per line  SOGLOnline offline, 272625242322 21 bytes 252¹5∙īυ;{⁴Ζ.,ŗP*F⁾?½  Try it Here! The online link doesn't show trailing zeroes, but the offline version does as Javas BigDecimals are nice. Explanation: 252¹5∙īυ;{⁴Ζ.,ŗP*F⁾?½ 252¹ push the array [2, 5, 2] 5∙ multiply vertically by 5 īυ; push 0.01 below that - the main number { iterate over that array - [2,5,2,2,5,2,2,5,2,2,5,2,2,5,2] ⁴ duplicate the main number Ζ.,ŗ replace "." with "," P output in a new line * multiply the main number with the current item of the array F⁾? if the current array item-2 isn't 0, then ½ divide by 2  TO run in the offline interpreter, download SOGLOnlines repository, go to compiler/interpreter, open any of the .pde files with Processing, then do file -> export for your OS (otherwise you can't give arguments to a Processing program :/), and then execute the compiled program with an argument to the path of the file with the code. Then, stdout will contain this. 2L¼2¹5∙īυ;{⁴Ζ.,ŗP* for 18 bytes almost works but the zero amount grows, resulting in 0,01 0,02 0,050 0,100 0,200 0,5000 1,0000 2,0000 5,00000 10,00000 20,00000 50,000000 100,000000 200,000000 500,0000000 (newlines replaced with spaces) • Output format incorrect: "You must also put the trailing ,00 on the integer values." (I imagine this is also intended to include the trailing ,0 where appropriate) Commented Sep 2, 2017 at 22:39 • You should fix your post according to @JonathanAllan 's observation. JonathanAllan, thanks Commented Sep 2, 2017 at 23:30 • @JonathanAllan: Hmmmpf, let me take your comment with a grain of salt. Post author says: "The online link doesn't show trailing zeroes, but the offline version does as Javas BigDecimals are nice.". So I have no way to check whether the script behaves well or not on the offline version. Commented Sep 2, 2017 at 23:42 • @sergiol Ah, I missed that text. I wonder why the online interpreter is implemented differently in this regard - dzaima...? Commented Sep 2, 2017 at 23:44 • I believe the online interpreter is written in JavaScript while the offline one is written in Processing. Also solutions don't have to be testable online. :P Commented Sep 3, 2017 at 0:52 Java 8, 10910881 80 bytes Thanks to @OlivierGrégoire for the Locale idea x->{for(double i=.001;i<11;)System.out.printf("%.2f %.2f %.2f ",i*=10,i*2,5*i);}  Try it online! • You can save a byte by switching to an unused parameter (meta post on this): Try it online Commented Sep 3, 2017 at 20:14 • Commented Sep 4, 2017 at 10:48 • 81 bytes. Works on my system because my default locale is be_FR. "Work on my system" is good enough. I can't find the meta-post linked to this, but you can use it. To simulate it, just have Locale.setDefault(Locale.FRENCH); in the non-competite part of the TIO. Commented Sep 4, 2017 at 10:59 • @OlivierGrégoire Here is the relevant meta-post, and you're indeed right that it is allowed. I even asked OP to verify, and he linked me to Dennis' answer with a link to this meta post. Commented Sep 4, 2017 at 11:47 • 80 bytes: x->{for(double i=.001;i<11;)System.out.printf("%.2f %.2f %.2f ",i*=10,i*2,5*i);} Commented Sep 4, 2017 at 13:16 Bash, 38 bytes printf %.2f\\n {1,2,5}e{-2..2}|sort -h  Requires an appropriate locale, which is allowed by default and costs no bytes. Try it online! • The output is not respecting ascending order! Commented Sep 3, 2017 at 23:03 • I broke it when I switched from newlines to spaces to save a byte. Fixed now. Commented Sep 3, 2017 at 23:30 APL (Dyalog), 30 28 bytes Complete program. Outputs to space-separated to STDOUT. '\.'⎕R','⊢2⍕×\.01,14⍴2 2.5 2  Try it online! 2 2.5 2 the list; [2,2.5,2] 14⍴ cyclically reshape to length 14; [2,2.5,2,2,2.5,2,2,2.5,2,2,2.5,2,2,2.5] .01 prepend 0.01; [0.01,2,2.5,2,2,2.5,2,2,2.5,2,2,2.5,2,2,2.5] ×\ cumulative multiplication; [0.01,0.02,0.05,0.1,0.2,0.5,1,2,5,10,20,50,100,200,500] 2⍕ format with two decimals; " 0.01 0.02 0.05 0.10 0.20 0.50 1.00 2.00 5.00 10.00 20.00 50.00 100.00 200.00 500.00" ⊢ yield that (to separate ',' from 2) '\.'⎕R',' PCRE Replace periods with commas; " 0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,00 500,00" R 70, 50 bytes inspired by @Giuseppe: format(c(1,2,5)*10^rep(-2:2,e=3),ns=2,de=",",sc=F)  Try it here! Ungolfed format(c(1,2,5)*10^rep(-2:2, each = 3), nsmall = 2, decimal.mark = ",", scientific = FALSE)  • I could only manage 56 using a similar method, just with an t(outer()) rather than the rep(). Not sure if we're allowed that leading whitespace though, that'd cost 4 bytes to fix. Commented Sep 4, 2017 at 8:36 Pyth, 37 bytes smmX%"%.2f"*dk\.\,[1 2 5)[.01.1 1T^T2  Try it online! Pyth, 37 bytes Will shorten in a few minutes. V[.01.1 1T^T2)V[1 2 5)X%"%.2f"*NH\.\,  Try it online! JavaScript (ES6), 83 bytes Returns an array. _=>[...'125'.repeat(k=5)].map(c=>(c*(c-1?k:k*=10)/5e3).toFixed(2).split..join,)  Demo let f = _=>[...'125'.repeat(k=5)].map(c=>(c*(c-1?k:k*=10)/5e3).toFixed(2).split..join,) console.log(f()) Recursive version (ES7), 84 bytes Returns a string with a trailing space. f=(i=0)=>i<15?('125'[i%3]/100*10**(i/3|0)).toFixed(2).split..join,+' '+f(i+1):''  Demo f=(i=0)=>i<15?('125'[i%3]/100*10**(i/3|0)).toFixed(2).split..join,+' '+f(i+1):'' console.log(f()) Python 2, 807775 73 bytes -2 bytes thanks to @Mr.Xcoder -1 byte thanks to @EriktheOutgolfer -2 bytes thanks to @totallyhuman -2 bytes thanks to @Lynn print[('%.2f'%(v*m)).replace(*'.,')for m in.01,.1,1,10,100for v in 1,2,5]  Try it online! • @EriktheOutgolfer forgets to remove spaces Commented Sep 2, 2017 at 15:34 • I forgot to specify what kind of separator between values are acceptable. Don't worry, newline is acceptable. Commented Sep 2, 2017 at 15:36 Retina, 42 bytes  5$*0
0
$'1$¶$'2$¶$'5$¶
..¶
,$& m^00?  Try it online! Explanation: There are fifteen values, with 1, 2 and 5 in each of five places. The first stage inserts five 0s. The second stage repeats them into a square, then changes the trailing diagonal into 1s, then duplicates those lines three times with 2 and 5. The third stage inserts the commas and the last stage removes unnecessary leading zeros. Charcoal, 37 bytes ”{➙∧N\�4✳×″↶tι⦄|Ｑ~(↥↗⁻“Ｑ§U‴w⎇δUη◨÷¤Ｇ”  Try it online! Link is to verbose version. Yay, compression! Bash, 88 bytes s=125 for i in {0..14};{ printf %1.2f\ bc<<<"scale=2;${s:i%3:1}*10^$[i/3-2]"|tr . ,;}  Try it online! • After all that hard work, echo 0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,00 500,00 is the same length :( Commented Sep 2, 2017 at 21:36 • @DigitalTrauma But that's no fun :P Commented Sep 2, 2017 at 21:38 JavaScript (ES6), 81 bytes Returns an array. _=>[...Array(13),b=.005,i=0].map(p=>(b*=++i%3?2:2.5).toFixed(2).replace(".",","))  Demo let f = _=>[...Array(13),b=.005,i=0].map(p=>(b*=++i%3?2:2.5).toFixed(2).replace(".",",")) console.log(f()) Common Lisp, 95 bytes (dotimes(i 5)(dolist(j'(1 2 5))(princ(substitute #\, #\.(format()"~$ "(*(expt 10(- i 2))j))))))


Try it online!

Husk, 28 bytes

ṁm↔ṪöJ',CtNJ§¤eR'0≥≤2ḣ5"125


Try it online!

Just string manipulation, since Husk is terrible at formatting floating point numbers.

Explanation

ṁm↔ṪöJ',CtNJ§¤eR'0≥≤2ḣ5"125
"125  The string "125".
ḣ5      The range [1,2,3,4,5].
Ṫö                         Compute their outer product wrt this function:
Arguments are number n (say 3) and character c (say '5').
§     ≥≤2         Compute max(0,n-2+1) and max(0,2-n+1),
R'0            repeat '0' those numbers of times,
¤e               and put them into a list: ["00",""]
J                  Join with c: "005"
CtN                    Split to lengths 2 and at most 3: ["00","5"]
J',                       Join with ',': "00,5"
This gives a 2D array of the outputs reversed.
ṁ                             Map and concatenate
m↔                           map reversal.
Implicitly print separated by newlines.


C++, 138 120 bytes

-18 bytes thanks to MSalters

#include<iostream>
void p(){for(auto&a:{"0,0%d ","0,%d0 ","%d,00 ","%d0,00 ","%d00,00 "})for(int b:{1,2,5})printf(a,b);}


Hardcoded version, by Lynn, 116 bytes

#include<ios>
void p(){puts("0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,00 500,00");}

• You should include some online example for people seeing it running. I already did it for you: tio.run/… Commented Sep 3, 2017 at 22:07
• No need for v and f: void p(){for(auto&a:{"0,0%d ","0,%d0 ","%d,00 ","%d0,00 ","%d00,00 "})for(int b:{1,2,5})printf(a,b);} - just 120 bytes Commented Sep 4, 2017 at 13:11
• #include<ios>␤void p(){puts("0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,00 500,00");} is 116 bytes.
– lynn
Commented Sep 4, 2017 at 14:00

R, 70 61 bytes

options(scipen=9,OutDec=",")
print(c(1,2,5)*10^rep(-2:2,e=3))


Try it online!

-9 bytes thanks to Rui Barradas

Outgolfed by AndriusZ

• I think there are no 1000€, 2000€ and 5000€ Commented Sep 3, 2017 at 14:12
• You can save 5 bytes by removing print Commented Sep 3, 2017 at 14:20
• by mixing your and my answers we can achieve 50 bytes - format(c(1,2,5)*10^rep(-2:2,e=3),ns=2,de=",",sc=9) Commented Sep 3, 2017 at 14:32
• @AndriusZ I think you still need a print around that answer but you should post it yourself; I just used the most barbaric method to change the settings, using format required some actual thought. Commented Sep 3, 2017 at 15:38
• You can save 8 bytes by combining the two options into one. options(OutDec=",",scipen=5). Commented Sep 3, 2017 at 17:43

C (gcc), 82 bytes

p(n){printf("%d,%02d ",n/100,n%100);}f(n){for(n=1;n<5e4;n*=10)p(n),p(n*2),p(n*5);}


Try it online!

05AB1E, 25 bytes

125S5иεN3÷°*т/'.',:N2›i0«


Returns a list of strings.

Try it online.

Explanation:

125                          # Push 125
S                         # Split to a list of digits: [1,2,5]
5и                       # Repeat it 5 times: [1,2,5,1,2,5,1,2,5,1,2,5,1,2,5]
ε                      # Map each to:
N3÷                   #  Integer-divide the map-index by 3
°                  #  Take it to the power 10
*                 #  Multiply the current map number with it
т/               #  Divide it by 100
'.',:          #  Replace all "." with ","
N2›i      #  And if the map-index is larger than 2:
0«    #   Append a "0"


125S5и could be •}•15∍ (push compressed 125; enlarge it to size 15: 125125125125125) and '.',: could be „.,: (push string ".,", pop and push the characters as separated items to the stack) for the same byte-count: Try it online.
Also, N3÷°*т/ can be shortened to N3÷Í°* (where Í subtracts 2), but unfortunately we need the / so all the numbers becomes decimals, whereas with N3÷Í°* most numbers will remain integers.

T-SQL, 104 bytes

SELECT FORMAT(p*n,'0\,00')
FROM(VALUES(1),(2),(5))a(n),(VALUES(1),(10),(100),(1E3),(1E4))b(p)
ORDER BY p,n


Line breaks are for readability only.

Annoyingly longer than the trivial PRINT version (90 bytes):

PRINT'0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,00 500,00'

• You can append to your answer an online demo: rextester.com/IBKO53221 Commented Nov 16, 2018 at 17:14
• And remove the newlines for it to be more golfy: rextester.com/ZANC22480 Commented Nov 16, 2018 at 17:15

Bubblegum, 41 bytes

00000000: 1dc5 8105 0040 1402 d055 1ae0 50d1 feab  [email protected]...
00000010: dd2f 788f 8fc2 e192 433c 5c42 e891 7049  ./x.....C<\B..pI
00000020: 11ab 67a6 b8bc 90f5 01                   ..g......


Try it online!

Retina, 58 bytes


¶0¶00¶000¶0000¶
.*¶
1$&2$&5$& ^ ¶ +¶(.?.?¶) ¶0$1
..¶
,$&  Try it online! • I double-checked with a question to the OP - the leading zeros are not acceptable :( Commented Sep 2, 2017 at 23:24 • You should fix your post according to @JonathanAllan 's observation. JonathanAllan, thanks Commented Sep 2, 2017 at 23:31 • @sergiol fixed it – ovs Commented Sep 3, 2017 at 6:06 Ruby, 66 62 bytes -2.upto 2{|m|[1,2,5].map{|v|$><<('%.2f '.%v*10**m).tr(?.,?,)}}


4 bytes shorter thanks to Lynn!

Try it online!

• -2.upto 2{…} saves 3 bytes. '%.2f '.%v*10**m saves one byte (calling the % method!)
– lynn
Commented Sep 3, 2017 at 12:27

C# (.NET Core), 107 bytes

Console.Write("0,01{0}2{0}5 0,10 0,20 0,50 1{1}2{1}5{1}1{2}2{2}5{2}10{2}20{2}50{2}"," 0,0",",00 ","0,00 ");


Run it

JavaScript - 96 bytes

x=>{for(o="",b=-2;b<3;b++)for(n of[1,2,5])o+=(n*10**b).toFixed(2).replace(".",",")+" ";return o}


And here's a slightly longer (98 characters) functional approach:

x=>[].concat.apply([],[.01,.1,1,10,100].map(n=>[n,n*2,n*5])).map(n=>n.toFixed(2).replace(".",","))


J, 36 bytes

echo'.,'charsub 0j2":,1 2 5*/~10^i:2


Try it online!

Tcl, 80 bytes

lmap d {-2 -1 0 1 2} {lmap c {1 2 5} {puts [regsub \\. [format %.2f $c\e$d] ,]}}


Try it online!

Tcl, 90 bytes

lmap d {.01 .1 1 10 100} {lmap c {1 2 5} {puts [regsub \\. [format %.2f [expr $c*$d]] ,]}}


Try it online!

Still very long, golfing it more later!