text
stringlengths
180
608k
[Question] [ **This question already has answers here**: Closed 11 years ago. > > **Possible Duplicate:** > > [Emulate an Intel 8086 CPU](https://codegolf.stackexchange.com/questions/4732/emulate-an-intel-8086-cpu) > > > I know that there already is a code golf for this, but that one didn't require much. This one, however, is for masochists only! >:) OK, you need to emulate an entire 8086, every single opcode. Not every flag needs to be computed, but every single documented opcode needs to be implemented. However, that's just the beginning. I STRONGLY encourage you to support more than just this. NEC V20? Why not? Soviet clones? Don't mind if I do. For some help, opcodes 0x60 - 0x6F are just aliases for opcodes 0x70 - 0x7F on the 8086 and 8088 ONLY. If you ask the guy who runs reenigne.org, he'll say the same thing, simply because it's been proven by hardware tests, on an IBM XT. Anyways, for bonus points, emulate an entire V20, 286, or 386, no facets left unemulated. [Answer] # C++ - 5084 lines github.com/Alegend45/IBM5150/blob/master/cpu.h This emulates the entire 8086, the 80186 instruction set, and part of the NEC V20. This took me over 3 weeks. ]
[Question] [ The task is simple, given an integer `n` of how many lines the next `n` lines is and, a multi-line input, output the resulting 90 degree tilted grid in a clockwise formation. E.g. Input: ``` 2 c d o e ``` Output: ``` o c e d ``` I/O format: 1. Input will have spaces in between them 2. Input always contains alphabetical characters except the first input `n` This is [code-golf](https://codegolf.stackexchange.com/questions/tagged/code-golf), so shortest code wins! Credit: <https://www.codingame.com/contribute/view/727778c431888fc6c0d03c77037ad93c3fa4> by Tsloa [Answer] # [Japt](https://github.com/ETHproductions/japt) [`-R`](https://codegolf.meta.stackexchange.com/a/14339/), 7 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1) [`z` would work on its own](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=eg&input=ImMgZAoKbyBlIg) if the spacing between characters and lines were consistent. ``` ·m¸z m¸ ``` [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LVI&code=t224eiBtuA&input=ImMgZApvIGUi) [Answer] # [Charcoal](https://github.com/somebody1234/Charcoal), 8 bytes ``` FN↓⟦⟦⁻S ` ``` [Try it online!](https://tio.run/##S85ILErOT8z5/z8tv0hBwzOvoLTErzQ3KbVIQ1NTIaAoM69Ew8olvzxPRyE62jczr7QYoia4BCiVrqGpo6CkoKQZG6tp/f@/EVeyQgpXvkLqf92yHAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: ``` FN ``` Input the number of lines and loop that many times: ``` ↓⟦⟦⁻S ` ``` Remove spaces from the next line of input, then output it vertically and move the cursor two spaces leftwards. [Answer] # [05AB1E (legacy)](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b), 6 (or 7?) [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ``` |€#øí» ``` [Try it online.](https://tio.run/##MzBNTDJM/f@/5lHTGuXDOw6vPbT7//9khRSufIVUAA) It doesn't need the length as input, but if it's mandatory for whatever reason, you can add a `¦` after the `|` to simply remove it from the list of inputs: [Try it online.](https://tio.run/##MzBNTDJM/f@/5tCyR01rlA/vOLz20O7//424khVSuPIVUgE) Could be 2 bytes with standard I/O: [Try it online.](https://tio.run/##yy9OTMpM/f//8I7Da///j45WSlbSUUpRitWJVsoHslKVYmMB) **Explanation (of the 7 bytes program):** ``` | # Get all lines of input as a list ¦ # Remove the first item (the additional length) €# # Split each line on spaces øí # Rotate the matrix 90 degrees clockwise: ø # Zip/transpose; swapping rows/columns í # Reverse each inner row » # Join each inner list by spaces, and then these strings by newlines # (after which the result is output implicitly) ``` [Answer] # Python3, 60 bytes ``` _,*R=map(str.split,open(0)) for r in zip(*R[::-1]):print(*r) ``` [Try it online!](https://tio.run/#python3) [Answer] # [Pari/GP](http://pari.math.u-bordeaux.fr/), 89 bytes ``` [[print1(c,if(j--," ","\n"))|c<-r]|r<-Mat(Colrev([Vec(Str(input))|i<-[1..n=input]])),j=n] ``` [Try it online!](https://tio.run/##HcqxCoMwEADQ3a8ImS6QC9g5Ts5OgkuaQdK0nMgZjujkv6el6@OVVQg/pbUQihDXHpKlN2yIVitt9ZO1MXfyKPEWj9NaYTx2yReEJSeYqwBxOesvkcfQO8fDH2I0xm4Dx9YeXVKv7lD5Cw "Pari/GP – Try It Online") # [Pari/GP](http://pari.math.u-bordeaux.fr/) 2.13.0, 71 bytes ``` [print(strjoin(r," "))|r<-Mat(Colrev([Vec(Str(input))|i<-[1..input]]))] ``` The newest version of PARI/GP finally has a `strjoin` function. But no TIO. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/237241/edit). Closed 2 years ago. [Improve this question](/posts/237241/edit) > > I'm not really sure if this is the right place to ask this. > > > Now, I know I can convert a float to an int with `int`, but is there some shorter way? [Answer] This doesn't actually convert it to an `int` class, but: Depending on the situation, you may be able to use `x//1`; however, that will actually give a float, so `1.5 // 1` will give `1.0`, not `1`. Also, this doesn't always work, since `int(-1.5)` is `-1` but `-1.5 // 1` is `-2.0`. Do with that what you will. If you use `int(...)` enough times you can assign `i=int`, which breaks even after 3 uses: ``` i=int;i;i;i;i int;int;int;int ^ break-even ``` (For the record, no, you cannot use `x/1` in Python 2, because that's only floor division if both arguments are integers.) ]
[Question] [ **This question already has answers here**: [Convert phrases to reverse style [duplicate]](/questions/77609/convert-phrases-to-reverse-style) (29 answers) Closed 6 years ago. ## Input Two words separated by a space. It is assumed that the first is a verb. ## Output The "Soviet counterpoint" to the input phrase, in the form of a punchline to an "in Soviet Russia" joke. ``` "break law" --> "In Soviet Russia, law break you!" ``` Accounting for correct grammar is unimportant. Shortest program wins! [Answer] # [Perl 6](http://perl6.org/), ~~40~~ 37 bytes ``` {"In Soviet Russia, {.words[1,0]} you!"} ``` ``` {~[R,] «you! $_ Russia, Soviet In»} ``` It works because the `« »` "word list quote" recursively splits everything on whitespace. --- Some other answers require the input words to be passed as two separate arguments. I think that's cheating, but for the record, it would make this solution 34 bytes long (and really boring): ``` {"In Soviet Russia, $^b $^a you!"} ``` [Answer] # Jelly, 20 bytes ``` “\UṙȦƒĊÑṆ»⁶³ḲṚK“æw}» ``` [Try it online!](https://tio.run/nexus/jelly#AUQAu///4oCcXFXhuZnIpsaSxIrDkeG5hsK74oG2wrPhuLLhuZpL4oCcw6Z3fcK7////ImJyZWFrcyBsYXci//Vuby1jYWNoZQ "Jelly – TIO Nexus") ``` “\UṙȦƒĊÑṆ»⁶³ḲṚK“æw}» “\UṙȦƒĊÑṆ» Set output to 'In Soviet Russia,' ⁶ Set output to ' ' {implicitly printing the previous output} ³ Set output to the input {implicitly printing the previous output} "breaks law" Ḳ Split {the input} on spaces. ['breaks', 'law'] Ṛ Reverse list. ['law', 'breaks'] K Join with spaces. "law breaks" “æw}» Set output to ' you!' {implicitly printing the previous output} ``` --- Alternatively, if there's no obligation for quotes around the input, it can be done in 19 bytes. ``` “\UṙȦƒĊÑṆ»⁶⁴⁶³“æw}» ``` [Try it online!](https://tio.run/nexus/jelly#@/@oYU5M6MOdM08sOzbpSNfhiQ93th3a/ahx26PGLUDy0Gag/OFl5bWHdv///z@pKDUxu/h/TmL517x83eTE5IxUAA "Jelly – TIO Nexus") [Answer] # TI-Basic, 68 bytes ``` Input Str1 inString(Str1," "IN SOVIET RUSSIA, "+sub(Str1,Ans+1,Str1-Ans)+" "+sub(Str1,1,Ans-1)+" YOU! ``` "Accounting for correct grammar is unimportant." I guess that means I can yell everything ;) [Answer] # Python 3, ~~57~~ 56 bytes ``` print("In Soviet Russia,",*input().split()[::-1],"you!") ``` [**Try it online**](https://tio.run/nexus/python3#@19QlJlXoqHkmacQnF@WmVqiEFRaXJyZqKOko5WZV1BaoqGpV1yQkwmko62sdA1jdZQq80sVlTT//08qSk3MVshJLAcA) [Answer] # Gema, 32 characters ``` * *=In Soviet Russia, $2 * you\! ``` Sample run: ``` bash-4.3$ printf 'break law' | gema '* *=In Soviet Russia, $2 * you\!' In Soviet Russia, law break you! ``` [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 20 bytes ``` Ḳ“\UṙȦƒĊÑṆ»ṭṚ“©ṠẆ»ṭK ``` [Try it online!](https://tio.run/nexus/jelly#@/9wx6ZHDXNiQh/unHli2bFJR7oOT3y4s@3Q7oc71z7cOQsodWjlw50LHu6CCHn///8/qSg1MVshJ7EcAA "Jelly – TIO Nexus") More fun with Jelly's compressed strings. ``` Ḳ“\UṙȦƒĊÑṆ»ṭṚ“©ṠẆ»ṭK Ḳ Split {the input} on spaces ṭ Add an additional input to the end: “\UṙȦƒĊÑṆ» "In Soviet Russia," (compressed notation) Ṛ Reverse the list ṭ Add another additional input to the end: “©ṠẆ» "you!" (compressed notation) K Join on spaces {and implicitly output} ``` [Answer] # [Retina](https://github.com/m-ender/retina), ~~39~~ 37 bytes *Saved 2 bytes thanks to Martin Ender* ``` (.+ )(.+) In Soviet Russia, $2 $1you! ``` [Try it online!](https://tio.run/nexus/retina#@6@hp62gCSQ0uTzzFILzyzJTSxSCSouLMxN1FFSMFFQMK/NLFf//TypKTcxWyEksBwA "Retina – TIO Nexus") [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E), 20 bytes ``` ”InË·ž¦,”I#R„€î!)˜ðý ``` [Try it online!](https://tio.run/nexus/05ab1e#@/@oYa5n3uHuQ9uP7ju0TAfEUw561DDvUdOaw@sUNU/PObzh8N7//5OKUhOzFXISywE "05AB1E – TIO Nexus") [Answer] # [GNU sed](https://www.gnu.org/software/sed/), 40 bytes ``` s/(.+ )(.+)/In Soviet Russia, \2 \1you!/ ``` [Try it online!](https://tio.run/nexus/bash#K05NUdAtSlVQ/1@sr6GnraAJJDT1PfMUgvPLMlNLFIJKi4szE3UUYowUYgwr80sV9f@r/08qSk3MVshJLAcA "Bash – TIO Nexus") [Answer] # [V](https://github.com/DJMcMayhem/V), 29 bytes ``` iIn Soviet Russia, <C-r>b <C-r>a you! ``` [Try it online!](https://tio.run/nexus/v#@5/pmacQnF@WmVqiEFRaXJyZqKNg46xbZJcEoRIVKvNLFf///59UlJqY/T8nsfy/bhkA "V – TIO Nexus") Note that `<C-r>` is actually ctrl-r, or ASCII `0x12`, but since that character is unprintable, using the verbose mode to represent it is more convenient. This is probably about as short as it can get without using compression. [Answer] # JAPT 29 Bytes ``` `In soviet rÔëa, {V} {U} y!` ``` input: "drink" "milk" output: In Soviet Russia, milk drink you explaination: {U} and {V} are the input variables. it inserts them in the string when running the code. First code-golf ever. hope it counts! [Try it online!](http://ethproductions.github.io/japt/?v=1.4.4&code=YEluIHNvdmlldCBy1OthLCB7Vn0ge1V9IHmMIWA=&input=ImRyaW5rIiAibWlsayI=) ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/71806/edit). Closed 8 years ago. [Improve this question](/posts/71806/edit) You receive an input with a number and a string with a space in the middle. The string tells you what you need to do with the number, it can be: sqrt - square root of number sqr - square of number cube - cube of number abs - absolute of number round - rounded version of number You need to output the final result of the calculation with whatever you have. If your language doesn't have an input, you can hard-code that in. **Rules:** You can't use a math library, even if it is built-in. You don't get a number or a result bigger than the highest possible one in your language. Because of the vulnerability of the above rule, you can't use languages, which only support a 1 bit number. (1 and 0) If your language doesn't support non-integer numbers, you need to output a rounded result. **Test cases** 16 sqrt = 4 25 sqr = 625 3 cube = 27 -10 abs = 10 18.38 round = 18 Because this is a code-golf, the shortest answer in bytes wins. Good luck! [Answer] # Mathematica, ~~155~~ 153 bytes ``` {a=ToExpression@#,a a,a a a,c=a~Mod~1,a+Boole[c>=.5]-c,,,,If[Chop@a==0,0,a/Sign@a],If[a>0,(#+a/#)/2&~FixedPoint~1.,0]}[[Hash@#2~Mod~12]]&@@StringSplit@#& ``` Could probably be golfed further. Doesn't use "any sort of functionality, wich allows you to calculate the squareroot/square/cube/absolute/roubded version of a number." [Answer] # Bash - ~~141 137~~ 132 ``` t(){ for((;x*x!=$1;x++));do :;done;} r(){ ((x=$1*$1));} e(){ ((x=$1**3));} s(){ x=${1#-};} d(){ x=${1%.*};} ${2:${#2}-1} $1 echo $x ``` Run as ``` bash math.sh 16 sqrt bash math.sh 25 sqr bash math.sh 3 cube bash math.sh -10 abs bash math.sh 18.38 round ``` It strips the operation done to the last character, which is unique for each, then calls the appropriate function with the number [Answer] # ES6 - 124 bytes ``` (a,b)=>eval('_=>'+'{for(c=1;c*c<a;c++);return c}_a*a_a*a*a_a<0?-a:a_a.toFixed()'.split`_`['tresd'.indexOf(b[b.length-1])])() ``` Square root only works for rounded numbers. Sqrt of 15 will result in 4, I hope this is allowed. Re-writing a fully functional square root function feels like overkill. Explanation ``` (a,b)=> // anonymous function eval( '_=>' + // construct an anonymous function to eval '{for(c=1;c*c<a;c++);return c} // sqrt _ // seperator a*a // sqr _ a*a*a // cube _ a<0?-a:a // abs _ a.toFixed()' // round .split`_` // create an array of functions [ // select the function to use 'tresd'.indexOf(b[b.length-1]) // get index of input ] )() // end eval and call the returned function ``` Golfing tips are welcome Test cases: ``` f= (a,b)=>eval('_=>'+'{for(c=1;c*c<a;c++);return c}_a*a_a*a*a_a<0?-a:a_a.toFixed()'.split`_`['tresd'.indexOf(b[b.length-1])])() F=(a,b)=>document.body.innerHTML+='<pre>'+a+', '+b+':\n'+f(a,b)+'\n</pre>'; F(16,'sqrt') F(25,'sqr') F(3,'cube') F(-10,'abs') F(18.38,'round') ``` [Answer] # Python 2, 153 bytes ``` S=str.split;x,f=S(raw_input()) exec'print '+dict(zip('tresd',S('[a for a in range(x)if a*a==x][0]|x*x|x**3|abs(x)|round(x)','|')))[f[-1]].replace('x',x) ``` ]
[Question] [ Consider following recurrence relation: ``` p[n + 1] = (p[n]^2 + 1) / 2 ``` If `p[1]`, `p[2]`, ..., `p[k]` are primes and `p[k+1]` is not, then `k` is length of sequence starting with `p[1]`. For example, if `p[1] = 3`, then `p[2] = 5, p[3] = 13, p[4] = 85 = 5 * 17`, thus length of sequence is 3. # Goal Write program which find number producing longest sequence you can find. Give in your answer starting number, sequence length, source code and time in which program executes. If multiple answers with same sequence length, then one with greater starting integer wins. If even starting integer is same, then one with smaller executing time wins. If you have taken starting integer for your program from another answer, then you should add its time. Picking starting integer at random is disallowed. Winner will selected 1 week after first answer posted. [Answer] ## Mathematica, 66th 6-prime sequence starting at 178,308,225,421 ``` best = {0, 0} start = TimeUsed[]; For[i = 1, True, i++, p = Prime@i; length = 0; q = p; While[PrimeQ@q, ++length; q = (q^2 + 1)/2; ]; If[length > best[[1]], Print[{best = {length, p}, TimeUsed[] - start}]]; ] best TimeUsed[] - start ``` That's a fairly trivial exhaustive search. The search doesn't terminate, so you need to abort it with `Alt`+`.` after which it'll tell you how long it has run in total. Some timings on my machine ``` Length Starting Prime Cumulative Time 4 271 0.002 s 5 169,219 0.297 s 6 356,498,179 692.1 s ~ 11.5 min ``` The search for 7 primes is still running. (After 110 hours I'm still an order of magnitude below the next result as given by OEIS.) **Edit:** I got a moderate speed-up by ditching the lookup table. **Edit:** The search has been running all night. This time I kept track of how all n-prime sequences before the first (n+1)-prime sequence. I also switched to `NextPrime` but I think it's actually slower - of course, I'll need it if I keep this running over the weekend. Here is some data: If `m(n)` is the number of n-prime sequences before the first (n+1)-prime sequence, then m(n) progresses like {1, 0, 4, 10, 55, >65}. The first 5-prime sequence starts at 169,219 and took 0.3s. The last 5-prime sequence (before the 6-prime ones start) starts at 350,505,151 and took 680s to find. While the distance between two consecutive 5-prime sequences is usually on the order of 106, the two most closely spaced such sequences start at 222,193,661 and 222,266,839. So far I've found the following 6-prime sequences: ``` Starting Prime Cumulative Time 356,498,179 692.2 s ~ 11.5 min 432,448,789 860.1 s ~ 14.5 min 5,380,300,469 13,967.6 s ~ 3.9 h 10,667,785,241 30,519.5 s ~ 8.5 h 11,238,777,509 32,353.6 s ~ 9.0 h 12,129,977,791 35,218.5 s ~ 9.8 h 23,439,934,621 71,781.2 s ~ 20.0 h ... 29 more ... 95,986,224,779 304,385. s ~ 84.5 h 99,143,377,451 314,512. s ~ 87.4 h 102,928,086,161 326,881. s ~ 90.8 h ... 7 more ... 125,338,612,429 398,873. s ~ 110.8 h ... 18 more ... 178,308,225,421 568,694. s ~ 158.0 h ``` As for the spacing of 6-prime sequences, the largest gap was about 11e9 between the 6th and 7th sequence. The two closest sequences were about 5e6 apart, the first one starting at 123,333,728,319 - they were found within 16 seconds of each other, when sometimes there is no new sequence for several hours. Also, there are 5 sequences starting between 33.99e9 and 34.9e9. **Edit:** The week is over in a couple of hours, and I think 66 6-prime sequences is a good number, so I'm stopping this now. [Answer] # Sage, 5 primes in 7.86 s (via [Sage Notebook](http://www.sagenb.org/home/KyleKanos/0/)) Not nearly as fast as [Martin's answer](https://codegolf.stackexchange.com/a/35463/11376), but it does work. I'm working on installing Sage onto my computer to see if it runs faster on my machine, rather than on the web. ``` def PrimePermutation(b): t = cputime() best = 0 P = Primes() i=1 while i<b: i=i+1 q = P.next(i) r = q length = 0 while q in P: length=length+1 q = (q^2+1)/2 if length > best: print(r, length, cputime() - t) best = length PrimePermutation(4e10) ``` Returns (so far) ``` (3, 3, 0.0) (271, 4, 0.009999999999990905) (169219, 5, 7.860000000000014) ``` ]
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/33099/edit). Closed 9 years ago. [Improve this question](/posts/33099/edit) Your challenge is to write a program which will output a non-context-free language. A [Context-free Grammar](http://en.wikipedia.org/wiki/Context-free_grammar) is a series of replacement rules, describing which symbols can be replaced by which other symbols. It defines set of strings, known as a language, which is generated by performing all possible replacement rules on an initial symbol until no more replacements can be made. Any language which can be generated this way is known as a **context-free language**. Your challenge is to write a program which will output a language which *cannot* be generated this way. **Details**: * Output your language in increasing order of length. Ordering between strings of a given length is up to you. * As all CSLs are infinite, your program must not halt. * The strings must be separated from each other. However, you may choose the separation. * Please include in your answer a description of the language you generate and an explanation of why it is not context-free. * One possible way to prove this is by using the [pumping lemma](http://en.wikipedia.org/wiki/Pumping_lemma_for_context-free_languages). * Example context-sensitive language: [abc, aabbcc, aaabbbccc, aaaabbbbcccc, ...] **Scoring**: For all programs which can be encoded in ASCII or another 7 bit or less character set, scoring is by character. For all other programs, scoring is (# of bits in binary encoding)/7. Feel free to ask questions. [Answer] # Pyth, 6 I didn't find the Pyth documentation. But it works. ``` W1~ddd ``` [Answer] # Python 2 (24) (26) ``` s="1" while 1:print s;s+=s ``` Prints the language of strings in the symbol `1` whose length is a power of 2, i.e `{"1"*(2**n) | n>=0}`. The `s+=s` is equivalent to `s*=2`; it doubles the string each time. Since unary (one-symbol) CFG's are regular, and unary regular CFG's are periodic past a point, this cannot be regular and thus is not a CFG. Alternatively, use the pumping lemma to see that the possible lengths of words in a CFL must have finite density and can't have arbitrarily large gaps. Unfortunately, Python doesn't have a short way to produce an infinite counter. I'm sure some language can do `for i in Naturals:print("1"*i*i)` shorter (squares suffice just as well). **Edit:** Can shorten to ``` s=2 while 1:print s;s*=s ``` which prints numbers of the form `2**(2**n)`, which can be taken as strings over `0123456789`. Because the decimal length doubles at each step, this can't be context-free because the length gaps cannot satisfy the pumping lemma. [Answer] # CJam, 8 7 ``` {]`_p}h ``` It is not context-free because there are only at most 4 strings between length `n` and `7n` for any `n`. It is context-sensitive because the memory usage is always growing, and it prints almost everything in the memory. ]
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 9 years ago. [Improve this question](/posts/28585/edit) I have two types of notebook . * 10 problems could be solved in one page, in the first notebook. * 12 problems could be solved in one page, in the second notebook. For given n problems I have to use pages in such a way that no space from both notebook should be wasted ever . Taking consideration that I have to use minimum pages also . Output should return number of pages need for solving all problem , if not passible it should return -1. **Example :** ``` Problem count : 10 Output : 1 (one page from first notebook) Problem Count :12 Output :1 (one page from second notebook) Problem Count : 5 Output : -1 (Not possible) Problem Count : 22 Output : 2(one from first notebook + one from second notebook) Problem Count: 23 Output:-1(not possible) ``` [Answer] # Perl, 83 ``` $l=$ARGV[0];for$i(0..$l){for$j(0..$l){if(10*$i+12*$j==$l){print$i+$j;exit}}}print-1 ``` With the lack of clear winning criteria, I've decided to go for golf. I'll probably change that once things are clarified. [Answer] ## [Sage](http://sagemath.org/), 174 bytes Golfed because the question does not specify a winning criterion. ``` def n(k): p=MixedIntegerLinearProgram(None,0);x=p.new_variable(0,0,1);p.add_constraint(x[0]*10+x[1]*12==k);p.set_objective(x[0]+x[1]) try:return p.solve() except:return -1 ``` **Brief explanation:** This uses the Sage built-in linear program solver (because why not). `MILP(None,0)` specifies it to use the default solver for minimization (same as `MILP(maximization=False)` but shorter). `new_variable(0,0,1)` is the same as `new_variable(integer=True)`. When there is no solution, the solver will throw an exception: `MIPSolverException: 'GLPK : There is no feasible integer solution to this Linear Program'`, which is caught and `-1` is returned. **Sample IO:** ``` sage: n(10) 1.0 sage: n(12) 1.0 sage: n(5) -1 sage: n(22) 2.0 sage: n(23) -1 sage: n(9999999) -1 sage: n(1<<31) 178956971.0 ``` *Note that this submission may not work for some very large numbers because of floating point rounding issues.* [Answer] ## JavaScript (ES6), 76 bytes ``` n=k=>{for(i=0;i<=k;i++)for(j=0;j<=k;j++)if(10*i+12*j==k)return i+j;return-1} ``` A JavaScript inplementation of the Perl answer. Simple `for` loops, not very interesting. ]
[Question] [ **This question already has answers here**: [Build a random number generator that passes the Diehard tests](/questions/10553/build-a-random-number-generator-that-passes-the-diehard-tests) (11 answers) [Random number generation, without built-in random number generation libraries [duplicate]](/questions/22001/random-number-generation-without-built-in-random-number-generation-libraries) (15 answers) Closed 9 years ago. The task is to make a function which returns random number, no build in functions allowed, returned value should be random or pseudo-random and no sequence allowed, no matter what the formula is and how scattered values are. To simplify task, returned value should be 32-bit integer or float from range [0; 1) It is code golf, shortest code wins :) [Answer] # CoffeeScript (16 bytes) ``` ->new Date%2**32 ``` This is awful random number generator, but if you wait enough, you can get any integer. ]
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 10 years ago. [Improve this question](/posts/20303/edit) Your goal is to draw the Linkin Park Logo in minimum bytes. ![The Linkin Park logo](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e4/LPLogo-black.svg/200px-LPLogo-black.svg.png) Please add a title with the language and the number of bytes in your code. [Answer] ## PHP ``` <?=l(11,0).l(3,1)."\n".l(10,0).l(3,1)."\n".l(9,0).l(3,1).l(9,0).l(3,1)."\n".l(8,0).l(3,1).l(9,0).l(5,1)."\n".l(7,0).l(3,1).l(9,0).l(3,1).l(1,0).l(3,1)."\n".l(6,0).l(3,1).l(9,0).l(3,1).l(3,0).l(3,1)."\n".l(5,0).l(3,1).l(9,0).l(3,1).l(5,0).l(3,1)."\n".l(4,0).l(3,1).l(9,0).l(3,1).l(7,0).l(3,1)."\n".l(3,0).l(27,1)."\n".l(14,0).l(3,1)."\n".l(13,0).l(3,1)."\n".l(12,0).l(3,1)."\n".l(11,0).l(3,1)."\n";function l($a,$c,$o=''){if($c){$c='=';}else{$c=' ';};for($i=0;$i<$a;$i++){$o.=$c;}return $o;} ``` Ok actually it's longer than write an echo with the logo but It's the first thing which has hit my mind. [Answer] # Python, 169 bytes ``` e=' ' z=6*e x='===' f=z+x for i in[e*10+x,e*9+x,e*8+x,e*7+x+f,e*6+x+f+'==',e*5+x+f+e+x,e*4+x+f+e*3+x,e*3+x+f+e*5+x, e*2+x+f+e*7+x,e+x*8,x*8,e*8+x,e*7+x,e*6+x]: print i ``` I'm sure it can (and will be) done in shorter code. Output: ``` === === === === === === ===== === === === === === === === === === === === === ======================== ======================== === === === [Finished in 0.1s] ``` Try it for yourself, python 2.7. [Answer] ## Using C++ (Answering my own question) ;) ``` #include<iostream.h> #include<conio.h> void linkinparklogo(int posx, int posy) //Linkin Park Logo Starts { highvideo(); for(int slant=0; slant<=10; slant++) //Slant Part of "L" { for(int l=1; l<=3; l++) {gotoxy(posx+10-slant+l,posy+1+slant); cprintf("=");} } getch(); for(int straight=0; straight<=20; straight++) //Lower Part of Horizontal"L" { gotoxy(posx+4+straight,posy+11); cprintf("="); } getch(); for(straight=0; straight<=22; straight++) //Upper Part of Horizontal "L" { gotoxy(posx+3+straight,posy+10); cprintf("="); } getch(); for(slant=0; slant<=5; slant++) //Right Slant Part of "P" { for(int p=1; p<=3; p++) {gotoxy(posx+21-slant+p,posy+9-slant); cprintf("=");} } getch(); gotoxy(posx+17,posy+5); cprintf("="); gotoxy(posx+16,posy+5); cprintf("="); getch(); for(slant=0; slant<=9; slant++) //Left Slant Part of "P" { for(int ps=1; ps<=3; ps++) {gotoxy(posx+14-slant+ps,posy+6+slant); cprintf("=");} } } //Linkin Park Logo Created void main() { clrscr(); linkinparklogo(0,0); getch(); } ``` ## Output: ![LP](https://i.stack.imgur.com/ywDTc.jpg) [Answer] ### Delphi User gives 2 characters which will be used as foreground and background, spaces will work too. ``` uses idglobal;//Required for IIF function var i:int8; s:string; fg,bg:char; //Foreground + Background function soc(c:char;Cnt:integer=3):string; begin Result:=StringOfChar(c, cnt) end; begin writeln('Give foreground and background characters'); Readln(fg,bg); for I:=0to 16do begin s:=''; if i in[0,16]then begin s:=soc(bg,29); WriteLn(s); continue end; if i in[1,2,3,4,5,6,7,8,9,10,11]then s:=soc(bg,17-i-3)+iif(i in[10,11],soc(fg,24),soc(fg)) else if i in[12,13,14,15]then s:=soc(bg,(17-i-3)+8)+soc(fg); if i in[4,5,6,7,8,9]then s:=s+soc(bg,6); case i of 4:s:=s+soc(fg); 5:s:=s+soc(fg,5); 6:s:=s+soc(fg)+bg+soc(fg); 7:s:=s+soc(fg)+soc(bg)+soc(fg); 8:s:=s+soc(fg)+soc(bg,5)+soc(fg); 9:s:=s+soc(fg)+soc(bg,7)+soc(fg); end; s:=s+soc(bg,29-length(s)); WriteLn(s); end; readln; end. ``` ### Results I must add to this that it looks much better in console lol. ``` Input: $/ Input: (space)= Output: Output: ///////////////////////////// ============================= /////////////$$$///////////// ============= ============= ////////////$$$////////////// ============ ============== ///////////$$$/////////////// =========== =============== //////////$$$//////$$$/////// ========== ====== ======= /////////$$$//////$$$$$////// ========= ====== ====== ////////$$$//////$$$/$$$///// ======== ====== = ===== ///////$$$//////$$$///$$$//// ======= ====== === ==== //////$$$//////$$$/////$$$/// ====== ====== ===== === /////$$$//////$$$///////$$$// ===== ====== ======= == ////$$$$$$$$$$$$$$$$$$$$$$$$/ ==== = ///$$$$$$$$$$$$$$$$$$$$$$$$// === == //////////$$$//////////////// ========== ================ /////////$$$///////////////// ========= ================= ////////$$$////////////////// ======== ================== ///////$$$/////////////////// ======= =================== ///////////////////////////// ============================= ``` # Dont look to long to the first image. Feels weird :P ### Images: ![V1](https://i.stack.imgur.com/34NiK.png)![V2](https://i.stack.imgur.com/wryaG.png) ![V3](https://i.stack.imgur.com/wsn85.png) ]
[Question] [ **This question already has an answer here**: [Solitaire Dreams - Creating a winnable solitaire starting hand](/questions/10465/solitaire-dreams-creating-a-winnable-solitaire-starting-hand) (1 answer) Closed 10 years ago. NOTE: SIMILIAR TO [Solitaire Dreams - Creating a winnable solitaire starting hand](https://codegolf.stackexchange.com/questions/10465/solitaire-dreams-creating-a-winnable-solitaire-starting-hand) Find a minimum of 5 deck orders where if the cards were dealt out would create a game of Klondike Solitaire where there is absolutely no possible winning state. Assume the game is 3 card draw, infinite times through the deck. As always, the shorter the program the better. [Answer] # J, 37 (or 0; see below) characters ``` (i.5)A.(52$'cdsh'),.4#'kqajt98765432' ``` For a much better view, prepend `,"2` and change the suits to uppercase. For an even better view, prepend `,"2' ',"1` instead. For more decks, change `i.5` to a higher value, up to at least 24 factorial (6.2\*10^23). --- The trick here is twofold: Make the piles solid (enough) with (enough) aces built safe within, and to do that easily. If we deal the standard unshuffled deck, there is one rank that is never exposed. Let's move the aces there. There are several possible moves depending on the color assignment, but in order to prevent exposing the easy ace, order the colors such that this move is not possible. We are dealt this tableau (black colors in uppercase): ``` kC kd kS kh qC qd qS qh aC ad aS ah jC jd jS jh tC td tS th 9C 9d 9S 9h 8C 8d 8S 8h ``` The only moves possible are * `qh-kC` exposing kd * `tS-jd/jS-qh` freeing diamonds up to 8d (if the stock is good) * `8h-9S` exposing 8S * `8d-foundation/9h-tS` or `8d-9S/9h-tS` exposing 9C. When these moves are performed, we're left with this solid tableau: ``` kC kd kS kh qC qd qS qh aC aS ah jC jS jd jh tC td tS th 9C 9d 9h 9S 8C 8h 8S ``` The eight of hearts can be moved between the two black nines and the cards from the deck can be stacked on top, but no more aces can be freed. Now, we can replace 8h, 8S and even 8h with a different card in the the stock and the game stays unwinnable. This pushes the number of known unwinnable decks up to 27! at least. Removing 8C opens up additional moves, but I believe the game is still unwinnable. Note that if merely discovery is sufficient, then my score is zero as I didn't need a computer to verify the unwinnability of these 27! decks. ]
[Question] [ Write a function to find the solution of [e^x](http://www.wolframalpha.com/input/?i=exp%28x%29) given x, and a precision in the form 0.000001. sample input and output: `e(4,0.00001)` will return `54.5981494762146`, and the precision is +/- `.00001`. The output would be acceptable in the range `54.59814 <= output <= 54.59816`, you are not required to truncate the answer to the number of significant figures in the input precision. Your example will be expected to take a precision of at least size `double` (64 bits) and an x of at least size `int` (32 bits). Overflows will not be counted against you; I do not expect passing INT\_MAX as x to work. Use whatever algorithm suits you, but do not use math library functions such as builtin `pow`, `factorial`, `exp`, or builtin predefined constants for `e`, `pi`, etc. The objective primary winning criterion is size of submission in bytes, ignoring comments and unnecessary whitespace. Ties will be broken via runtime speed. This will last at least one week (ending Thursday, May 16) with each new entry extending the deadline to three days from the entry date. [Answer] # Mathematica, 90 ``` f[x_,p_]:=Piecewise[{{Sum[x^i/i!,{i,0,50}],x>0},{1/Sum[(-x)^i/i!,{i,0,50}],x<0},{1,x==0}}] ``` I also ignore the precision `p` and assume that 20 decimal points will be the most accuracy desired. It also works for negative values of `x`! To be worked on more later. # Python, 88 ``` def E(x,p): t=n=s=1.;y=x if x<0:y=-x while t:t*=y/n;n+=1;s+=t if x<0:s=1/s return s ``` **Why the Power Series approach does not work without cases:** The issue with the taylor series for `e(x)` centered at the origin is that it is alternating for negative `x`. When the distance from the origin is small, say `x= -1 or -2` then this is not an issue as we get convergence to 20 decimal places after about 20-30 terms of the power series. However when the distance from the origin grows all hell breaks loose. Observe the pattern for `x= -1` where `f[x,n]` refers to the taylor series with `n+1` terms. ``` Exp[-20] = 2.0611536224385578280*10^-9 f[-20,1] = -19.000000000000000000 f[-20,2] = 181.00000000000000000 f[-20,3] = -1152.3333333333333333 f[-20,4] = 5514.3333333333333333 ... f[-20,10] = 1.8596236807760141093*10^6 f[-20,15] = -1.4140053694562736891*10^7 f[-20,20] = 2.1277210342544299144*10^7 f[-20,30] = 1.5996940964229284082*10^6 f[-20,40] = 4442.0343631250907290 f[-20,50] = 1.0469169720658217252 f[-20,60] = 0.000034317328370370852087 f[-20,70] = 2.2782871646157681977*10^-9 ``` It takes until term 70 to get within .000000001 of the true value, and I was being kind using `x= -20`. If we try numbers as low as `x= -500` we are more than `10^200` off at term 500. Now lets see, what are we even working with at this point, iteration 500, this should include the term `x^500/500!`. `500!` if of the order `10^1134`, but python and other programming languages are not equipped to deal with numbers much larger than `2^63` as integers or `10^308` for doubles (unless you have some sort of arbitrary precision library...?) [Answer] ## Python, 59 57 chars ``` def E(x,p): t=n=s=1. while t:t*=x/n;n+=1;s+=t return s ``` Uses the power series expansion of `e^x`. Ignores `p` and just calculates the result to full double precision. [Answer] ## APL (36) ``` {x t←⍺⍵⋄0{t>i←(x*⍵)÷!⍵:⍺⋄∇/⍺⍵+i 1}0} ``` The left argument is the number and the right argument is the tolerance, i.e. ``` 4 {x t←⍺⍵⋄0{t>i←(x*⍵)÷!⍵:⍺⋄∇/⍺⍵+i 1}0} 0.00001 54.59814722 ``` It uses a power series expansion. Explanation: * `x t←⍺⍵`: store the left argument (x) in `x` and the right argument (tolerance) in `t` * `0{`...`}0`: iterator function, `⍺` is the accumulator and `⍵` is the iteration * `t>i←(x*⍵)÷!⍵`: calculate the current iteration's value, and see if it is higher than the tolerance * `:⍺`: if so, return the accumulator * `⋄∇/⍺⍵+i 1`: if not, increment the accumulator by `i` and the iteration by `1` and try again. [Answer] ## C, ~~88~~ 69 ``` double e(int e, double l) {double a,p=1,i=0,f=1,r=1;while ((a=(p*=e)/(f*=++i))>l) r+=a;return r;} ``` ``` double e(int x, double l) {double i=0,t=1,r=1;while (t*=x/++i) r+=t;return r;} ``` call `e`. if you change the first argument to `e` from `int` to `double`, it will even work for floating point exponents. Code counted without any white space or comments. Edited some ideas from Keith into it (combine `p` and `f` into `t`, ignore `l`). Yes, power series is the way to go. Sure, once one got the idea, everyone copy it. [Answer] **JavaScript, 50 Chars** Given that javascript has variable args support, this will work with the input `e(4,0.00001)`. Otherwise, it would be 52 chars. ``` function e(x){for(t=n=s=1;t*=x/n++;s+=t);return s} ``` [ideone](http://ideone.com/XbRVJ0) If it is going to factor in the precision as the problem states, it can be done in 56 chars. ``` function e(x,p){for(t=n=s=1;(t*=x/n++)>p;s+=t);return s} ``` ]
[Question] [ **This question already has answers here**: [Full Width Text](/questions/75979/full-width-text) (146 answers) Closed 2 years ago. ## Challenge Given a positive integer, find the fastest way to iterate over its digits. Bytecode size doesn't matter as much as speed of execution. ## Examples For 6875, the program would output `6 8 7 5`. For 199182, it would output `1 9 9 1 8 2`. For 0, it would output `0`. [Answer] # [Python 3](https://docs.python.org/3/), 15 bytes (Courtesy of @Makonede) ``` print(*input()) ``` [Try it online!](https://tio.run/##K6gsycjPM/7/v6AoM69EQyszr6C0RENT8/9/AwA "Python 3 – Try It Online") # [Python 3](https://docs.python.org/3/), 24 bytes (~0.03s) ``` print(' '.join(input())) ``` [Try it online!](https://tio.run/##K6gsycjPM/7/v6AoM69EQ11BXS8rPzNPIzOvoLREQ1NT8/9/MwtzSwA "Python 3 – Try It Online") Should be compact and fast # [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 23 bytes ``` ("$args"|% t*y)-join' ' ``` [Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X0NJJbEovVipRlWhRKtSUzcrPzNPXUH9/38zC3NLMAEA "PowerShell – Try It Online") This dosen't deserve seperate answer ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/195647/edit). Closed 4 years ago. [Improve this question](/posts/195647/edit) Your challenge is to parse nonsensical text and output a "congruous phrase" - which I shall define here to be text with any contiguous characters in between, and including, a given set of like symbols removed. The given set of **like symbols** (*ignore all brackets and commas here, they're only for notation*) are: {(< >), (^ ^), (' '), (: :), (% %)} --- [NOTE: This question has been heavily refined after several critical errors were identified.] EXAMPLE 1: > > Thi'inquit Caecilius's qu % est provocationem %h^ ad howe et^s [ben] heavilede ^citi:ssim:e^< rn^> ^quolibe doetiguis^dited %inger 'ingenia'%! S\_\_o:esse: rr %^umd^%y... > > > OUTPUT 1: > > This qu hs [ben] heavilede dited ! S\_\_o rr y > > > . *Be wary of the nested like symbol parts* - e.g **^citi:ssim:e^** and **< rn^>** from above, where the pair **: :** are sandwiched between another pair **^ ^**, and a *half-pair* **^** in between **< >**. Both of these non-congruous phrases must be removed. EXAMPLE 2: > > W%cd'fuf'dc%at<>ch^'o'^out! > > > OUTPUT 2: > > Watchout! > > > . EXAMPLE 3: **Special Case** (partial nested like symbols) > > aaa^bbb%ccc'ddd^eee%ddd'fff > > > OUTPUT3: The first occurence of the given like symbol is the dominant; in this case **^** > > aaaeee%ddd'fff > > > --- The code must apply to the general case, so any text of your choosing, of length >= 30 characters, may be used as test cases. The shortest code, in bytes, that completes this challenge successfully, is the winning code. [Answer] # C# .NET, 162 bytes ``` using System;class A{static void Main(string[] s){Console.Write(System.Text.RegularExpressions.Regex.Replace(s[0],String.Format("([{0}]{{1}}).*?\\1",s[1]),""));}} ``` [Try it online!](https://tio.run/##NY7BasMwEER/ZdHJLq6IzykNJaT00ksT6MGxQZUXZ0GWbK2UOhh/u6um9DKHYebNaH7UrNc1MtkOjjcO2G@1UczwMnNQgTRcHbXwrshmHHyKVTVwPu@dZWdQfnoKmP015QmnID@wi0b5wzR4ZKaU@7VwSjoYpTHjalMXxztLvjrfq5CJrJo3Sz3P5bLk8mF3Ppei4Kqs80KIPN8uy7quguwYKcBeoSZDkUUBb@4bAVVaCjB4d3U6fXYWe7g1oNoCLvdAaEA72/kYezQteNvAGJ2hL4TWYaAuEjeQDqG/qyVVwP/eSZmEJBY7OOAYE4459dCgaiD2LWhspZTr0zM24gc "C# (Visual C# Compiler) – Try It Online") Er, the OP's test case is faulty. Either you remove all text between any two symbols, or you remove all text only between like symbols. OP does both in his test case... So I'm doing only between like symbols. Takes as input the string to search and the character set to use. OP is incorrect about the output, though. It reads, ``` , Howarm y congruum dor ingqussld... ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/181601/edit). Closed 4 years ago. [Improve this question](/posts/181601/edit) So, you have a random list (random meaning it doesn't matter what order it is in) of numbers with a length of `n`, where n is a positive integer smaller than 1000 and larger than 1. The random list must contain every number from `0 to (n - 1)`. Eg: [0, 3, 2, 5, 1, 4] (where n is 6). **Note: If there is more than one digit you do not translate like English - 11 is not "eleven", it is "one one".** Your task is to sort these numbers, but there are some difference to normal sorting: 1. You **have** to sort them as if they were the numbers expressed as words, in alphabetical order, but you cannot replace the numbers with letters [1] 2. At any given time, the list must contain exactly the same numbers in the exact quantities as the original list, you cannot add or remove any **Test Cases** ``` n = 6 [0, 3, 2, 5, 1, 4] = [5, 4, 1, 3, 2, 0] (sorted like this but not this - ["five", "four", "one", "three", "two", "zero"]) n = 8 [0, 3, 7, 2, 5, 1, 6, 4] = [5, 4, 1, 7, 6, 3, 2, 0] (sorted like this but not this - ["five", "four", "one", "seven", "six", "three", "two", "zero"]) ``` This is `code-golf`, so the smallest answer in **bytes** wins. [1]: You may create another list to do the sorting, but the original list must have the same contents at all times [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 21 bytes ``` #~SortBy~IntegerName& ``` there is also a message that shouldn't be there [Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b7X7kuOL@oxKmyzjOvJDU9tcgvMTdV7X9AUWZeiUNadFBiXkp@bnBibkFOKoiTnhptoKNgGhsby4VfiTlhJYYGQDX/AQ "Wolfram Language (Mathematica) – Try It Online") ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/168466/edit). Closed 5 years ago. [Improve this question](/posts/168466/edit) **Challenge:** Create a program that prints out the size of its own source code file. For example, a 35 bytes size of program must print out 35. **Pre-calculation** is not valid. What I mean by pre-calculation is: ``` // test.js -> its size is 15 byte console.log(15) ``` **It must dynamically calculate the size of own source code file.** The winner is who prints the minimum number , same as who has the minimum size of code. [Answer] # [APL (Dyalog Unicode)](https://www.dyalog.com/), 10 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set") ``` ≢⊃⌽⎕NR⊃⎕SI ``` [Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKO94P@jzkWPupof9ex91DfVLwjE7Jsa7AmS@68ABgUA "APL (Dyalog Unicode) – Try It Online") Prints 11 because TIO's APL is set up to auto-format the code, but on a system where this isn't the case, it prints 10: [![Session](https://i.stack.imgur.com/SbnKZ.png)](https://i.stack.imgur.com/SbnKZ.png) `⎕SI` **S**tate **I**ndicator (list of all functions on the stack) `⊃` pick the first one (i.e. the currently running function) `⎕NR` **N**ested **R**epresentation (one character list per line) `⌽` reverse (to bring the actual code line to the front) `⊃` pick the first (i.e. the code line) `≢` tally the characters of that [Answer] # Python 3, 32 bytes Not much to say really, opens the file and checks the length of its contents as a string. ``` print(len([*open(__file__)][0])) ``` There might be something shorter but I couldn't think of it. *Edit: [Try it Online!](https://tio.run/##K6gsycjPM/7/v6AoM69EIyc1TyNaK78ASMXHp2XmpMbHa8ZGG8Rqav7/DwA) (stolen from the comments - thanks for the reminder!)* [Answer] # [JavaScript (Node.js)](https://nodejs.org), ~~40~~ 20 bytes *-20 thanks to @Shaggy* ``` f=_=>("f="+f).length ``` ``` f=_=>("f="+f).length alert(f()) ``` ]
[Question] [ **This question already has answers here**: [Sing Happy Birthday to your favourite programming language](/questions/39752/sing-happy-birthday-to-your-favourite-programming-language) (207 answers) [We're no strangers to code golf, you know the rules, and so do I](/questions/6043/were-no-strangers-to-code-golf-you-know-the-rules-and-so-do-i) (73 answers) Closed 7 years ago. The Zen of Python must surely be one of the most beautiful Easter eggs in any language. (It is created by writing `import this`) So why not create a version for your own language? For those who don't have access to Python 2 or 3, your code should output the following: ``` The Zen of [YOUR LANGUAGE] Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! ``` *The original was `The Zen of Python, by Tim Peters`.* This is code-golf, so the shortest answer in bytes wins. Standard loopholes apply, this includes no built-ins (if you are making a solution in Python, Pyth or another derivative of Python, the equivalent of `import this` is forbidden). [Answer] # JavaScript (ES6) 665 bytes ``` f=a=>{for(_="._eds ieaouobvishld itxplicpecial idonesaty ennever th to mplbetter an explain, e Althgh If iemti`ThZ of JS__ButifuluglyEiicSiecoexCoexcoicFlntSparsedseRdabilcntsScas ar't sghbrk rulpracticalbepuryError passiltlyUnlelsilcIn facof ambiguy, refusthtemptigusTherbe-- and preferabll--waydo th wamanot b first unly'rDutchNowoft *right* nowhard'a badsy maba goodNampac arhking gre -- let'do morof ose!`";G=/[-]/.exec(_);)with(_.split(G))_=join(shift());return eval(_).split`_`.join` `} ``` Because of string compression, some characters cannot be displayed in this snippet. This is above script hex-encoded: ``` 663D613D3E7B666F72285F3D222E5F1D65641D1C73201B20691B1A6561196F75186F627669181B177368186C64201669741578706C6963151470656369616C201320696419126F6E1165731061740F79200E656E0C6E657665720B2074680920746F20086D706C0762657474657209616E2006086578706C61696E2C2015056520041D416C746818676820031D496609046907656D0C740F69111A021A0601605468045A0C206F66204A535F5F421975746966756C0175676C791D45140169076963151D5369076501636F0765781D436F07657801636F0769630F1C466C0F016E10741C53706172736501640C73651D5219646162696C150E63186E74731D5313636173102061720C27742073130C186768086272196B090472756C100370726163746963616C150E62650F1B70757215791D4572726F721B160B207061731B73696C0C746C791D556E6C101B65146C0E73696C0C631C496E0904666163046F6620616D6269677515792C2072656675730474680474656D70740F691108677510731D546865720416620411652D2D20616E642070726566657261626C0E116C0E11042D2D1777617908646F20150374680F2077610E6D610E6E6F74206204170F20666972737420756E6C101B791827720444757463681D4E6F77010B030B1A6F66740C20062A72696768742A206E6F77026861726405271B6120626164120219737905206D610E62046120676F6F64121D4E616D107061631020617204110468116B696E67206772650F12202D2D206C6574271B646F206D6F72046F66096F73652160223B473D2F5B012D1D5D2F2E65786563285F293B2977697468285F2E73706C6974284729295F3D6A6F696E2873686966742829293B72657475726E206576616C285F292E73706C6974605F602E6A6F696E600D0A607D ``` It can be compiled using the following function: ``` f=a=>eval(a.match(/../g).map(a=>String.fromCharCode(parseInt(a,16))).join``) ``` # [Demo](https://jsfiddle.net/d39zc7gv/2/) ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/92322/edit). Closed 7 years ago. [Improve this question](/posts/92322/edit) I have a list of images grouped numerically (`YI0.png`, `YI1.png`...`YI20479.png`). I want them sorted alphabetically, like so: ``` YI0.png -> YIA.png YI1.png -> YIAA.png ``` without my last image having 20479 `A`s in it. ## Input A directory name. ## Output All files in that directory will be alphabetically renamed. ## Constraints * The pattern is always `Prefix` `Number`.`Extension` * There are no subdirectories * All files in the directory adhere to the pattern * `Number` starts at 0 * `Prefix` doesn't contain numbers ## Example Directory consisting of `Pie0.txt`, `Pie1.txt`, all the way to `Pie11.txt` would be renamed to `PieA.txt`, `PieB.txt`, all the way to `PieL.txt`. If it goes to `Pie28.txt`, they would be renamed like so: ``` Pie0.txt -> PieA.txt Pie1.txt -> PieAA.txt Pie2.txt -> PieAB.txt Pie3.txt -> PieB.txt Pie28.txt -> PieZ.txt ``` Remember, this is **[code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")**, so the answer in the shortest bytes wins. [Answer] # Perl, 65 bytes Assumes the number sequence starts with 0 and has no holes (or duplicates if there are extra leading zeros). No error checking. Assumes only plain files, filenames do not start with `.` and the user can enter the directory. Run with the directory as argument ``` alphaorg.pl directory ``` `alphaorg.pl`: ``` #!/usr/bin/perl chdir pop;$a=A;@F=sort map$a++,<*>;rename$_,s/\d+/$F[$&]/r for<*> ``` If the directory name can't contain digits and your sytem will accept `/` as directory separator (unix and windows do), this 61 byte version is shorter (give directory name on STDIN here): ``` #!/usr/bin/perl -ln $a=A;@F=sort map$a++,@;=<$_/*>;rename$_,s/\d+/$F[$&]/r for@ ``` [Answer] # Haskell - 97 bytes I probably picked the wrong language; Haskell has painfully long names for IO operations ``` r p=do f<-getDirectoryContents p;sequence_.zipWith renameFile(sort f).sort$permutations['A'..'Z'] ``` *(this program has O(26^26) in run-time unless you're on a quantum computer)* ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/80224/edit). Closed 7 years ago. [Improve this question](/posts/80224/edit) # Challenge Joe the rapper is struggling with rhyming words in his lyrics. He needs your help. For this situation, we will use rhymes where the last syllable in a word is the same as the other word (spelled the same). When Joe inputs a word, the program will read a list of words from a file and output those that rhyme with Joe's word. To show that the program works, we will only need to use a small list. txt File: ``` hello joe crew flow time apple heart glow rhyme art jello grew doe flue blow smart dime cat slime show bedtime clue grime toe dart cart brew snow prime hat chart lime blue knew lunchtime restart ``` # Examples Input: `snow` Output: `blow flow glow show` *Note- Should not output the input* Input: `fart` Output: `restart art dart cart chart smart heart` *Note- Should work for inputs not in list* Input: `crime` Output: `time slime prime grime dime lime bedtime lunchtime` *Note- Should work for all syllables* # Rules 1. Should output all words that rhyme with input *does not need to output rhymes with different letters Ex: `Crime` should not output `rhyme`* 2. Should not output the input 3. Should work with inputs not in the list 4. Should work will all syllables Shortest Bytes Wins! [Answer] # Ruby, 68 bytes FGITW. Full program, takes file and word from command line: `ruby script.rb words.txt "hello"`. Assumes the last syllable (or rather, the section of the syllable to match against for the purposes of rhyming) is at least 2 characters long, or more if there are extra vowels before that. ``` f,w=$* w=~/[aeiou]*..$/ puts open(f).map(&:chomp).grep(/#{$&}$/)-[w] ``` [Answer] ## JavaScript (ES6), 67 bytes ``` (a,w)=>a.filter(s=>s!=w&s.endsWith(w.replace(/.*([aeiou].)/,"$1"))) ``` Function that accepts an array of words and an input word as parameters. Uses the definition of rhyme as the substring of the word starting at the last vowel before the last letter. ``` a= (a,w)=>a.filter(s=>s!=w&s.endsWith(w.replace(/.*([aeiou].)/,"$1"))) ; u=w=>r.value=a(f.value.split`\n`,w).join`\n` ``` ``` File: <textarea rows=5 id=f> hello joe crew flow time apple heart glow rhyme art jello grew doe flue blow smart dime cat slime show bedtime clue grime toe dart cart brew snow prime hat chart lime blue knew lunchtime restart </textarea> <br> Word: <input oninput="u(this.value)"> <br> Rhymes: <textarea rows=5 id=r> </textarea> ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/80108/edit). Closed 7 years ago. [Improve this question](/posts/80108/edit) ### Introduction The arithmetic mean is defined as being equal to the sum of the numerical values of each and every observation divided by the total number of observations. Symbolically, if we have a data set containing the values *a*1,…,*an*. The arithmetic mean *A* is defined by the formula [![A=\frac{1}{n}\sum_{i=1}^n a_i.](https://i.stack.imgur.com/7liLD.png)](https://i.stack.imgur.com/7liLD.png) ### Objective The challenge here is, given a non-empty list of observations, to calculate the arithmetic mean without any built-ins for mean, sum, division, or count. All other operations are allowed, e.g. median, product, multiplication, and sequence generation. If your language cannot process lists without knowing the number of elements it has, you may use a counting built-in for such (looping, loading, etc.) purpose **only**, but not for the actual computation. ### Test cases `[5]` → `5` `[1,-2]` → `-0.5` `[6,1,3]` → `3.333333333` If your language can handle complex numbers: `[5,1+3i]` → `3+1.5i` [Answer] # Pyth, 13 bytes ``` l@*F^L2Qhe.ek ``` [Try it online!](http://pyth.herokuapp.com/?code=l%40%2aF%5EL2Qhe.ek&input=%5B6%2C1%2C3%5D&debug=0) Uses exponential arithmetic to replace sum and division. Uses enumerate to find number of elements. [Answer] # Retina, ~~46~~ 37 bytes ``` +`x; ;x ;x ;;:x ; x ^(x+):(\1)*x* $#2 ``` [Try it online!](http://retina.tryitonline.net/#code=K2B4Owo7eAo7eAo7Ozp4CjsKeApeKHgrKTooXDEpKngqCiQjMg&input=eHh4eHh4O3g7eHh4) It's quite a trouble not to use arithmetic... ]
[Question] [ **This question already has answers here**: [Code-Golf: Permutations](/questions/5056/code-golf-permutations) (30 answers) Closed 9 years ago. Given a string of English alphabet characters, write the shortest code to print all possible permuations in lexicographical order without using any language based library. ``` def function('bca'): return all_permutation. ``` This should return : ``` abc, acb, bac, bca, cab, cba ``` [Answer] # Python - ~~131~~ 129 chars ``` def g(a,z): if len(a)<1:print(z) else: for i in range(len(a)):g(a[:i]+a[i+1:],z+a[i]) def f(s): a=list(s) a.sort() g(a,'') ``` Only after coding it I noticed that you wrote both "print" and "return" in the question... my solution prints the permutations, I hope that's alright. [Answer] ## Python - 83 bytes ``` p=lambda a,*s:sorted(sum([p(a[:i]+a[i+1:],a[i],*s)for i in range(len(a))],[]))or[s] ``` Sample usage: ``` >>> p=lambda a,*s:sorted(sum([p(a[:i]+a[i+1:],a[i],*s)for i in range(len(a))],[]))or[s] >>> p('abc') [('a', 'b', 'c'), ('a', 'c', 'b'), ('b', 'a', 'c'), ('b', 'c', 'a'), ('c', 'a', 'b'), ('c', 'b', 'a')] ``` --- Without the `sorted` call, this narrowly beats out [ugoren's answer](https://codegolf.stackexchange.com/a/5058) to the linked question at 75: ``` p=lambda a,*s:sum([p(a[:i]+a[i+1:],a[i],*s)for i in range(len(a))],[])or[s] ``` ]
[Question] [ **Input**: a word (2-100 characters) Convert this word to a palindrome: * delete character - 13 points * add character - 12 points * increase character - 5 points ('d' > 'e') * decrease character - 4 points ('n' > 'm') * switch 2 characters - 7 points What is the minimal points needed to make the word palindrome? (C++/C#) **Output**: Minimal points needed to convert the word **Winning criteria**: fastest algorithm [Answer] Spent about an hour and got a working solution that I believe should give an optimal result: ``` public class PalindromeFinder : IComparer<Tuple<int,string>> { public PalindromeFinder() { heap = new IntervalHeap<Tuple<int, string>>(this); handles = new Dictionary<string, IPriorityQueueHandle<Tuple<int, string>>>(); } private readonly IntervalHeap<Tuple<int, string>> heap; private readonly Dictionary<string, IPriorityQueueHandle<Tuple<int, string>>> handles; public int FindMinValue(string startingWord) { AddWord(startingWord,0); while(!heap.IsEmpty) { var item = heap.DeleteMin(); var word = item.Item2; var value = item.Item1; handles.Remove(word); if(IsPalindrome(word)) { return value; } for(int i = 0; i<word.Length; i++) { //decrease var decreased = word.ToCharArray(); if (decreased[i] > 'a') { decreased[i]--; AddWord(new string(decreased), value + 4); } //switch for(int j = i+1; j<word.Length; j++) { if (word.Count(x => x == word[i]) >= 2 || word.Count(x => x == word[j]) >= 2) { var swap = word.ToCharArray(); var tmp = swap[i]; swap[i] = swap[j]; swap[j] = tmp; AddWord(new string(swap), value + 7); } } //add character before (only add characters already present) foreach (char c in word.Distinct()) { var added = word.Insert(i, c.ToString()); AddWord(added, value+12); } } //add character at end of word foreach (char c in word.Distinct()) { var added = word + c.ToString(); AddWord(added, value + 12); } } return int.MaxValue; } private void AddWord(string word, int value) { var min = int.MaxValue; if(handles.ContainsKey(word)) { var tuple = heap.Delete(handles[word]); min = tuple.Item1; handles.Remove(word); } IPriorityQueueHandle<Tuple<int, string>> handle = null; heap.Add(ref handle,new Tuple<int, string>(Math.Min(min, value), word)); handles[word] = handle; } private bool IsPalindrome(string word) { int left = 0; int right = word.Length - 1; while(left<right) { if (word[left] != word[right]) return false; left++; right--; } return true; } public int Compare(Tuple<int, string> x, Tuple<int, string> y) { return x.Item1 - y.Item1; } } ``` Uses priority queue implementation from C5 collections. This is basically the brute force best-first search solution to the problem. It runs out of memory pretty fast, and is less efficient than is probably possible. I could fix that by implementing a better data structure like a DAWG, but out of time for now. Maybe later.It does work well for short words, and even for long ones that are within a few steps of a palindrome already. ### Edit: Made some improvements on Peter's suggestion, but the complexity is still too high. On input: "superman", runs for about a minute until it runs out of memory with over 11 million items in heap and a max value of 42 reached. Still a bit off from being a viable general solution. [Answer] ## C++ Made this under the assumption that simply changing the character costs the same as switching two characters(7 points) & that comparing costs 0 points. A pretty basic & dumb solution, but it works. ``` int main(int argc, char *argv[]) { int c, l, p; p = 0; if(argc != 2) { cout<<"Incorrect arguments\n"; return 1; } else if(strlen(argv[1])<2 || strlen(argv[1])>100) { cout<<"Not a valid string(between 2 & 100 characters)\n"; return 1; } l = strlen(argv[1]); c = l/2; for(int i=0;i<c;i++) { if(argv[1][i] != argv[1][l-i-1]) { argv[1][i] = argv[1][l-i-1]; p+=7; } } cout<<argv[1]<<endl<<p<<endl; return 0; } ``` ]
[Question] [ **This question already has answers here**: [Greatest Common Divisor](/questions/77270/greatest-common-divisor) (85 answers) [Least Common Multiple](/questions/94999/least-common-multiple) (49 answers) Closed 7 months ago. Note: most of the questions that are already in existence about this topic only deal with two numbers as inputs. This question deals with any number (>1) of inputs. ## GCD The GCD (greatest common divisor) of a list of integers is the largest integer which divides all of the numbers in the list. For example: * \$gcd(9, 12, 15) = 3\$ * \$gcd(25, 75, 95) = 5\$ * \$gcd(5, 7, 9) = 1\$ ## LCM The LCM (lowest common multiple) of a list of integers is the smallest integer which can be divided by all of the numbers in the list. For example: * \$lcm(2, 3, 4) = 12\$ * \$lcm(5, 7, 9) = 315\$ * \$lcm(10, 15, 21) = 210\$ ## Your task You need to find the GCD and LCM of a list of integers which you will take as input from the user. As this is a [sequence](/questions/tagged/sequence "show questions tagged 'sequence'") challenge, you can take the input in any format, and output in any format. Here are some test cases: ``` Input Output 1 2 3 4 1 12 10 20 30 40 10 120 7 9 11 13 1 9009 2 3 5 7 11 13 17 19 1 9699690 2 4 6 8 10 2 120 ``` [Answer] # [Ruby](https://www.ruby-lang.org/), 35 bytes ``` ->l{[:gcd,:lcm].map{|x|l.reduce x}} ``` [Try it online!](https://tio.run/##KypNqvyfZvtf1y6nOtoqPTlFxyonOTdWLzexoLqmoiZHryg1pTQ5VaGitvZ/gUJadLShkY6JiY6lWWzsfwA "Ruby – Try It Online") [Answer] # [Numlang](https://github.com/nayakrujul/numlang-9ee9), 8 bytes ### Code ``` $;Gy;OCy ``` ### Explanation ``` $;Gy;OCy $; // Take input from user (implicitly store in y) Gy; // Get the GCD of y (implicitly store in l) O // Output the last used variable (l) Cy // Get the LCM of y (implicitly store in l) // Implicitly output the last used variable (l) ``` [Answer] # [Python 3.9](https://python.org), 44 bytes ``` lambda l:(gcd(*l),lcm(*l)) from math import* ``` In Python 3.8 and lower, `gcd` and `lcm` only accept 2 arguments. This was changed in 3.9, so this answer only works on 3.9+. [Try it online](https://tio.run) does not have the needed version, so I could not post a link to it. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/214568/edit). Closed 3 years ago. [Improve this question](/posts/214568/edit) It is possible ([Wikipedia reference](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Digit-by-digit_calculation)) to compute the square root of any number in a digit by digit fashion using a simple (I had learned it in primary school) algorithm. **Challenge:** * read a positive integer from the user, in base 10, no error check; * compute the square root of that integer using a digit-by-digit algorithm (either Wikipedia's or any alternative you may devise); * display the result, in base 10, with 30 digits after the decimal point (the result must be truncated at the last digit displayed). **Restrictions:** * no use of builtin or library *mathematical functions*; * only arithmetic operations on integers (addition, subtraction, multiplication, division and module). **Scores:** the shortest correct implementation will be the winner. --- My reference implementation (Python3, 781 bytes) follows: ``` from math import sqrt num = input('Give me an integer, ') n = '0'+num if len(num)%2 else num couples = [int(''.join(digit for digit in tup)) for tup in zip(*[iter(n)]*2)] digits = [] n=0 rem = 0 for couple in couples: target = rem*100 + couple base = n*20 for i in range(11): if (base+i)*i > target: break i = i-1 digits.append(str(i)) n = 10*n+i rem = target-(base+i)*i digits.append('.') for dec_digit in range(30): target = rem*100 + 0 base = n*20 for i in range(11): if (base+i)*i > target: break i = i-1 digits.append(str(i)) n = 10*n+i rem = target-(base+i)*i print('From math.sqrt: sqrt(%s) = %r'%(num, sqrt(int(num)))) print('Digit by digit: sqrt(%s) = %s'%(num, ''.join(digits))) ``` --- Some test runs: ``` boffi@debian:~/.../tmp$ python3 sqrt.py Give me an integer, 999901 From math.sqrt: sqrt(999901) = 999.9504987748144 Digit by digit: sqrt(999901) = 999.950498774814352559911780286530 boffi@debian:~/.../tmp$ python3 sqrt.py Give me an integer, 4 From math.sqrt: sqrt(4) = 2.0 Digit by digit: sqrt(4) = 2.000000000000000000000000000000 boffi@debian:~/.../tmp$ ``` [Answer] # [Python 3](https://docs.python.org/3/), 156 bytes Uses the algorithm suggested by OP, since this is a golf of the reference implementation. ``` K=input() n=len(K)%2*'0'+K+'0'*60 R=N=0 while n: a,b,*n=n;R=R*100+int(a+b);i=0;N*=20 while~i*~N<=R:i+=1;N+=1 print(i,end='.'[len(n)^60:]);R-=N*i;N=N+i>>1 ``` [Try it online!](https://tio.run/##HY1BCoMwEADveUUuJSaxZWNB0HT9gJBDrqUFpYILspViKb349VQ7hzkNzPxdxiefU2qReH4vmRaM08BZqw@FUaBsazebEkTEgCA@I02D5FrILu9zw8g@YjQOwBIvWWd77QnBB4MFCPnPVzJruGCsyaLzYZOQ82vPKR/4geqkrvuT9b2E@qZ9PGIw5AMGS03jUqo2wP0A "Python 3 – Try It Online") ]
[Question] [ **This question already has answers here**: [Count up folks!](/questions/78448/count-up-folks) (144 answers) Closed 4 years ago. # Introduction So the Challenge is to give out all combinations with two Inputs. The length of the string is also optional and you should be able to edit this. I've selected this channel because I thought it would be very easy to do it "normally" but the challenge itself could be very interesting. I had to create that for one of our employee to make a list with product numbers. I quickly searched the site and I didn't found any other Challenges like this. # Challenge So the input doesn't have to be edited so you can just take the binary system [0,1]. But you have to set the length of the string or char of the output. You can give out all the numbers in a file. You can decide the name and also the file type. The Shortest program in characters wins. # Example Input and Output Input: > > 3 > > > Output example.txt: ``` 000 001 010 100 101 110 111 011 ``` Input: > > 2 > > > Output example.txt: ``` 00 01 10 11 ``` [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 3 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ``` TIã ``` [Try it online](https://tio.run/##yy9OTMpM/f8/xPPw4v//jQE) or [verify a few more test cases](https://tio.run/##yy9OTMpM/W/i6mevpKBrp6Bk/z/E7/Di/zr/jQE). **Explanation:** ``` T # Push 10 Iã # Take the cartesian product of "10" repeated the input amount of times # (and output the resulting list implicitly as result) ``` [Answer] # [Python 2](https://docs.python.org/2/), 46 bytes ``` lambda n:map(('{:0%db}'%n).format,range(1<<n)) ``` [Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUSHPKjexQENDvdrKQDUlqVZdNU9TLy2/KDexRKcoMS89VcPQxiZPU/N/QVFmXolCmoaRJheMaaz5HwA "Python 2 – Try It Online") ]
[Question] [ **This question already has answers here**: [??? Question Marks? [closed]](/questions/163445/question-marks) (2 answers) Closed 5 years ago. # Challenge : Check : * if there are exactly `n` exclamation marks `!` between every `pair` * and whether the sum of **each** pair equals to 10. --- # Input : * A string of arbitary length. * The number of exclamation marks to check for --- # Output : if there are exactly `n` exclamation marks between each pair, return truthy value, otherwise falsy value. --- # Pair : **Pair** is defined as two digits with **at least** one exclamation mark between them --- # Note : * The string may contain + lowercase letters + digits (1-9) + space + and obviously exclamation marks (`!`) * In case no digit pair is found, return a falsy value. * The exclamation will not appear at start or end of the string --- # Examples : ``` asas6!!4somevbss5!!asa5 , 2 ---> true sasdasd3!2ssjdn3! sdf!3 , 1 ---> false asjsj8sj!!!! 2 sjsadasd9!!!!1 , 4 ---> true sal7!!3 , 2 ---> true nodtejsanhf , 2 ---> true 2is digit no excla 5 , 8 ---> true a!1!9!8!2!a , 1 ---> true (thanks @ngn) ``` The last two cases were `false` imo but as suggested by Adam (who has more experience than me and probably knows better :) ), they were made true --- # Winning criteria : this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so shortest code in bytes for each language wins. --- # Don't forget : You must check whether the sum of the two numbers equals 10 or not too, along with whether each pair is separated via `n` exclamation marks --- # Credit ? : @Laikoni found a challenge on coderbyte similar to this : [Here](https://coderbyte.com/editor/guest:Questions%20Marks:JavaScript). O\_o ? I didn't know that --- # Some explanation : @ngn suggested this case `a!!1!2!3a45!6!!a , 1` (return false) ``` a!! --> ignore this 1 --> here we go start ! --> sum so far = 1 2 --> sum = 3, and stop ``` Yep the sum of each pair must be 10 and since the sum of the first pair wasn't 10, no need to go on. :) [Answer] # [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~62~~ 48 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set") Full program. Prompts stdin for string and then for `n`. Now handles cases like `a!1!9!!8!2!a`. Thanks to ngn for saving a bunch of bytes while pointing out failure of some unlisted test cases. Assumes `⎕IO` (**I**ndex **O**rigin) to be `0`, which is default on many systems. ``` ∧/(⎕=¯2+≢¨m),0=10|+/⎕D⍳↑m←'\d!+\d'⎕S'&'⊢⍞∩⎕D,'!' ``` [Try it online!](https://tio.run/##TY49TsNAEIX7PcVOw4IcFHsdJ06RLg0VBW2ahXUSW/6TJkJEok4MUhAUtBRpgIqCG@QocxFnHCmyn6aZT@@9GVOm13Zt0mJR09vnzS1t3l1B1basqfruXzKbHP60Qy/7w0921XMnnvvs9BlPafdPm4@MA2pmwZlZxfROXSh63dPui6rfxtVToLhqW8uTSmHQ4BBggEUWPd4jBgCMAqHF2cEGy@ODRkxs7oNEOwdfeKLtSDAJMQGW1JI30yTGze6JQacpHQEn2@68sKuI7fly3qE6RmnjRbySeSGjp4fUyECE7TnwYAwhaDDdJ070jI8 "APL (Dyalog Unicode) – Try It Online") `⎕D,'!'` concatenate the **D**igits and an exclamation point. `⍞∩` prompt for string and find the intersection with the above (removes all irrelevant chars) `⊢i←` store in `i` (for **i**nput) and yield that `'\d!+\d'⎕S'&'` PCRE **S**earch for a digit, a "!" run, a digit `m←` store in `m` (for **m**atches) `↑` mix the list of strings into a character matrix, padding with spaces `⎕D⍳` find the **ɩ**ndex of each character in the **D**igits (i.e. "0" → 0, "1" → 1,… "!" and " " → 10) `+/` sum each row (i.e. each pair) `10|` division remainder when divided by 10 (non-digits do not affect this result) `0=` is it 0? (i.e. divisible by ten; max is 18 and min is 2, so no false positives) `(`…`),` prepend the following:  `≢¨m` tally (count the length of) each **m**atch  `¯2+` less 2 (for the two digits, i.e. length of the "!" run)  `⎕=` prompt for `n`; is it equal to the lengths? `∧/` are they all true? (AND reduction) [Answer] # [Python 2](https://docs.python.org/2/), 94 bytes ``` lambda s,c:all(sum(map(int,r))==10for r in re.findall('(\d).*?%s.*?(\d)'%('!'*c),s)) import re ``` [Try it online!](https://tio.run/##XY7vasMgFMW/9ynuDZRoCWUx7ZYOwl6kX2xMWoN/gteN7ekz7cbIKiJez@8cz/wVb96JxXTnxUh7URKo6l@lMYzeLbNyZtrFKnDedfXT6AME0A7CsB@1Uxkr2Vnx/e5tS@nI93LLSix3Pa@I8422sw8xGZY5pCQwrJAk6RnxQN4OHxeiI2J6OhZQgeCbPyxRKu0GBdGkXINAasQmY/UKkzTR1NKEaYGANMlsO@W5zvDhX6Z5wZ@M9VfOqzgko7uNj5LQBEpfdQTnYfjsjYR703ZdAWs8YYsCZQGP9e7ar5il5Rs "Python 2 – Try It Online") ]
[Question] [ See similar question for 2D case: [Find the longest uninterrupted arc](https://codegolf.stackexchange.com/questions/164690) The challenge here is to find the longest uninterruped [great circle](https://en.wikipedia.org/wiki/Great_circle) arc around a unit hypersphere in N dimensions, with a random amount of hyperspheres distributed in random positions around it. Here is a diagram in two dimensions to assist my explanation: [![example](https://i.stack.imgur.com/bScM5.png)](https://i.stack.imgur.com/bScM5.png) All hyperspheres around the edge have a radius of 0.5, although in this diagram, for illustration purposes only, they are smaller. The distance of every hypersphere from the origin at the centre is 1. The red line indicates the largest arc between any two hyperspheres that is not interrupted by any other hypersphere. The challenge is to find the two points on either end of the red line. The green line is simply the straight line distance. A clarification about what interrupted means: When drawing an arc around the edge of the unit hypersphere of radius 1 (the red line), this arc should not be intersected by any other hypersphere. Your function should take an array of double[][] and return the indices of the two hyperspheres with the largest uninterrupted arc. ``` int[] FindPair(double[][] points) { return new[]{ 0, 1}; //Find the indices of the two points } ``` The points array contains all of the positions of the hyperspheres in N dimensions, for example: ``` points[i] = {x, y} //2D points[i] = {x, y, z} //3D points[i] = {x, y, z, a} //4D ... ``` Extra clarification: * All points in the input define a circle, sphere or hypersphere with a diameter of 1 (radius 0.5) * The two points outputted define the start and end of an arc drawn around the edge of a hypersphere with origin 0,0 and radius 1. (Great circle arc). * If any other hypersphere than the two outputted hyperspheres intersects the arc then the solution is invalid. * You can assume that the distance from the origin of all given hyperspheres is 1. * If there is no valid solution (all arcs are intersected by other hyperspheres) then the function should output an empty array * Arcs between two points which are perfectly antipodal should be disregarded, since there exist infintely many great circle arcs between antipodal points * Do not worry about cases in less than two dimensions * For purposes of numerical error, you can assume that epsilon is 1e-16. This means that you can assume that the result is not changed if the input is changed not more than 1e-16. The answer with the smallest Big O algorithm complexity wins. In case of a tie, shorter code wins. **Test case 1 (2D)**: ``` Points: { { -0.71997 , -0.69400 }, { 0.88564 , 0.46437 }, { 0.78145 , -0.62397 }, { 0.98409 , -0.17765 }, { 0.88220 , 0.47087 }, { 0.69938 , 0.71475 }, { -0.89036 , -0.45526 }, { -0.70588 , -0.70833 }, { 0.70507 , 0.70914 }, { -0.34971 , 0.93686 } } There is only one valid arc here which is: {2, 3} ``` **Test case 2 (2D):** ``` Points: { { -0.71038 , 0.70382 }, { 0.04882 , 0.99881 }, { -0.53250 , -0.84643 }, { -0.86814 , -0.49632 }, { 0.97588 , -0.21829 }, { 0.73581 , -0.67719 }, { 0.88413 , -0.46724 }, { -0.28739 , -0.95781 }, { -0.68325 , 0.73019 }, { 0.91879 , 0.39475 }, { 0.65335 , 0.75706 }, { -0.21009 , -0.97768 }, { -0.94542 , -0.32585 }, { 0.83207 , -0.55467 }, { 0.99482 , 0.10170 }, { 0.86228 , 0.50643 }, { 0.98017 , 0.19817 }, { 0.67520 , 0.73763 }, { -0.03982 , -0.99921 }, { -0.57624 , -0.81728 } } Again only one valid arc which is: {0, 8} ``` **Test case 3:(3D)** ``` Points = { { 0.01973 , -0.99317 , -0.11502 }, { -0.71738 , -0.67848 , 0.15822 }, { 0.84743 , -0.50733 , -0.15646 }, { 0.87628 , 0.25076 , 0.41140 }, { -0.48299 , 0.50965 , -0.71202 }, { 0.69096 , 0.57799 , -0.43417 }, { 0.51743 , 0.67876 , 0.52110 }, { 0.78261 , -0.45122 , -0.42886 }, { 0.40781 , -0.46859 , -0.78366 }, { 0.65068 , -0.64966 , 0.39314 }, { -0.09253 , 0.95421 , 0.28447 }, { -0.01408 , 0.38357 , 0.92340 }, { 0.57281 , 0.65041 , -0.49885 }, { 0.19617 , -0.24506 , -0.94945 }, { -0.51822 , 0.34419 , 0.78293 }, { 0.46704 , -0.14902 , 0.87159 }, { -0.71731 , 0.68775 , 0.11162 }, { -0.37867 , -0.17063 , 0.90967 }, { -0.75267 , 0.03982 , 0.65719 }, { -0.56779 , 0.34520 , -0.74730 } } There are 19 valid arcs here, the largest of which is: Answer: {1, 9} ``` **Test case 4: (4D)** ``` Points = { { -0.29024 , 0.35498 , -0.79921 , -0.79921 }, { -0.62641 , 0.38217 , -0.54689 , -0.54689 }, { -0.15500 , 0.97029 , -0.14852 , -0.14852 }, { 0.39689 , 0.40861 , -0.68332 , -0.68332 }, { 0.71300 , -0.29992 , -0.60949 , -0.60949 }, { 0.49510 , 0.64115 , 0.30312 , 0.30312 }, { -0.01944 , -0.94146 , 0.07992 , 0.07992 }, { 0.50442 , -0.42007 , -0.44106 , -0.44106 }, { 0.12829 , 0.34220 , -0.62093 , -0.62093 }, { -0.60989 , -0.52113 , -0.58193 , -0.58193 }, { 0.21290 , 0.50385 , 0.66164 , 0.66164 }, { -0.63566 , 0.04453 , 0.18066 , 0.18066 }, { -0.02630 , 0.86023 , 0.50700 , 0.50700 }, { 0.90530 , 0.08179 , -0.41634 , -0.41634 }, { 0.49062 , -0.51654 , 0.43727 , 0.43727 }, { -0.56405 , 0.57448 , -0.32617 , -0.32617 }, { 0.14677 , -0.14756 , 0.77293 , 0.77293 }, { -0.16328 , -0.37123 , 0.49193 , 0.49193 }, { -0.46471 , 0.07951 , 0.43186 , 0.43186 }, { -0.54567 , 0.43537 , -0.49301 , -0.49301 } } There are 16 valid arcs here, the largest of which is: Answer: {9, 17} ``` [Answer] The best solution I have found so far. Involves sampling points. Any suggestions for improvement would be appreciated. It is also the algorithm I have used to generate the test cases, so if it is incorrect, the test cases may be incorrect. **C#, O(N^3), lots of bytes** ``` private const double Epsilon = 1e-16; public static int[] Find(double[][] points) { var p1 = 0; var p2 = 0; var maxDist = 0d; //Compare each sphere with each other sphere for (var i = 0; i < points.Length - 1; i++) { for (var j = i + 1; j < points.Length; j++) { var d = FindMaxDist(points, i, j, 100); if (d > maxDist) { p1 = i; p2 = j; maxDist = d; } } } if (maxDist > 0) { return new[] { p1, p2 }; } return new int[] { }; } private static double FindMaxDist(double[][] points, int p1, int p2, int sampleCount) { var originalDist = Dist(points[p1], points[p2]); //Disregard antipodal points if (originalDist > 2-Epsilon) return 0; var dimensions = points[0].Length; var vector = new double[dimensions]; //Find the straight line vector between the two points for (var j = 0; j < dimensions; j++) vector[j] = (points[p1][j] - points[p2][j]); //Generate samples along the arc var pointSamples = new double[sampleCount][]; for (var i = 0; i < sampleCount; i++) { pointSamples[i] = new double[dimensions]; //Clone the vector before resizing to avoid numerical error due to multiple resizes var newV = ClonePoint(vector); //How far are we along the line between the two points depending on the current sample number? var newLength = (1 / ((double)sampleCount + 1)) * (i+1) * originalDist; ResizeVector(newV, newLength); //Set the position of the sample for (var j = 0; j < dimensions; j++) pointSamples[i][j] = points[p1][j] - newV[j]; //The sample will lie on a straight line between the two points, not an arc //Scale it so that it lies a distance of 1 from the origin, in order to be on the arc ResizeVector(pointSamples[i]); } //Now simply check the samples for intersections for (var i = 0; i < sampleCount; i++) { for (var j = 0; j < points.Length; j++) { if (j == p1 || j == p2) continue; var d = Dist(points[j], pointSamples[i]); if (d < 0.5) return 0; } } return originalDist; } //The distance between two points public static double Dist(double[] d1, double[] d2) { double dist = 0; for (var i = 0; i < d1.Length; i++) { var diff = d1[i] - d2[i]; dist += diff * diff; } return Math.Sqrt(dist); } public static double[] ClonePoint(double[] point) { var p = new double[point.Length]; Array.Copy(point, p, point.Length); return p; } public static void ResizeVector(double[] pos, double targetLength = 1) { var currentLength = VectorLength(pos); var scale = targetLength / currentLength; for (var i = 0; i < pos.Length; i++) pos[i] *= scale; } public static double VectorLength(double[] vector) { double length = 0; for (var i = 0; i < vector.Length; i++) length += vector[i] * vector[i]; return Math.Sqrt(length); } ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/144876/edit). Closed 6 years ago. [Improve this question](/posts/144876/edit) For the purpose of this challenge, a multi-base prime is a prime which, when written in base 10, is prime in one or more bases smaller than 10 and larger than 1 as well. All single-digit primes are trivially multi-base primes. 11 is also a multi-base prime, as 11 in binary is 3, which is prime (it is also prime in base 4 and base 6). The first few terms are: 2,3,5,7,11,13, 17, 23,31,37,41,43,47,53,61... ## Your Task: Write a program or function that, when given an integer as input, returns/outputs a truthy value if the input is a multi-base prime, and a falsy value if it is not. ## Input: An integer between 1 and 10^12. ## Output: A truthy/falsy valule, depending on whether the input is a multi-base prime. ## Test Cases: ``` 3 -> truthy 4 -> falsy 13 -> truthy 2003 -> truthy (Also prime in base 4) 1037 -> falsy (2017 in base 5 but not a prime in base 10) ``` ## Scoring: This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), lowest score in bytes wins! [Answer] # [Python 2](https://docs.python.org/2/), ~~159~~ 137 bytes ``` f=lambda n:p(n)*any(p(b(n,i))for i in range(2,10)) p=lambda n:all(n%x for x in range(2,int(n**0.5)+1)) b=lambda n,i:n and n%i+10*b(n/i,i) ``` [Try it online!](https://tio.run/##TY3BCoMwEETv/Yq9CLtR2kRbBKEfE7G2C3YM4kG/Pk2h1Nxmhnm8sK@vGXWM433y737whC4wxHjsHLhnVCoyzgspKWjxeD64rpwVOYUD8dPEKDb6Hrf8qFgZxtjzTUqXmP7PVNqBPAZCoaWzJqkummQxLAmikZtk@MXrEV0219ZmzdmmzVrbSPwA "Python 2 – Try It Online") Saved 22 bytes thanks to ovs. [Answer] # Mathematica, 60 bytes ``` Or@@(p=PrimeQ)[FromDigits/@IntegerDigits[#,2~Range~9]]&&p@#& ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78n27737/IwUGjwDagKDM3NVAz2q0oP9clMz2zpFjfwTOvJDU9tQjCjVbWMaoLSsxLT62zjI1VUytwUFb7D9SVV6LgkB5taGBsHvv/PwA "Wolfram Language (Mathematica) – Try It Online") [Answer] # [Japt](https://github.com/ETHproductions/japt/), ~~15~~ 14 bytes ``` j ©Ao2@sX nÃdj ``` [Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=aiCpQW8yQHNYIG7DZGo=&input=MjAwMw==) --- ## Explanation Implicit input of integer `U`. ``` j ``` Test if input is prime (Boo-urns to input validation!). ``` © ``` Logical AND (`&&`). ``` Ao2@ Ã ``` Generate an array of integers from `2` to `9` and pass each through a function where `X` is the current element. ``` sX n ``` Convert `U` to a base-`X` string (`s`) and back to an integer (`n`). ``` dj ``` Check if any of the numbers in the array are prime. ]
[Question] [ **This question already has answers here**: [Draw an ASCII Rectangle](/questions/93707/draw-an-ascii-rectangle) (41 answers) Closed 6 years ago. NOTE: This question is different than [Draw an ASCII Rectangle](https://codegolf.stackexchange.com/questions/93707/draw-an-ascii-rectangle) because the user has to input only 1 number to generate a box, unlike the other question, where the user has to input the x and y size of the box. Your task is to create a box based upon user input. Let's say I inputted 2. The box generated would look like: ``` -- -- ``` As in, two by two long. Or, if I entered 7: ``` ------- | | | | | | | | | | ------- ``` So, seven by seven. Notice the box generated above has 5 bars up and seven hyphens across. The hyphen directly above or below the bars does count as one vertical iteration. One more example. I enter 5. The box generated: ``` ----- | | | | | | ----- ``` You can use any programming language you wish. The task is to be able to generate a box using the *least* possible amount of bytes. Current leaderboard: [1] dzaima in SOGL, 17 bytes [2] Adam in APL, 27 bytes [3] HyperNeutrino in Python, 51 bytes [Answer] # [SOGL V0.12](https://github.com/dzaima/SOGL), ~~21~~ 17 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md) ``` 1.⁰{1.┐∙ž}:┐┌ŗH╬8 ``` [Try it Here!](https://dzaima.github.io/SOGLOnline/?code=MS4ldTIwNzAlN0IxLiV1MjUxMCV1MjIxOSV1MDE3RSU3RCUzQSV1MjUxMCV1MjUwQyV1MDE1N0gldTI1NkM4,inputs=Nw__) Explanation: ``` 1.⁰ push 1, input and wrap in an array { } for each item in that array do 1 push 1 .┐∙ get an array of input amount of items of "|" ž at coordinates [currentArrayItem; 1] place those bars : duplicate it ┐┌ŗ replace "|" with "-" H rotate anti-clockwise ╬8 place the 2nd array over the 1st ``` [Answer] # JavaScript (ES6), ~~61~~ 60 bytes ``` n=>`${h="-"[r="repeat"](n)} ${`|${" "[r](n-=2)}| `[r](n)}`+h ``` [Answer] # [APL (Dyalog)](https://www.dyalog.com/), 27 bytes ``` '-'⍪'-'⍪⍨'|','|',⍨''⍴⍨2⍴-∘2 ``` [Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wR1XfVHvasg5KPeFeo16jogDGIChbYAaSMgpfuoY4YRUMOhFUYK5gqmAA "APL (Dyalog Unicode) – Try It Online") `-∘2` subtract two `2⍴` **r**eshape into length 2 `''⍴⍨` use that as height and width to **r**eshape an empty string (padding with spaces) `'|',⍨` put stiles on the right `'|',` put stiles on the left `'-'⍪⍨` put dashes below `'-'⍪` put dashes on top [Answer] # Python, 51 bytes ``` lambda x:'-'*x+'\n'+('|'+' '*(x-2)+'|\n')*(x-2)+'-'*x ``` I tested this on my laptop and then manually wrote this answer on mobile so please tell me if this doesn't work. ]
[Question] [ # The task Your program will be given the following inputs: a number *n*, and an array of *n* positive integers. Your program only has to work when *n*=1000. The program must do the following: * If the input array is a permutation of the range [1, 2, …, *n*], output `Huh!?` * Otherwise, return a three-element array [*i*, *j*, *n*], where *i* is a number from 1 to *n* inclusive that does not appear in the input array, and *j* is a number that appears more than once in the input array. # Clarifications * Because *n* will always have the same value, your program may get at it three different ways: hardcoding it as 1000, checking the length of the input array, or taking it from input. * Per PPCG rules, you don't have to read an input at all if you don't need it to solve the question. * The input will always be chosen so that there's a unique answer (in other words, the input array will contain no more than one duplicated element). # Test case generator The following test case generator, in the statistical programming language R, will generate an appropriate test case for this challenge. It takes the following inputs: 1. The value of *n*. In order to create an appropriate test case, this should be 1000. 2. The value of *i*. 3. The value of *j*. Here's the generator itself: ``` #!/usr/bin/env Rscript #Random_number_generator_1.R getwd() printf <- function(...) cat(sprintf(...)) print("Please set the range of random numbers from 1 to n \n") this_range = scan(file = 'stdin', what = integer(), nmax = 1) numbers = 1:this_range #print("How many random numbers in this range") # random_numbers = scan(file = "", what = integer(), n = 1) #if(random_numbers > this_range) #{ # remove(random_numbers) # print("Sorry. When Replace = FALSE. It's not possible to have more unique random numbers than the given range") #} random_numbers = sample(numbers) random_numbers = sample(random_numbers) print("Now remove any random number in the available range") number_taken = scan(file = 'stdin' , what = integer(), nmax = 1) random_numbers = random_numbers[random_numbers != number_taken] print("Now insert any random number within the range") number_inserted = scan(file = 'stdin', what = integer(), nmax = 1) random_numbers = append(random_numbers, number_inserted) print(random_numbers) write(random_numbers, file = "my_random_numbers.txt", sep = " ") ``` # Victory condition This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins! [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), ~~27 26  21~~ 18 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) -8 bytes by applying a suggestion from Leaky Nun (use multi-set difference to `J` and a dequeue to replace a length-1 test) ``` ḲµVœ^J;LµḊȧȯ“Huh!? ``` A full program. **[Try it online!](https://tio.run/##DY@9SoQxFERf5egTJLk/ucHCVsTa0k4Q2dbCztrW1t5SEBa2XhD2NdYX@RwIYcKduXPy/LjbvW7b@fBz3N//fjzcXt0d9@fD@@nr9P339nnz8nRxvW3bZQZR9MUcWGNJJGMyjW7MSRXWsSSdaoRRAx@spDqRrKAIpRe9s5TQDicnPunaTRYVTAktVVJHomGGMRyTVaUK452emBoWId0aZeRgNCahClHIEKjeGcHSIPCg6xaIs4Sr25myTzJx4SxWMdQnOn1DlaSMSohfr0Y21COQwuUbiFnjdvkP "Jelly – Try It Online")** ### How? ``` ḲµVœ^J;LµḊȧȯ“Huh!? - Main link: list of characters Ḳ - split at spaces, call this x µ - start a new monadic chain with the result of that on the left V - evaluate as Jelly code (vectorises) -> list of integers J - range(length(x)) -> [1,2,3,...,n] œ^ - multi-set difference -> one of: []; [i,j]; or [j,i] L - length of x -> n ; - concatenate -> one of: [n]; or [i, j, n]; or [j, i, n] µ - new monadic chain, call that r Ḋ - dequeue r -> one of: []; [j, n]; or [i, n] ȧ - logical and with r -> []; [i, j, n]; or [j, i, n] “Huh!? - list of characters "Huh!?" (end of a program so no close quote needed) ȯ - logical or -> one of "Huh!?"; [i, j, n]; or [j, i, n] - implicit print ``` [Answer] # Mathematica, 70 bytes ``` {(a=(Range@1000~Complement~#)[[1]])+Tr@#-500500,a,1000}~Check~"Huh!?"& ``` Anonymous function. Takes a list of numbers as input and returns a list of numbers or a string as output. Ignore any messages generated. Works by finding *j* and then computing *i*. ]
[Question] [ **This question already has answers here**: [What code compiles in the most number of languages? [closed]](/questions/4481/what-code-compiles-in-the-most-number-of-languages) (2 answers) Closed 8 years ago. ## Introduction A known fact is that Jon Skeet [can code Perl and make it look like Java](https://meta.stackexchange.com/a/9156/307207). In this challenge you will try to do something similar. ## Challenge Write a piece of code of any length that can be executed **without any errors/exceptions** in two different languages. Your program can take inputs, give outputs, whatever it wants. The code has to be executed with interpreters/compilers of your choice one after another (with *basic* settings, means you are not allowed to adjust the compiler/interpreter settings). *Note that the source code and any used sources (files, libs and so on) are **not** allowed to change during the execution of the script with the compilers/interpreters.* ## But which languages are "different"? Two languages are different from each other if they are not the same language without looking at the version. **Example:** *Python 3.5* is not different to *Python 2.7*. ## Scoring The final score consists out of several aspects: * **charScore**: Take your code and then (max charScore is 95)... 1. Look at every function and delete all arguments (in *echo "Hello"* "Hello" counts as an argument). So now only keywords and functions count. **Example:** *System.out.println(1+1);* becomes *System.out.println();* 2. Make all strings to empty strings *and all regex and literals* empty. **Example:** *"khffshiufahk"* becomes *""* and all regex (without string) gets deleted. 3. Delete all comments. **Example:** *//Jon Skeet would also do this* becomes *[nothing]* \_Definition of "comment": \_ Anything that doesn't change the execution of the program (So you could simply leave them out and nothing would change). 4. Delete all characters that are not unicode 32-126. **Example:** *print(2²)* becomes *print(2)* 5. Count only the *occurrences* of the letters. **Example:** *hiiiiiii-thhheeeree* has the same score as *hi-there* (means score of 8)Here is a StackSnippet to do step 3 and 4 for you (report me if there is a bug): ``` function calcScore() { var onlyValidChars = ""; var code = document.getElementById("code").value; for (i = 0; i < code.length; i++) { if (code[i].charCodeAt(0)>=32 && code[i].charCodeAt(0)<=126) { //step 3 if (onlyValidChars.indexOf(code[i]) === -1) { //step 4 onlyValidChars += code[i]; } } } return onlyValidChars.length; } function showCalcScore() { alert("Your charScore: "+calcScore()); } ``` ``` <body> <textarea placeholder="Insert your code here." id="code"></textarea> <br> <button type="button" onclick="showCalcScore();">calculate score</button> </body> ``` * **+20** if your code is still executable in both languages now (after the *charScore-changes*) * **+50** if running the code with the different interpreters does different things (eg order change, prints other things etc) * **+15** if your languages are Perl and Java The answer with the highest score wins. **EDIT:** I don't think that [this](https://codegolf.stackexchange.com/questions/4481) is a duplicate (but very releated) because it has no "different language" limits and no score. On the other hand, I didn't know about so-called "polyglot"-code so maybe I am wrong. [Answer] ## PHP + [Lenguage](http://esolangs.org/wiki/Lenguage), 165 Scoring calculation: 95 + 20 + 50. ``` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ``` In PHP, this outputs the string verbatim (since there is no `<?` to signal for the preprocessor functionality). In [Lenguage](http://esolangs.org/wiki/Lenguage), this is an infinite loop. The charScore changes do not affect the program, as it consists of all 95 printable ASCII characters once, so it is eligible for the +20 bonus. ]
[Question] [ **This question already has answers here**: [Paint by Numbers](/questions/42217/paint-by-numbers) (4 answers) Closed 8 years ago. This is a successor to my previous Code Golf challenge, which may be found [here.](https://codegolf.stackexchange.com/questions/50314/approximate-a-given-image-using-only-colors-from-a-given-list) This time, you are trying to determine what the contents of colors.txt should be. Your task is to take from the input the path to an image and a number of colours, and write to colors.txt a list of that many colors chosen for that image. Remember, you are generating pallettes to go with [this challenge.](https://codegolf.stackexchange.com/questions/50314/approximate-a-given-image-using-only-colors-from-a-given-list) As usual, you are going for lowest score, but in this case, your score is given by `ceil(codeSize/(1+max(0,votes)))`, so upvotes will help you as well. For **one or more** of the following images, you should test your generated pallettes (using one of the answers from [this challenge](https://codegolf.stackexchange.com/questions/50314/approximate-a-given-image-using-only-colors-from-a-given-list) to test them) and post the results for a variety of pallette sizes: ![enter image description here](https://i.stack.imgur.com/vgIDd.jpg) ![enter image description here](https://i.stack.imgur.com/akDpm.jpg) ![enter image description here](https://i.stack.imgur.com/0gRuq.jpg) ![enter image description here](https://i.stack.imgur.com/FmNE6.jpg) ![enter image description here](https://i.stack.imgur.com/dQs9o.jpg) ![enter image description here](https://i.stack.imgur.com/HClNW.jpg) ![enter image description here](https://i.stack.imgur.com/1buZg.jpg) [Answer] # Java 796 bytes ``` import java.awt.Color;import java.awt.image.*;import java.io.*;import java.util.*;import javax.imageio.*;public class P{public static void main(String[] a) throws Exception{Random R=new Random();Scanner in=new Scanner(System.in);PrintStream o=new PrintStream("colors.txt");List<Color> col=new ArrayList<Color>();BufferedImage i=ImageIO.read(new File(in.nextLine()));int h=i.getHeight(),w=i.getWidth(),k=in.nextInt(),x,y,z=0,r,g,b;while(col.size()<k&&z<k*k){x=R.nextInt(w);y=R.nextInt(h);Color c=new Color(i.getRGB(x, y));r=5*(c.getRed()/5);g=5*(c.getGreen()/5);b=5*(c.getBlue()/5);c=new Color(r,g,b);if(!col.contains(c)){col.add(c);}z++;}while(col.size()<k)col.add(new Color(R.nextInt(256),+R.nextInt(256),R.nextInt(256)));for(Color c:col)o.println(c.getRed()+" "+c.getGreen()+" "+c.getBlue());}} ``` Picks random colors from the image, with each component rounded to the nearest multiple of 5, such that no color is selected twice. If, after n2 selections, it has not yet found n distinct colors, it picks the rest entirely at random. **Some sample results:** The black spaceship in 10 colors: ![enter image description here](https://i.stack.imgur.com/5x9oG.jpg) In 25 colors: ![enter image description here](https://i.stack.imgur.com/pmxUX.jpg) In 50 colors: ![enter image description here](https://i.stack.imgur.com/ryeXQ.jpg) In 200 colors: ![enter image description here](https://i.stack.imgur.com/kfEAB.jpg) The gold spaceship in 10 colors: ![enter image description here](https://i.stack.imgur.com/VuSHV.jpg) In 25 colors: ![enter image description here](https://i.stack.imgur.com/DPhVn.jpg) In 50 colors: ![enter image description here](https://i.stack.imgur.com/BDZmV.jpg) In 200 colors: ![enter image description here](https://i.stack.imgur.com/ysEYK.jpg) And, finally, the exploding globe in 10 colors: ![enter image description here](https://i.stack.imgur.com/XULo8.jpg) In 25 colors: ![enter image description here](https://i.stack.imgur.com/gwXk6.jpg) In 50 colors: ![enter image description here](https://i.stack.imgur.com/9a1lv.jpg) And in 200 colors: ![enter image description here](https://i.stack.imgur.com/s8cwT.jpg) ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/48453/edit). Closed 8 years ago. [Improve this question](/posts/48453/edit) The question is simple but the answer maybe not! suppose that you have the following lists that all of them are ordered (not consecutive): ``` x = ['one', 'two', 'four'] y = ['two', 'three', 'five'] z = ['one', 'three', 'four'] ``` as you can see there is a logic in each of the above lists for example in `x` we have the following order that is true `'one'<'two'<'four'` and also for other sub lists. So the main list contain all the unique elements from preceding lists that contain `['one','two','four','three','five']` and the task is to find the main ordered list : ``` ['one', 'two', 'three', 'four', 'five'] ``` im not looking for a comprehensive or general answer! because it has not a general answer and it all depend on the number of sub-lists! So whats your idea for this problem or problems like this? [Answer] In general, you might want to use a topological sorting algorithm. This procedure runs in O(*n*) where *n* is the sum of the number of elements in each list. Create a directed graph where each node is one of the distinct elements in the input lists. For each pair of elements adjacent in one of the element lists, add an edge between these two elements in the graph from the lesser element to the greater. Finally, topologically sort that graph. [Answer] # Python (182) I think this might be a bit too long. I might try my hand at a J version of the same algorithm. ``` from itertools import* def f(i): o=[] while len(i)>1:i=[a for a in i if a];o+=[a[0]for a,b in combinations(i,2)if a[0]==b[0]];[j.pop(0)for j in i if j[0]==o[-1]] o+=i[0] return o ``` ## Example: **Input:** ``` i = [['one', 'two', 'four'], ['two', 'three', 'five'], ['one', 'three', 'four']] print f(i) ``` **Output:** ``` ['one', 'two', 'three', 'four', 'five'] ``` [Answer] # Mathematica, 115 bytes Could probably use some `Thread`s here... ``` Sort[Union@##,Function[{a, b},Less@@Function[c,Mean[Flatten@DeleteCases[FirstPosition@c/@{##},_Missing]]]/@{a,b}]]& ``` Written as a pure function, used via `*code*[<first list>, <second list>, ...]`. I don't see how this is dependent on the number of lists. If there is any ambiguity about the order, it chooses a pseudorandom working case. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/44451/edit). Closed 9 years ago. [Improve this question](/posts/44451/edit) Your task is to take the following simple C code and make a program which will interpret this code and produce a correct output, and be able to handle small modifications to the original code. The C code is ``` int x = 4; int y = 5; int z; z = x * y; if(z>10) { printf("%d is bigger than 10!",z); } ``` Or as one line of text. ``` int x = 4; int y = 5; int z; z = x * y; if(z>10){ printf("%d is bigger than 10!",z); } ``` The program must satisfy the following conditions: * x and y can be changed to any integer. * "is bigger than 10!" must not be printed if z is smaller than 10. * The value of 10 can be changed to any integer (not including the 10 in the printed text). * The program must be able to read the c program in as one line of text. * Adding spaces shouldn't break the program. The winning solution is the shortest code to satisfy the criteria. Libraries are not allowed. [Answer] # Perl 5, 76 bytes ``` $_=<>,s/ //g,s/[=>](-?\d+)/$.*=$1/ge,($./=$1)>$1&&say"$. is bigger than $1!" ``` Input must be in one line. Negative integers are allowed. Tabs may break program (but spaces are fine, even between `-` and the number). **Ungolfed:** ``` $_ = <>; # read input # $. = 1; $. is the number of lines read on STDIN, which should be 1. s/ //g; # remove whitespace from $_ s/[=>](-?\d+)/ $. *= $1 /ge; # get product of all integers after = or > $. /= $1; # divide away the last integer found (inside the if) if($. > $1){ say "$. is bigger than $1"; } ``` This simply extracts the integers and does the product/comparison afterwards. **Example**: ``` $ perl -E '$_=<>,s/ //g,s/[=>](-?\d+)/$.*=$1/ge,($./=$1)>$1&&say"$. is bigger than $1!"' > int x =4; int y = - 5 ; int f0_23; f0_23 = x* y ; if ( f0_23> - 30){ printf("%d is bigger than 10!",f0_23) ; } -20 is bigger than -30! ``` ]
[Question] [ A little context: > > * Book has 411 Pages > * Read a random number of pages on the first day which is unknown > * Number of pages to read next day is the square of the sum of the digits of the page currently on > > > I.e. on Page 36: read 81 pages next day > * On day 6 The square answer directly adds to current page number to make 411 > * Finish Book > > > How many pages did she read on the first day and how many pages did > she read on the 6 days? > > > This is what I have so far: ``` from itertools import accumulate, count def read_book( start ): for i in range( 6 ): yield start; start += sum( int( digit ) for digit in str( start ) ) ** 2 def find_start( pages ): for start in count( 1 ): for read in read_book( start ): pass if read == pages: return start previous_answer, start = 0, find_start( 411 ) for i, read in enumerate( read_book( start ), 1 ): print( "Pages read on day", i ,"was", read-previous_answer ,"\t(Now on page", str(read) + ")\n") previous_answer += read-previous_answer ``` Output: > > Pages read on day 1 was 61 (Now on page 61) > > > Pages read on day 2 was 49 (Now on page 110) > > > Pages read on day 3 was 4 (Now on page 114) > > > Pages read on day 4 was 36 (Now on page 150) > > > Pages read on day 5 was 36 (Now on page 186) > > > Pages read on day 6 was 225 (Now on page 411) > > > Is there a more efficient way? Who can do it in the least no. chars [Answer] # gcc - 176 chars I don't grok Python (it is Python right?) so I don't understand how your example works. Is it actually treating the page number as a string? I'm not sure but (at least in C) string handling uses more characters than integers. So to sum the digits of an integer between 0 and 1000 I use: ``` for(s=0,i=1;i<1001;i*=10)s+=(x%i*10)/i; ``` Where x is the input and s is the sum. If you want the sum from some x for 7 days you could: ``` for(c=2;c<7;x+=s*s,c++) for(s=0,i=1;i<1001;i*=10)s+=(x%i*10)/i; ``` Where x is the input and the output. To find the sum for 7 days which matches the number of pages in the book (p): ``` for(y=1;y<p&&x!=p;y++) for(x=y,c=2;c<7;x+=s*s,c++) for(s=0,i=1;i<1001;i*=10)s+=(x%i*10)/i; ``` Where y-1 is the calculated starting page when the sum adds up to p. The whole program with which reads from the command line and prints to stdout: ``` main(_,a)char**a;{ int p=atoi(a[1]),s,i,y,x,c; for(y=1;y<p&&x!=p;y++) for(x=y,c=2;c<7;x+=s*s,c++) for(s=0,i=1;i<1001;i*=10)s+=(x%i*10)/i; if(x==p)printf("%d",y-1);else puts("n/a"); } ``` It surely is possible to golf it some more. If you see something that would help please comment. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/34448/edit). Closed 9 years ago. [Improve this question](/posts/34448/edit) [Here](https://puzzling.stackexchange.com/questions/496/aside-from-brute-force-how-can-i-solve-this-puzzle/1906#1906) I found a cool math problem. I thought you could write some golfed code to compute all answers between x and x.(there is an infinite amount). Problem: Once upon a time, and old lady went to sell her vast quantity of eggs at the local market. When asked how many she had, she replied: Son, I can't count past 100 but I know that: * If you divide the number of eggs by 2 OR 3 OR 4 OR 5 OR 6 OR 7 OR 8 OR 9 OR 10, there will be one egg left. * If you divide the number of eggs by 11 there will be NO EGGS left! How many eggs did the old lady have? i answered the question on that thread with: ``` public static void main(String... args) { for (int i = 0; i < 1000000000; i++) { boolean a = true; for (int x = 2; x < 11; x++) { if (i % x != 1) a = false; } if (i % 11 != 0) a = false; if (a) System.out.println(i); } } ``` Catch: If some sharp eyed person noticed, you could start at 25201 and keep adding 27720 to get to the next one. You can NOT use this machanic to answer the question. So dont post something like this: ``` public class test { public static void main(String... args) { long l=25201; while(true){ System.out.println(l); l+=27720; } } } ``` [Answer] # R, 37 chars ``` n=121;while(!all(n%%2:10==1))n=n+11;n ``` **Edit**: if the question was: "Found all possible answers between x and y" then it's **65** characters as a function: ``` f=function(x,y)(x:y)[!rowSums(outer(x:y,2:10,`%%`)!=1)&!x:y%%11] ``` Example: ``` > f(1,1e5) [1] 25201 52921 80641 ``` ]
[Question] [ Anyone who has spent any time around a deck of playing cards will recognize the riffle shuffle. The deck is cut in half and the two stacks are riffled simultaneously into the same pile before being tidied up in a sometimes visually appealing way. This code-golf challenge is to write a function/method/(language equivalent) that performs the riffle shuffle on an array/stack/(language equivalent) of any size in the language of your choice. As input, your function will except an array (language equivalent), plus how many times to run the shuffle. When done, it will return the shuffled array. Your riffle shuffle function must implement the following algorithm: 1. Divide the `deck` into two `stacks` A `stack` must have a minimum of 40% of the total `cards` in the `deck` and a maximum of 60% 2. Choose a random `stack` to start with 3. Drop 1 - 7 cards from the bottom of the `starting stack` to the top of the newly shuffled `deck` 4. Drop 1 - 7 cards from the bottom of the `other stack` to the top of the newly shuffled `deck` 5. Repeat #3 and #4 until only one `stack` remains 6. Drop the remaining `cards` from the remaining `stack` on top of the newly shuffled `deck` Smallest character count will be chosen as the answer in 1 week (May 29th). This is the sample deck of cards to use: ``` [ 'AH', '2H', '3H', '4H', '5H', '6H', '7H', '8H', '9H', '10H', 'JH', 'QH', 'KH', 'AC', '2C', '3C', '4C', '5C', '6C', '7C', '8C', '9C', '10C', 'JC', 'QC', 'KC', 'KD', 'QD', 'JD', '10D', '9D', '8D', '7D', '6D', '5D', '4D', '3D', '2D', 'AD', 'KS', 'QS', 'JS', '10S', '9S', '8S', '7S', '6S', '5S', '4S', '3S', '2S', 'AS' ] ``` Your answer should contain: * Code-golfed code * What the sample deck looks like after being shuffled twice * Un-golfed code [Answer] # Python (131) Waaaay too long, even for something that came to be after a "careful" reading of the rules: ``` Drop 1 - 7 cards from the bottom of the starting stack to the top of the newly shuffled deck ``` Doens't actually say this should be random, so I'll just always drop 1 card. ``` Divide the deck into two stacks A stack must have a minimum of 40% of the total cards in the deck and a maximum of 60% ``` Sure. I'll just always do about 50%. Anyways, the code: ``` def s(d): b=[d.pop()for _ in range(len(d)/2)];r=[];b,d=(b,d)if id(4)%2 else(d,b) while b and d:r+=[b.pop(),d.pop()] return r+b+d ``` Sample output: ``` In [17]: s(s([ ...: 'AH', '2H', '3H', '4H', '5H', '6H', '7H', '8H', '9H', '10H', 'JH', 'QH', 'KH', ...: 'AC', '2C', '3C', '4C', '5C', '6C', '7C', '8C', '9C', '10C', 'JC', 'QC', 'KC', ...: 'KD', 'QD', 'JD', '10D', '9D', '8D', '7D', '6D', '5D', '4D', '3D', '2D', 'AD', ...: 'KS', 'QS', 'JS', '10S', '9S', '8S', '7S', '6S', '5S', '4S', '3S', '2S', 'AS' ...: ])) Out[17]: ['AD', 'KH', 'AC', 'KS', '2D', 'QH', '2C', 'QS', '3D', 'JH', '3C', 'JS', '4D', '10H', '4C', '10S', '5D', '9H', '5C', '9S', '6D', '8H', '6C', '8S', '7D', '7H', '7C', '7S', '8D', '6H', '8C', '6S', '9D', '5H', '9C', '5S', '10D', '4H', '10C', '4S', 'JD', '3H', 'JC', '3S', 'QD', '2H', 'QC', '2S', 'KD', 'AH', 'KC', 'AS'] ``` This is actually the code as I wrote it, I didn't specifically golfed any code. If you just want an explanation, please say so. [Answer] # Cobra - 307 Don't have access to a compiler atm, so this *should* work, but I'll be able to check later. ``` def f(d,n) as List<of int> r=Random() x=d.count for m in n p=q=[] for c in x if c%2>0,p.add(d.pop) else,q.add(d.pop) if r.next(0,2)>0,a,b=p,q else,a,b=q,p for c in x for z in r.next(0,7),if a.count>0,d.add(a.pop) for z in r.next(0,7),if b.count>0,d.add(b.pop) return d ``` [Answer] # Python 84 ## Golfed: ``` def s(d): e=len(d)/2;B=d[:e];C=d[e:];D=[] for x in range(e):D+=B[x],C[x] return D ``` ## Output Deck: ``` ['AH', 'AC', 'KD', 'KS', '2H', '2C', 'QD', 'QS', '3H', '3C', 'JD', 'JS', '4H', '4C', '10D', '10S', '5H', '5C', '9D', '9S', '6H', '6C', '8D', '8S', '7H', '7C', '7D', '7S', '8H', '8C', '6D', '6S', '9H', '9C', '5D', '5S', '10H', '10C', '4D', '4S', 'JH', 'JC', '3D', '3S', 'QH', 'QC', '2D', '2S', 'KH', 'KC', 'AD', 'AS'] ``` ## Un-golfed: ``` def Shuffle(Deck): Stack1 = Deck[:len(Deck)/2] # 2nd Half of Deck Stack2 = Deck[len(Deck)/2:] # 1st Half of Deck Output = [] # Initialize Output List for index in range(len(Deck)/2): Output.append(Stack1[index]) # Append Output List with element from Stack1 Output.append(Stack2[index]) # Append Output List with element from Stack2 return Output # Return Output ``` Uses the same loopholes as @synthetica. [Answer] # Python, 69 chars (actually takes number of times to shuffle as input) If one follows the algorithm, always picking 1 card at each step of 1-7 cards (as it wasn't explicitly said to have to be random), then with an array like: ``` [1, 2, 3, 4, 5, 6] ``` We have one of two results depending on which stack is picked first: ``` [1, 2, 3] [4, 5, 6] ==> [1, 4, 2, 5, 3, 6] [4, 5, 6] [1, 2, 3] ==> [4, 1, 5, 2, 6, 3] ``` The following algorithm accomplishes this `n` times, using `id(b)%9>4` as a source of binary randomness[1]: ``` def s(d,n): for i in range(n):b=d[:];F=id(b)%9>4;d[F::2]=b[26:];d[1-F::2]=b[:26] ``` Sample output: ``` >>> o = ['AH', '2H', '3H', '4H', '5H', '6H', '7H', '8H', '9H', '10H', 'JH', 'QH', 'KH', 'AC', '2C', '3C', '4C', '5C', '6C', '7C', '8C', '9C', '10C', 'JC', 'QC', 'KC', 'KD', 'QD', 'JD', '10D', '9D', '8D', '7D', '6D', '5D', '4D', '3D', '2D', 'AD', 'KS', 'QS', 'JS', '10S', '9S', '8S', '7S', '6S', '5S', '4S', '3S', '2S', 'AS'] >>> d = o[:]; s(d, 2); d ['KD', 'KS', 'AH', 'AC', 'QD', 'QS', '2H', '2C', 'JD', 'JS', '3H', '3C', '10D', '10S', '4H', '4C', '9D', '9S', '5H', '5C', '8D', '8S', '6H', '6C', '7D', '7S', '7H', '7C', '6D', '6S', '8H', '8C', '5D', '5S', '9H', '9C', '4D', '4S', '10H', '10C', '3D', '3S', 'JH', 'JC', '2D', '2S', 'QH', 'QC', 'AD', 'AS', 'KH', 'KC'] >>> d = o[:]; s(d, 2); d ['AC', 'AH', 'KS', 'KD', '2C', '2H', 'QS', 'QD', '3C', '3H', 'JS', 'JD', '4C', '4H', '10S', '10D', '5C', '5H', '9S', '9D', '6C', '6H', '8S', '8D', '7C', '7H', '7S', '7D', '8C', '8H', '6S', '6D', '9C', '9H', '5S', '5D', '10C', '10H', '4S', '4D', 'JC', 'JH', '3S', '3D', 'QC', 'QH', '2S', '2D', 'KC', 'KH', 'AS', 'AD'] ``` [1] This gives about a 44.4%/55.5% skew: ``` >>> r = {0: 0, 1: 0} >>> for i in range(1000000): r[int(id(i)%9>4)]+=1 >>> r {0: 555517, 1: 444483} ``` For two extra characters we can get a much better 50.5%/49.5% result: ``` >>> r = {0: 0, 1: 0} >>> for i in range(1000000): r[int(id(i)%99>49)]+=1 >>> r {0: 505050, 1: 494950} ``` ]
[Question] [ Write the shortest POSIX-form regular expression that matches only non-negative integers divisible by 9. The non-negative integer should be given in base 10. [Answer] # 202,071 bytes Obviously, [the solution](https://gist.github.com/nhahtdh/9405617#file-divisibleby9-re) is too large to be included in this post. I use [JFLAP](http://www.jflap.org/) to draw the [DFA](https://gist.github.com/nhahtdh/9405617#file-g23235-jff), then generate regex from it. The output is then processed in a text editor to replace `(0+9)` with `[09]` and `+` with `|`. [Here is the whole gist](https://gist.github.com/nhahtdh/9405617), with some testing code in Java. ]
[Question] [ Your mission is to write 2 functions that accept a list of N integers (positive or negative). N can be higher than 2. The first one returns the greater common divisor of the N numbers **Example**: [10, 15, 20] -> 5 the second one returns the smallest common multiple of the N numbers **Example**: [10, 15, 20] => 60 Smallest code (in number of characters) wins! [Answer] ### Ruby 38 characters ``` g=->a{a.inject:gcd} l=->a{a.inject:lcm} ``` demo: ``` ar = [10,15,20] p g[ar] #=> 5 p l[ar] #=> 60 ``` [Answer] ## J, 12 characters ``` g=.+./ l=.*./ ``` A bit pointless giving them aliases like this really. [Answer] # Smalltalk (Smalltalk/X) (73 chars) ``` a:=#(10 15 20). g:=a fold:[:i :e|i gcd:e]. l:=a fold:[:i :e|i lcm:e]. ``` without fold: (Ansi Smalltalk), use (102 chars): ``` a := #(10 15 20). g := a inject:a first into:[:i :e | i gcd:e]. l := a inject:a first into:[:i :e | i lcm:e]. ``` ]
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 6 years ago. [Improve this question](/posts/18710/edit) The number 1 can be written as sum of fractions of the form 1/p (where p>1). There are different ways to write it. You will be given an integer k which denotes the number of fractions to be used to get the sum as 1. You need to find the largest possible value of p among all possible ways. See sample input for clarity **Input Format:** The first line contains number of test cases t. Then t lines follow each having a single integer k. **Output:** You need to print the largest value of p modulo 10^9 + 7. **Constraints:** ``` 1<=t<=10^5 2<=k<=10^6 ``` **Sample Input** --------------- **Sample Output** ``` 2 2 2 6 3 ``` **Explanation** There is only one way to write '1' as sum of two fractions. 1/2 + 1/2. hence the largest value is 2. In the second test case, the only possible ways as sum of three fractions are: ``` 1/3, 1/3, 1/3 1/6, 1/2, 1/3 1/4, 1/4, 1/2 ``` Among these the second representation has the largest denominator which is '6' and hence the answer. [Answer] # Java I solved this basic problem [on Stack Overflow](https://stackoverflow.com/a/18087894/752320) already, so I might as well do it here, too. Follow the link for a deeper explanation of the algorithm, but there's *no reason* to calculate all the possible fractions if you just want to know the largest denominator. The only major difference between the code here and on SO is that I'm using modular multiplication, since each result should be `mod 10^9 + 7` and this speeds it up considerably. ``` public class Egyptian { static int range = 1000000; static long[] mods; static long mod = 1000000007; public static void main(String[] args){ mods = new long[range+1]; mods[1] = 1; for(int k=2;k<=range;k++){ mods[k] = (mods[k-1] * (mods[k-1]+1)) % mod; System.out.println(mods[k]); } } } ``` **Note:** This code simply calculates and outputs **every** value for inputs 2 to 10^6. As a popularity contest, I thought a simple proof of concept would be enough. Feel free to downvote if you disagree. It runs in a few seconds, but most of that time is taken by the *million-line* output. If you just want to fill the array with correct values, it finishes in *well* under a second. You can then read/write the input/output at the speed of IO. **Output:** (only from 2-40, can't exactly paste a million lines here) ``` 2 6 42 1806 3263442 56876256 530809436 905136947 994707547 127363070 613638513 614624128 690044800 363952039 128981958 502041307 671991252 275513076 791142674 33665861 222603452 718053684 214817910 348558872 748018254 148507635 647419241 330373625 661987133 851958095 407158983 684304220 916206786 752612499 438658510 487129601 996482080 806772777 958888343 ``` [Answer] # APL (50) ``` ⍪{⌈/∊v/⍨{g=+/(g←∧/⍵)÷⍵}¨v←,∘.,∘v⍣(n-1)⊢v←⍳!n←⎕}¨⍳⎕ ``` This code skips the 'p modulo 109 + 7' computation. But the algorithms is so slow (exponential) that you can barely get a result for k=5, let alone 109. Therefore by all practical means it can be considered equivalent to a piece of code that computed it :-) **Example** ``` ⍪{⌈/∊v/⍨{g=+/(g←∧/⍵)÷⍵}¨v←,∘.,∘v⍣(n-1)⊢v←⍳!n←⎕}¨⍳⎕ ⎕: 3 ⎕: 2 ⎕: 3 ⎕: 4 2 6 24 ``` The `⎕:` is just the "input prompt" when used interactively. ]
[Question] [ I am exploring a unique approach to the classic problem of [Reverse Polish Notation](https://en.wikipedia.org/wiki/Reverse_Polish_notation) on [code.golf](https://code.golf/). Unlike the conventional solutions, my focus lies on leveraging the `eval` function in GolfScript. This twist was inspired by a comment in a related [thread](https://codegolf.stackexchange.com/questions/221/reverse-polish-notation), where the absence of `eval` was deemed a limitation. > > "It's a shame no eval is allowed, otherwise the GolfScript solution is 1 character: ~. :-P" – C. K. Young > > > Despite being intrigued by the idea of solving the problem with minimal characters, I'm encountering challenges in implementing the solution. The specifications, as outlined on [code.golf](https://code.golf/reverse-polish-notation#golfscript), involve computing a list of arguments in polish notation stored in the stack `n`. The goal is to evaluate and print the result of each expression on a separate line. The expected results are non-negative integers not exceeding 32,767, with guaranteed exact integer results for division. I am currently attempting a concise GolfScript solution using the `n*` stack initialization for arguments. Following C. K. Young's hint, I have tried variations like `~n*` and `n*~` to no avail. I believe the solution is close but needs some expert insight to refine it further. If you are well-versed in GolfScript or have experience with similar challenges, I would greatly appreciate your assistance. My goal is to gain a deeper understanding of this fascinating language and unlock the potential of the `eval` function within the constraints of the problem. [Answer] > > The specifications [...] involve computing a list of arguments in polish notation stored in the stack `n`. > > > I think you are slightly misunderstanding the code.golf specification. The input is not a variable `n`, but rather a list of strings already present on the stack when the program begins. In GolfScript, there is a variable called `n`, but it is not the input to the program; it is a string containing a single newline. Your attempt `~n*` is pretty close. The problem is that `~` only does `eval` if its argument—the top of the stack—is a string. In this case, the top of the stack is actually a list of strings. Therefore, you have to use the map `%` function to loop over each element of the list: ``` {~}% ``` Once we have this, we need to join the results on newlines. We can simply do: ``` {~}%n* ``` As I think you figured out already, `n*` means join (`*`) on newlines (`n`). However, if we use the function each (`/`) instead of map (`%`), we can just push the newline to the stack during each iteration, saving a byte: ``` {~n}/ ``` When a GolfScript program has finished execution, the entire stack is printed without a seperator. Here, each `eval`'d result is followed by a newline on the stack, which does the equivalent of joining the list on newlines. Try the final program on [TIO.run](https://tio.run/##RVbbjiw1DHyfr4jO46xa40viJN@DBEJCBwS8Ifj1PVXVmUWrzk7n4tjlcrl/@f23n//66c9f//j789vYLduzxZwzWnpbc@D1ah/N@57Zwmd7tdEx8dECu2ti3Zuvwk6Pvb2NWonVCwvWwoonPvg85s421554TRirHC3DZL4v2pxRRcOb06FzNca9I2DNeNJXLy1Z81p94Lfn3B3vT83St9cjI7Jl980h5M5skTFhOW3CZ59lrW@cv/CXHmPCeV@4yrGb007j07rpV@KIteGbd2IhemJ1Kjq8rlWrzUTAIQyXpqcJIdOuHLjyJe/hTneep3ccnU7o5qe2vB4EZfF0zllthSIVQvTMjalKn8DcN9J1YKenSMSI23s@yB0hi5ipdEaNTkjCO4B2oEGveDFdQRxnpJ9RfRcTzLEcKbxaB2pYUR5o1qZSxByDITkRdAZJIwcYUoAV42TwqQdBjTtnrqNIV2@Fa8656wE7aa4XbBrgyCZqmQf@7MmjA2EMpIQYLuUZaRr0aHsoB48sJgtBeiTCAEZTXsmP6FGI0nGzu0L2vdJaKtRhluIHmWeYRm30FIabeO@@HBctwkk/o6/qZ@TVdd/EEtllQiC2j/v2O3Lv@hHWM7WcsTVtU@S@N2WiJEHFwXNw5MYuMsVgP/G8BIBy@egG/gTuBXTbGfYYMQ@8wHLEu7aVFm/Ta8iOfrwOEwN8J5oxFk4wqigLIT9Ft7y3paGaRG8FPIcfMsOjh1fkauIGjviukkX8nTo3YuZUmxmGErQBSmNcSxsHD5OI6xQPn0DF5hmvN9HMOKfxkhSAHBMIQwxQJW9ZuW60Htb2SCkVEjB7kdGgyS5SRuPrNrL2Bj9y5J17H29L5DYWtkrewEBUMn1OW4UI3AffPE1klZKVAYbotpdSsbkAy9S5kfPUt4Fe8ACuM78d5is7Dow15WPo7pfSpGrB7dA647pTWi9oLbjBKncjPTtqEnyJ@9bRz2HvFKXqnSlZ7l2zIDv0cxon57C7L0BGVlv06UM1sUZJRjaoC9M@8lQBeF/hjxi24GnU3BTKoVSiMHbn/r7oUPGe0ZN1X1V3sUEcFlEdPk@qeGFuwnA9kAxoxSBJwZUttDo8U1PqSdITP50Lgy22lgWIyVnGgQEsRWmzC8RQTqLWyShK7QZmGlkncTNR1P7vL0doHDDGKrgJB9glPJl@Fbct3@/eAAfFNzB5dFGVRYdxdMpFUv6hxuieC/dphQxC80AKiFUuVUDed7A/9v42RFMIgLwnAQAACu2Q6zo1/vz6O4SRZ89TSXc6n1/74OiK6C0rQ9GnIYt0AK0QMUCKULsFVCExebert27rP1CoEI1cFLnRc2GX6DqpkSuOWmUnn@hIffa3jt7lCb0COpWkPM3VACHZDCacu6SDEpzZ1Qx5/3RVEDjiKlXwWq0InwqSEu7fZ6/2pz5nUAWkp4OT3A7NYD@Oue2rj93PcvE4xaqaRfptGJeuMeGP9DKQtyiAiIg9HErZ7RTsU45TQ8jmpHxpLEUOyoMJw9mXY45bxDyXgsI29WtQ1RHXPHmDiiL36JWdTXL2k0znHfgiIRCk40g/HzbPQwyoa7JnQ@9v3Ucvi1Bz3pswdMjwrVmbWpJlfE1oefHLQ5IFcaLzaK9DRhntNn0dfHx1BxVELMQ9zFlwfYSIbKEgVCKlbv3t@@vzn/@@//v6/PwB "GolfScript – Try It Online")! ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/238370/edit). Closed 2 years ago. [Improve this question](/posts/238370/edit) # Challenge Draw lines in ASCII corresponding to given inputs: in the first line there are given size of rows and columns of the view and number of separators between each point in the second line is given list of lines separated by space a line contains the position of head and tail coordinates (within the size of columns and rows) separated by space (x1 x2 y1 y2). > > In the below examples we used character '#' for filled spot, '.' for free spots and ' ' for the separator but you are free to use any other printable ASCII characters. > > > Sample input 1: ``` 33 15 1 5 0 31 0 31 0 31 10 31 10 27 14 27 14 27 4 27 4 0 4 0 4 0 14 0 14 27 14 31 10 5 10 5 10 5 0 5 0 0 4 31 0 27 4 5 10 0 14 ``` Sample output 1: ``` . . . . . # # # # # # # # # # # # # # # # # # # # # # # # # # # . . . . . # # . . . . . . . . . . . . . . . . . . . . . . . . # # . . . # # . # . . . . . . . . . . . . . . . . . . . . . . . # . # . . # . . . # . . . . . . . . . . . . . . . . . . . . . . # . . # . # # # # # # # # # # # # # # # # # # # # # # # # # # # # . . . # . # . . . . # . . . . . . . . . . . . . . . . . . . . . # . . . # . # . . . . # . . . . . . . . . . . . . . . . . . . . . # . . . # . # . . . . # . . . . . . . . . . . . . . . . . . . . . # . . . # . # . . . . # . . . . . . . . . . . . . . . . . . . . . # . . . # . # . . . . # . . . . . . . . . . . . . . . . . . . . . # . . . # . # . . . . # # # # # # # # # # # # # # # # # # # # # # # # # # # . # . . . # . . . . . . . . . . . . . . . . . . . . . . # . . # . . # . # # . . . . . . . . . . . . . . . . . . . . . . . # . # . . . # # . . . . . . . . . . . . . . . . . . . . . . . . . # # . . . . # # # # # # # # # # # # # # # # # # # # # # # # # # # # . . . . . ``` Sample input 2: ``` 31 15 0 0 0 30 14 0 14 30 0 15 0 15 14 0 7 30 7 ``` Sample output 2: ``` ##.............#.............## ..##...........#...........##.. ....##.........#.........##.... .....###.......#......###...... ........##.....#.....##........ ..........###..#..###.......... .............#####............. ############################### .............#####............. ..........###..#..###.......... .........##....#.....##........ ......###......#......###...... ....##.........#.........##.... ..##...........#...........##.. ##.............#.............## ``` **Bonus Points** Use line position format like so `(y1,x1)-(y2,x2)`. e.g. ``` 31 15 0 (0,0)-(14,30) (14,0)-(0,30) (0,15)-(14,15) (7,0)-(7,30) ``` **Scoring** This is `code-golf`, so the shortest solution wins. --- Just to finish this up, simple python(3) answer would be: [Try it online!](https://tio.run/##fVTRbtowFH3nK67oA3YxKClsrYiotI6t0/ZSbXtL8@CQEDwZJ42htVX129m1IdCuYQgcfM7xOfZ1dCu7XpZqdFXV22oq@SrNOGiWT3u9SVULtSY4Udk0p527N/S9eifQe8GkIt17E6aXXdqp/8GuEJs3Ro9sifjCE/HzYz98iZ6XOH47Q5VoVGIihV6TFa8IxjEx1JUUa0Ip7ZyBKuFJqKx80sArAZXUw06mm1RQTe5H5YI3m9dEE6xePnkyaydvPLloJz97Mm0nZ45Usp384sjqBPnVkUveTt46MtPt5HdHyhPkDySf9Iki/PLkiSL8RnL5WJ24OXdvLwt/oPp/kp8o0UXdHrFyr0txKGXNCpa@EtToUOAv9cIzuKlznaslX/U0SKFy4LIoa7FerjpZvoCUmIDZgJmQ2ZBOoAP4yQxMwYQwABPsAIuAdYDdAUaLQiEWglg4@TUEkEudwyD0vH3D23e8T@CpJpmhxwQP2B3Q@GZ24uc@1TAwloHFp3UL/DYYBP7rM73WJR1XZaj29hkuzcxpt8aDHXy9dobUBZw7j0Gz3sv9v0VZgwGhoOaqyPE80Acs5CHFilxmWEeEDZoYx1v841MPqG1Qe1iIBZjBNcYcvXbJfSzrG2gGg/0Oj4ebOdlu1/6eOdnvqZBlyiUIVrE7DzxMBTaMauNaRcRfT/Y9Yd6lUW7yOeneEdIb9obyzwYbzUN8kfRDev4QBwmNJ4MwoVEXZ@7JpzGPxWA8EYmrjzjWZ8xkrgin/TEb0yQqp3ESxeUwN2vsjsR3sJRItGQSnXC4cMMowTbmnKRz4kmkCY3iORFOI1B93myHHvLKJKoJ7Wzx5NvtKITwA95YgO/hKIBwDH4Yubkj3ODBS4dd/gU "Python 3.8 (pre-release) – Try It Online") ``` a() ``` or python(1789) \*without escape characters: [Try it online!](https://tio.run/##hVTLbtswELznK7buQWQiGVLiIIUA5@RjURS9uoKgSLTNQKYESW7F/ry7S1KvpEENJzR3hrO75JC17k6VevhSN9fVagXfKhUcq/IgCvglmlZWCjB8c/NDtNml7GALNLspxAFeGtEKdcrOrA990PjXRzhGPL4B/BQ9kvsIAuhDG9AY0BTQNtC38qgwFoE8EP0ZQhBlKyCIDK4XuH6HmwzZS8uKnk8ZTEDbwKBbaFuTydpjoRoLxVHTAlOGD6H5mpyGS5mmVQWyjXyBS4v@Y7VBwx91DXeH0D3ckkYwrDd08@tQNdCDVNBk6iiwH7iDYR8NU4qywH3EcI8iPeEaf5isY1QPUT0uxA3YwTOmmbRs5jvc1kVoB4GrcGpuRzRbNZ55XmZtC98rqTp3wmiCNJVKdmnKWlEesOcYu@iwKDPOOiB4bRyxDBlPjOJfpRIfap9EVsQ2vw9dJks3eZuFeKhKwxKgNQjQ4CxcNNnvEnOyVv4RMXSXuhQ@UKSNcWgxUX5q2i3z1p4P3mf6Bx7nEDyDuxE2@bGsXrJyiJlQXmGufTKeL6nSEVv1sbK8Wou@E6pglI9Nl2pxOrTINLbu/dlEuwm1NCJmojnnY@q8Ki9nNfmLut1HyWzjiNVUv99QwjnF2YkhzXeKnPh5teTQZ3gt0D60f5hrQVlerY8Whcnb3FThpy242oLo/xr3ya1h3yfzK@H2Y5CK3knNZFY/1cpgjegujRqgqyR/quws0hS2SEvTcyZVmq6sEgmT18hR7JzVzLhWqvrSMb5u61Li6I4or6qmkCrrREuWkfs4DqLEnImkHd4bZ4wir26556MT@Yw2tTgwAm@GD8kbUZdZLpjHyc7eFFhsgccc6qTQ9rakV6OVJP8qfTbdy2ATy1kX1lcbNKlQbEbkdxjbcKtnLsfy3uTWZCN/OilDXmd1TbeHng5m3gOWoznwiy6lH@hzHwYgGoDIAO4A6obQxWPgXgHOr9eHCKJHfKhZ6Ic8YNHGfwg50EjT0M5CP3q0II7Angz2RNhf "Python 3.8 (pre-release) – Try It Online") ``` """ Non-golfed version """ Resault = "" def bresenham(x0, y0, x1, y1): dx = x1 - x0 dy = y1 - y0 xsign = 1 if dx > 0 else -1 ysign = 1 if dy > 0 else -1 dx = abs(dx) dy = abs(dy) if dx > dy: xx, xy, yx, yy = xsign, 0, 0, ysign else: dx, dy = dy, dx xx, xy, yx, yy = 0, ysign, xsign, 0 D = 2 * dy - dx y = 0 for x in range(dx + 1): yield x0 + x * xx + y * yx, y0 + x * xy + y * yy if D >= 0: y += 1 D -= 2 * dx D += 2 * dy class Point: def __init__(self, x: int, y: int): self.x = x self.y = y class Line: def __init__(self, head: Point, tail: Point): self.head = head self.tail = tail def drawline(size: tuple, lines: list, chrs=('.', '#', ' ')) -> Resault: global Resault co = [] for line in lines: co.extend(list(bresenham( line.head.x, line.head.y, line.tail.x, line.tail.y))) for column in range(size[1]): for row in range(size[0]): if (row, column) in co: Resault += chrs[1] else: Resault += chrs[0] if row != size[0]-1: Resault += chrs[2]*size[2] if column != size[1]-1: Resault += "\n" return Resault if __name__ == "__main__": size = tuple(map(int, input().split())) coordinates = [i[::-1] for i in [list(map(int, j.split(','))) for i in [ i.split('-') for i in input().replace(')', '').replace( '(', '').split(' ')] for j in i]] coordinates = [coordinates[i-4:i] for i in range(4, len(coordinates)+4, 4)] lines = [] for c in coordinates: lines.append(Line(Point(c[0][0], c[0][1]), Point(c[1][0], c[1][1]))) print(drawline(size, lines)) ``` [Answer] # [Charcoal](https://github.com/somebody1234/Charcoal), 84 bytes, score unknown ``` ≔⮌I⪪S θUO⊟θ⊟θ.FIE⪪S E⪪ι-⪪✂λ¹±¹¦¹,«≔E²↨Eι§μκ±¹ηF⊕⌈↔η«≔⁺·⁵E§ι⁰⁺λ∕×κ§ημ⌈↔ηκJ⊟κ⊟κ#»»UE⊟θ ``` [Try it online!](https://tio.run/##dZFNboMwEIXXcAqLbsaSE5mmURZZpT@LVGobNbkAATdY2IaAiSJVOTudgdBs2gUazzz85uOR5kmdlonpulXT6IODT3VSdaPgKWk8bCujPaxd1fqtr7U7ABcsYhHnWI98GX7sTYnTTVnBEUdjjaYRil9lzQaft6T630uwm6xxNKHR0G6NThUYwWLB3tUh8QpiFOmJBFFwzr7D4IpONveCPSaIT2c0W/m1y9QZrGAFMf@a4DlHxKBnXLu0VlY5rzK8eNa2tbDaN6Vp8d183DKu2Zi2ATmdD9zjBlwmKQESEfhZn3SmYKetaqC4geSCWd5/8l9rSCkIK3htbbUr@2CLa7CDsMHoPER3FHBwCS/hy9krl11/AV923Sxm8ZzJEKSQfALxg5hJzqhSK4dOing@iFgZLHptQVo3OZkf "Charcoal – Try It Online") Link is to verbose version of code. Explanation: ``` ≔⮌I⪪S θ ``` Input the first line, split on spaces, cast to integer and reverse. ``` UO⊟θ⊟θ. ``` Draw the background of the desired size. ``` FIE⪪S E⪪ι-⪪✂λ¹±¹¦¹,« ``` Input the second line, splice on spaces, split each piece on `-`, chop off the `()`s, split again on `,`, cast to integer, and loop over the sets of coordinates. ``` ≔E²↨Eι§μκ±¹η ``` Calculate the difference between the start and end points. ``` F⊕⌈↔η« ``` Loop over the number of steps needed to draw the line. ``` ≔⁺·⁵E§ι⁰⁺λ∕×κ§ημ⌈↔ηκ ``` Interpolate between the start and end point. ``` J⊟κ⊟κ# ``` Jump to the calculated position and output a `#`. ``` »»UE⊟θ ``` Space the output horizontally as desired. ]
[Question] [ **This question already has answers here**: [Is this even or odd?](/questions/113448/is-this-even-or-odd) (261 answers) Closed 4 years ago. ### Task Your task is to write as short as possible program preferably in Brainf\*\*k which determines the last digit of given number after it's conversion from decimal to binary system. ### Input An integer in decimal system consisting of up to 200 digits. There is a newline character (ASCII 10) after the given number ### Output One digit (1 or 0) which is the last digit of given number after it's conversion to binary system. ### Example `4372667135165131576213 -> 1` [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 13 bytes ``` Boole@OddQ@#& ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78n2b73yk/PyfVwT8lJdBBWe1/QFFmXomCg0JatImxuZGZmbmhsamhmamhsaGpuZmRoXHsfwA "Wolfram Language (Mathematica) – Try It Online") ]
[Question] [ **This question already has answers here**: [Yo boy, must it sum](/questions/146084/yo-boy-must-it-sum) (26 answers) Closed 5 years ago. Let `n` be a positive integer then n = a + b + c for some a, b, and c that are palindrome integers. What is the largest possible integer `a` for `k` = 1 to 1\_000\_000? Golf this or have the fastest running time. NOTE: it's NOT the same as this [question](https://codegolf.stackexchange.com/questions/146084/yo-boy-must-it-sum) as I am asking for the largest palindrome component. The question just asks for ANY combination. [Answer] My Julia solution ``` using Base.Iterators is_palindrome(n) = begin dn = digits(n) all(dn .== reverse(dn)) end lim = Int64(1e6) res = filter(is_palindrome,lim:-1:0) using DataFrames lp = DataFrame(k = 1:1_000_000, largest_palindrome = Array{Int64,1}(lim)) # found stores the integers backwardds ok(lim, res, lp) = begin found = BitArray(lim) found .= false tot = Int128(0) cap = lim r = res[1] for r in res[1:end-1] bs = res[res .<= (cap - r)] cs = res[res .<= ceil((cap - r)/2)] res1 = vec([r + b + c for (b, c) in product(bs,cs)]) res1 = res1[res1 .<= cap] for rr in res1 if !found[rr] lp[rr,:largest_palindrome] = r tot = tot + r found[rr] = true end end for i in lim:-1:1 if !found[i] cap = i break end end end (tot, found, lp) end ``` ]
[Question] [ **This question already has answers here**: [Reverse stdin and place on stdout](/questions/242/reverse-stdin-and-place-on-stdout) (140 answers) Closed 6 years ago. Just take an input in any way and then print it backward (trailing newlines allowed). For example: ``` Hello World -> dlroW olleH Hi -> iH ``` Yes, it is case sensitive. Shortest code wins [Answer] # Mathematica, 13 bytes ``` StringReverse ``` ]
[Question] [ **This question already has answers here**: [Approximation of e](/questions/82604/approximation-of-e) (55 answers) Closed 7 years ago. From Wikipedia: > > The number e is an important mathematical constant that is the base of the natural logarithm. It is approximately equal to 2.71828, and is the limit of (1 + 1/n)n as n approaches infinity. > > > ## Challenge Calculate the number e to 15 digits after the decimal point. This means that your output must start with `2.718281828459045` or equivalent. Your program can output digits after the required output - these may be accurate or inaccurate, inaccuracy after 15 digits does not disqualify you from the challenge. Your program may also output nothing after the required 15 digits. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), shortest implementation in bytes wins. ## Constraints * You may not use built in constants or hardcode the number. * Standard loopholes and rules apply. ## Reference Implementation (Ruby) ``` def e(i) e = 1.0 # make it floating point i.times { |n| # loop repeats n times e += 1.0/(1..n+1).reduce(:*) # factorial - no factorial function } # in the Ruby standard library return e end e(200) # Almost certainly will return e ``` [Answer] # Haskell, ~~33~~ 31 Bytes *-2 Bytes thanks to @xnor* ``` sum[1/product[1..i]|i<-[0..99]] ``` Straightforward implementation of the series definition. (I have posted a version of this to Reddit before.) [Answer] ## Haskell, 25 bytes ``` f 99=0;f n=1+f(n+1)/n;f 0 ``` 26 bytes: ``` foldr(\x y->1+y/x)0[1..99] ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/79138/edit). Closed 7 years ago. [Improve this question](/posts/79138/edit) ## Encrypting Challenge Your encrypting program must be able to do following things: 1. Input password 2. Generate random key 3. Encrypt random key with set key Then, the decrypting program must be able to these things: 4. Input encrypted password 5. Input encrypted random key 6. Decrypt random key 7. Decrypt password with decrypted random key 8. Print password The encryption must be setted with the key. It must be a table encryption or a encryption which makes the unencrypted values to a part of the key. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"). The shortest program wins! [Answer] # [Pyth](https://github.com/isaacg1/pyth), 16+16 = 32 bytes Encryption: ``` s@LG+VxLGQxLG*zl ``` [Try it online!](http://pyth.herokuapp.com/?code=s%40LG%2BVxLG*zlQxLG&input=%22encryption%22%0Akey&debug=0) Decryption: ``` s@LG-VxLGQxLG*zl ``` [Try it online!](http://pyth.herokuapp.com/?code=s%40LG-VxLGQxLG*zl&input=%22orabcndmmx%22%0Akey&debug=0) Uses [Vigenère cipher](https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher). [![Table of Vigenère cipher](https://i.stack.imgur.com/uzXOD.png)](https://i.stack.imgur.com/uzXOD.png) ]
[Question] [ **This question already has answers here**: [Mathematical Combination](/questions/1744/mathematical-combination) (36 answers) Closed 10 years ago. The problem is to compute nCr = n!/(r!) \* (n-r)! in the fewest characters possible. The input will be in the form: 1st line will have number of test cases and second line will have n and r for each testcase. You need to print ncr e.g. ``` Input 1 100 10 Output: 17310309456440 ``` Here's what I have in python. Is there a way to reduce the number of characters further ?[143 chars presently] ``` r=raw_input f=lambda x:0**x or x*f(x-1) C=lambda n,r:f(n)/f(r)/f(n-r) for i in range(int(r())):print C(*map(int, r().split())) ``` Thanks! [Answer] # Python 3 (100 chars) ``` I=input C=lambda n,r:r and C(n-1,r-1)*n//r or 1 for _ in' '*int(I()):print(C(*map(int,I().split()))) ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/127/edit). Closed 6 years ago. [Improve this question](/posts/127/edit) What is the shortest function (implemented in C) that will return a random draw from a Poisson distribution (given the mean or `λ` parameter)? ``` int random_poisson(double lambda); ``` [Answer] Taken [from the wikipedia article which credits Knuth](http://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables) (and notes that there are implementations with better time performance) this code is a complete program implementing a minimal test scaffold. The code that does the actual work is 169 characters still formatted: ``` #include <stdio.h> #include <stdlib.h> #include <math.h> #include <limits.h> #include <string.h> /* For serious work you need a high quality random number generator * * And these macros may need to be adjusted for your system and choice * of random number engine. */ #define GOODRAND random() #define GOODRANDMAX INT_MAX #define RANDTYPE long /* poisson.c * * Implementation straight from * http://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables * which credits Knuth. * * Time complexity is O(lambda), which is not optimal. */ RANDTYPE poisson(double lambda){ RANDTYPE k=0; double L=exp(-lambda), p=1; do { ++k; p *= GOODRAND/(double)GOODRANDMAX; } while (p > L); return --k; } /* minimal testing scaffold * * Note that with no initialzation the sequece will repeat on every test. */ int main(int argc, char**argv){ while (argc > 1) { RANDTYPE in = atoi(argv[--argc]); printf("lambda=%d: %d\n",in,poisson(in)); } } ``` ]
[Question] [ You need to print A-Z like this: ``` 1. A 2. B 3. C 4. D 5. E 6. F 7. G 8. H 9. I 10. J 11. K 12. L 13. M 14. N 15. O 16. P 17. Q 18. R 19. S 20. T 21. U 22. V 23. W 24. X 25. Y 26. Z ``` But your source code cannot use `1,2,4,6`. Trailing newlines in output allowed,, but leading ones not allowed. Standard loopholes apply, shortest code wins. [Answer] # [Zsh](https://www.zsh.org/), 27 bytes ``` eval ';echo $[++i]. '{A..Z} ``` [Try it online!](https://tio.run/##qyrO@P8/tSwxR0HdOjU5I19BJVpbOzNWT0G92lFPL6r2/38A "Zsh – Try It Online") [Answer] # [JavaScript (Node.js)](https://nodejs.org), 48 bytes ``` f=(n=033)=>--n?f(n)+n+`. ${Buffer([8*8|n])} `:'' ``` [Try it online!](https://tio.run/##BcHRCoIwFADQd79iSOC9ybQyQgIL@g0RHLpbi3EX27SH6tvXOU@1qjB584qS3axTog642zUNdhcp@UrAWHI5VmLzuS1E2kPfbtsvD/jLxnNRJENQ9/vD8TTUVdQhAiGK@PDuLXLDq7JmFsEtftJ5NjkOzurKujsQIKY/ "JavaScript (Node.js) – Try It Online") [Answer] # [Python 2](https://docs.python.org/2/), 44 bytes ``` i=8*8 while i<90:i=-~i;print`i-8*8`+'. %c'%i ``` [Try it online!](https://tio.run/##K6gsycjPM/r/P9PWQsuCqzwjMydVIdPG0sAq01a3LtO6oCgzryQhUxcomaCtrqegmqyumvn/PwA "Python 2 – Try It Online") **46 bytes** ``` i=0 while i<33-7:i=-~i;print'%d. %c'%(i,i+8*8) ``` [Try it online!](https://tio.run/##K6gsycjPM/r/P9PWgKs8IzMnVSHTxthY19wq01a3LtO6oCgzr0RdNUVPQTVZXVUjUydT20LLQvP/fwA "Python 2 – Try It Online") The loop condition can also be `while-~i/9-3:` or `while~-i/5-5` or `while-i/5-~5:` or `while~-i-5*5:` or `while~-033>i`. **46 bytes** ``` i=0 exec 78/3*"i=-~i;print'%d. %c'%(i,i+8*8);" ``` [Try it online!](https://tio.run/##K6gsycjPM/r/P9PWgCu1IjVZwdxC31hLKdNWty7TuqAoM69EXTVFT0E1WV1VI1MnU9tCy0LTWun/fwA "Python 2 – Try It Online") **46 bytes** ``` i=8*8 while i<90:i=-~i;print'%d. %c'%(i-8*8,i) ``` [Try it online!](https://tio.run/##K6gsycjPM/r/P9PWQsuCqzwjMydVIdPG0sAq01a3LtO6oCgzr0RdNUVPQTVZXVUjUxeoSidT8/9/AA "Python 2 – Try It Online") **46 bytes** ``` i=0 while~i-5*5:i=~-i;print'%d. %c'%(-i,8*8-i) ``` [Try it online!](https://tio.run/##K6gsycjPM/r/P9PWgKs8IzMntS5T11TL1CrTtk4307qgKDOvRF01RU9BNVldVUM3U8dCy0I3U/P/fwA "Python 2 – Try It Online") **46 bytes** ``` i=8*8 while i<90:i=-~i;print'%d. %c'%(i&799,i) ``` [Try it online!](https://tio.run/##K6gsycjPM/r/P9PWQsuCqzwjMydVIdPG0sAq01a3LtO6oCgzr0RdNUVPQTVZXVUjU83c0lInU/P/fwA "Python 2 – Try It Online") **47 bytes** ``` for i in range(33-7):print"%d. %c"%(-~i,8*8-~i) ``` [Try it online!](https://tio.run/##K6gsycjPM/r/Py2/SCFTITNPoSgxLz1Vw9hY11zTqqAoM69ESTVFT0E1WUlVQ7cuU8dCywJIaf7/DwA "Python 2 – Try It Online") [Answer] # [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 19 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?") ([SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")) ``` ↑(⍳∘≢,⍥⍕¨'. '∘,¨)⎕A ``` [Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qKO94P@jtokaj3o3P@qY8ahzkc6j3qWPeqceWqGup6AOFNI5tELzUd9UR5DS/wpgUAAA "APL (Dyalog Extended) – Try It Online") `⎕A` the uppercase **A**lphabet `(`…`)` apply the following tacit function:  `'. '∘,¨` prepend ". " to each letter.  `,⍥⍕¨` concatenate the string representation of each to the string representation of:   `⍳∘≢` the **ɩ**ndices of the length of the alphabet `↑` "mix" the list of strings into a character matrix [Answer] # [PHP](https://php.net/), ~~45~~ ~~40~~ ~~39~~ 38 bytes ``` for($c=A;$c<>AA;$c++)echo++$i,". $c "; ``` [Try it online!](https://tio.run/##K8go@G9jXwAk0/KLNFSSbR2tVZJt7BxBlLa2ZmpyRr62tkqmjpKegkoyl5L1//8A "PHP – Try It Online") -1 thanks to [Kaddath](https://codegolf.stackexchange.com/users/90841/kaddath) [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes ``` Auā'.«sø» ``` [Try it online!](https://tio.run/##yy9OTMpM/f/fsfRIo7reodXFh3cc2v3/PwA "05AB1E – Try It Online") ``` A # push the lowercase alphabet u # convert to uppercase ā # push the range [1 .. len(alphabet)] '.« '# append '.' to each number s # swap to the alphabet ø # zip both lists => [['1.', 'A'], ..., ['26.', 'Z']] » # join each inner list by spaces and the outer list by newlines ``` [Answer] # [Charcoal](https://github.com/somebody1234/Charcoal), 9 bytes ``` Eα⁺⁺⊕κ. ι ``` [Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM3sUAjUUchIKe0WANMeOYlF6XmpuaVpKZoZGvqKCjpKSgBqUxNTU3r////65blAAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: ``` α Predefined variable uppercase alphabet E Map over characters κ Current index (0-indexed) ⊕ Incremented . Literal string `. ` ι Current character ⁺⁺ All concatenated Implicitly print on separate lines ``` [Answer] # [Perl 5.10](https://www.perl.org/), 22 bytes ``` say++$..". $_"for A..Z ``` [Try it online!](https://tio.run/##K0gtyjH9/784sVJbW0VPT0lPQSVeKS2/SMFRTy/q//9/@QUlmfl5xf91fU31DA30DAA "Perl 5 – Try It Online") [Answer] # [R](https://www.r-project.org/), 33 bytes ``` write.table(LETTERS,,,F,". ",c=F) ``` [Try it online!](https://tio.run/##K/r/v7wosyRVryQxKSdVw8c1JMQ1KFhHR8dNR0lPQUkn2dZN8/9/AA "R – Try It Online") [Answer] # [Canvas](https://github.com/dzaima/Canvas), 8 [bytes](https://github.com/dzaima/Canvas/blob/master/files/chartable.md) ``` Z{²O. oo ``` [Try it here!](https://dzaima.github.io/Canvas/?u=JXVGRjNBJXVGRjVCJUIyJXVGRjJGLiUyMCV1RkY0RiV1RkY0Rg__,v=8), [alternate version](https://dzaima.github.io/Canvas/?u=JXVGRjNBJXVGRjVCJUIyLiUyMCV1MjUxOCV1RkYwOSV1RkYzRA__,v=8) The only reason this is shorter than charcoal is because it's got a 1-indexed iteration count. ## Explanation ``` Z{²O. oo Z{ loop over the alphabet ²O output the iteration number . o output ". " o output the current letter ``` [Answer] # [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 25 bytes ``` 'A'..'Z'|%{++$i;"$i. $_"} ``` [Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X91RXU9PPUq9RrVaW1sl01pJJVNPQSVeqfb/fwA "PowerShell – Try It Online") [Answer] # [BASIC](http://www.yabasic.de), 41 bytes ``` for i=!0 to 33-7:?i,". ",chr$(8*8+i):next ``` [Try it online!](https://tio.run/##q0xMSizOTP7/Py2/SCHTVtFAoSRfwdhY19zKPlNHSU9BSSc5o0hFw0LLQjtT0yovtaLk/38A "Yabasic – Try It Online") [Answer] # [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), ~~49~~ ~~29~~ 28 bytes ``` T`@L`_o }`$ Z . $.`. $&¶ A`@ ``` [Try it online!](https://tio.run/##K0otycxL/P8/JMHBJyE@n6s2QYUrikuPS0UvQU9BRe3QNi7HBIf//wE "Retina 0.8.2 – Try It Online") Explanation: ``` T`@L`_o }`$ Z ``` Generate the uppercase alphabet prefixed by `@`. This works by feeding in `Z`s and transliterating a step backwards each time until the transformation becomes idempotent. ``` . $.`. $&¶ ``` Prefix each character with its 0-based index and `.` , and split each character on to its own line. ``` A`@ ``` Delete the `@` entry. [Answer] # [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 41 bytes ``` (8-7)..(33-7)|%{"$($_). "+[char]($_+8*8)} ``` [Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X8NC11xTT0/D2BhI16hWK6loqMRr6ikoaUcnZyQWxQJ52hZaFpq1//8DAA "PowerShell – Try It Online") [Answer] # [Python 3](https://docs.python.org/3/), ~~52~~ 50 bytes ``` for x in range(8-7,33-6):print(f"{x}.",chr(x+8*8)) ``` [Try it online!](https://tio.run/##K6gsycjPM/7/Py2/SKFCITNPoSgxLz1Vw0LXXMfYWNdM06qgKDOvRCNNqbqiVk9JJzmjSKNC20LLQlPz/38A "Python 3 – Try It Online") [Answer] # [Retina](https://github.com/m-ender/retina/wiki/The-Language), 27 bytes ``` 3*9*@ Y`@`L_ L$`. $.>`. $& ``` [Try it online!](https://tio.run/##K0otycxLNPz/n8tYy1LLgSsywSHBJ57LRyVBj0tFzy5BT0FF7f9/AA "Retina – Try It Online") Explanation: ``` 3*9*@ ``` Insert 27 `@`s. (Best I can do since I can't use `2` or `6`.) ``` Y`@`L_ ``` Replace each `@` with subsequent uppercase letters, but delete the last one. ``` L$`. ``` Match each letter. ``` $.>`. $& ``` For each letter, output its 1-indexed index, `.` , then the letter. [Answer] # [Vyxal](https://github.com/Lyxal/Vyxal), `j`, 10 bytes ``` αɾkAZƛı. j ``` [Try it Online!](http://lyxal.pythonanywhere.com?flags=j&code=%CE%B1%C9%BEkAZ%C6%9B%C4%B1.%20j&inputs=&header=&footer=) [Answer] # [Japt](https://github.com/ETHproductions/japt), 12 bytes ``` ;B£[YÄLSXR]q ``` [Try it online!](https://tio.run/##y0osKPn/39rp0OLoyMMtPsERQbGF//8DAA "Japt – Try It Online") Straightforward, though I feel like there's still room for improvement. Explanation: ``` ;B£[YÄLSXR]q # ; # Store the uppercase alphabet in B B£ # Replace each character in B with the following: [ ] # Make an array containing: YÄ # The 0-based index of the character + 1 (i.e. 1-based index) L # Period S # Space X # The original character R # A newline q # Join the array into a string with no separator # Implicitly output the resulting string ``` [Answer] # [Rust](https://rust-lang.org/), 56 bytes ``` ||for(i,x)in(9..).zip('A'..'['){print!("{}. {} ",i-8,x)} ``` [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), ~~10~~ 9 bytes ``` ØAĖj€⁾. Y ``` [Try it online!](https://tio.run/##y0rNyan8///wDMcj07IeNa151LhPTyHy/38A "Jelly – Try It Online") ## How it works ``` ØAĖj€⁾. Y - Main link. Takes no arguments ØA - Yield the uppercase alphabet and set as the left and right arguments Ė - Enumerate j€⁾. - Join each pair with ". " Y - Join with newlines and output ``` [Answer] # Java, 62 bytes ``` $->{for(char c='@';++c<'[';)System.out.println(c-'@'+". "+c);} ``` [Try it online!](https://tio.run/##LYxBCoMwFETX5hSfUlAr5gKppdB1V0I30kX6qzY2JpL8CEU8u83C2QzzZphBzrIc3t9NjZN1BEPMPJDSvAsGSVnDT4JN4aUVAmrpPdylMgtLduZJUrTZqjeMsclqcsr0zROk632@MNiV3KzxYWzd@RG3F@iq7Vhels66DD/SAVbpNRVFgee0SUVe/zy1I7eB@BQPSZsMy7goDhwOBeZi3QRLko5LxHaizASt80hWtm5/) # Java, 95 bytes ``` $->java.util.stream.IntStream.range('A','[').forEach(i->System.out.println(i-'@'+". "+(char)i)) ``` [Try it online!](https://tio.run/##RY3LasMwEEXX1leIEJDUxPqBNKaldJFFVoZuQhdTRXbG1cNIo0AJ@XZX0EBnc@eeGTgTXKGdzt8L@jkm4lPtuhA6PZRgCGPQTzs2ly@HhhsHOfMjYLix5sEyAdW4RjxzXy@yp4RhPH1ySGNWN8Yf07zFkIu36fmj/nZ82C/rtvv3ZUoWvD4E6v@2BGG0UryKrTgJpYeY3sFcJLZd/5PJeh0L6bnKyIVKxYvYrDRfbaS5QFKo1LJjTTNoMMbOJENxTlVyZ/flFw) [Answer] # Lua (55 bytes) ``` for i=7%3,33-7 do print(i..". "..(8*8+i..""):char())end ``` [Answer] # Javascript (Browser console), 58 bytes ``` for(i=0;i<35-9;)alert(++i+". "+String.fromCharCode(i+8*8)) ``` -2 bytes thanks to @expressjs123 -3 bytes thanks to @tsh [Answer] # [Bash](https://www.gnu.org/software/bash/), 41 bytes ``` echo {A..Z}|tr ' ' ' '|nl -s". " -w$[8-7] ``` [Try it online!](https://tio.run/##S0oszvj/PzU5I1@h2lFPL6q2pqRIQR0EudRr8nIUdIuV9BSUFHTLVaItdM1j//8HAA "Bash – Try It Online") [Answer] # [Julia 1.0](http://julialang.org/), ~~37~~ 35 bytes ``` 'A':'Z'.|>i->print("$(i-'@'). $i ") ``` [Try it online!](https://tio.run/##yyrNyUw0rPj/X91R3Uo9Sl2vxi5T166gKDOvRENJRSNTV91BXVNPQSWTS0nz/38A "Julia 1.0 – Try It Online") [Answer] # [Japt](https://github.com/ETHproductions/japt) [`-R`](https://codegolf.meta.stackexchange.com/a/14339/), 11 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1) ``` ;B¬ËiSiLiEÄ ``` [Test it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LVI&code=O0Ksy2lTaUxpRcQ) [Answer] # C ``` main() { for(int i='A',j=0;i<='Z';j++,printf("%d. %c\n",j,i),i++);} ``` If for some, this wouldn't work: ``` #include <stdio.h> void main() { for(int i='A',j=0;i<='Z';j++,printf("%d. %c\n",j,i),i++);} ``` [Answer] # [C (gcc)](https://gcc.gnu.org/), 50 bytes ``` main(i){for(;i<3*9;printf("%d. %c\n",i++,i+8*8));} ``` [Try it online!](https://tio.run/##S9ZNT07@/z83MTNPI1OzOi2/SMM608ZYy9K6oCgzryRNQ0k1RU9BNTkmT0knU1sbiC20LDQ1rWv//wcA "C (gcc) – Try It Online") ``` f(i){for(i=0;++i<3*9;printf("%d. %c\n",i,i+8*8));} ``` [Try it online!](https://tio.run/##S9ZNT07@/z9NI1OzOi2/SCPT1sBaWzvTxljL0rqgKDOvJE1DSTVFT0E1OSZPSSdTJ1PbQstCU9O69j9QTiE3MTNPQ1OhmotLAQjSNDStuWr/AwA "C (gcc) – Try It Online") [Answer] # [C (gcc)](https://gcc.gnu.org/), 50 bytes ``` f(i){for(i=0;++i<033;)printf("%d. %c\n",i,i+'@');} ``` [Try it online!](https://tio.run/##DcHBCkBAEADQu6/YlMy0VspxKR/iotFsUyyhHDa/bniPXCBSZRBMvB0gfeOtla5pW4/7IfFiyIu5NgWNMa@kElsOJfpH10kioEmZ@TGgzx59iZcpnOruDw "C (gcc) – Try It Online") [Answer] # [Stax](https://github.com/tomtheisen/stax), ~~9~~ 8 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax) ``` τ┌Z*µ╝╘Q ``` [Run and debug it](https://staxlang.xyz/#p=e7da5a2ae6bcd451&i=) ]
[Question] [ **This question already has answers here**: [Sing Happy Birthday to your favourite programming language](/questions/39752/sing-happy-birthday-to-your-favourite-programming-language) (207 answers) Closed 4 years ago. Your task is to write a program or function that takes a string as input, and prints `Hello (input), I'm (language name)`. ## Examples **Python:** Input: `Oliver` Output: `Hello Oliver, I'm Python` **C++:** Input: `Jacob` Output: `Hello Jacob, I'm C++` etc. Remember, this is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the code with the lowest number of bytes wins. ## Leaderboards Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language. To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template: ``` # Language Name, N bytes ``` where `N` is the size of your submission. If you improve your score, you *can* keep old scores in the headline, by striking them through. For instance: ``` # Ruby, <s>104</s> <s>101</s> 96 bytes ``` If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the *last* number in the header: ``` # Perl, 43 + 2 (-p flag) = 45 bytes ``` You can also make the language name a link which will then show up in the leaderboard snippet: ``` # [><>](http://esolangs.org/wiki/Fish), 121 bytes ``` ``` var QUESTION_ID=94485,OVERRIDE_USER=12537;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i; ``` ``` body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px} ``` ``` <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> ``` [Answer] ## Python, 29 bytes ``` "Hello {}, I'm Python".format ``` Strings methods for the win! The built-in method format of a string substitutes the arguments (here a single string) into any replacement fields (here `{}`). Usage: ``` f = "Hello {}, I'm Python".format print f("xnor") ``` ``` Hello xnor, I'm Python ``` Previous 30-byte: ``` "Hello %s, I'm Python".__mod__ ``` [Answer] # [pl](http://github.com/quartata/pl-lang), 15 bytes ``` Hello _, I'm pl ``` [Try it online!](http://pl.tryitonline.net/#code=SGVsbG8gXywgSSdtIHBs&input=RGVubmlz) [Answer] # Assembly (x86-64, Linux), ~~217~~ 205 bytes *4927 segmentation faults later...* ``` .global main .data s:.ascii"Hello %qs, I'm Assembly\n" f:.ascii"%qs" i:.ascii"" main:mov $i,%rsi mov $f,%rdi mov $0,%rax call scanf mov $0,%rax mov $i,%rsi mov $s,%rdi call printf end:mov $0,%rax call exit ``` Doesn't work for inputs with a length greater than 7, because this exceeds the memory limits of a quadword(?). Also, because I'm a noob in Assembly. ### Explanation: ``` .global main .data output_string: .ascii "Hello %qs, I'm Assembly\n" format_input: .ascii "%qs" input_string: .ascii "" main: mov $input_string, %rsi # Place the memory address to the second argument mov $format_input, %rdi # Place the format string to the first argument mov $0, %rax # Set RAX to 0 call scanf # Call scanf with RDI and RSI as the arguments mov $0, %rax # Set RAX to 0 mov $input_string, %rsi # Place the input string to the second argument mov $output_string, %rdi # Place the output format to the first argument call printf # Call printf with RDI and RSI as the arguments end: mov $0, %rax # Set RAX to 0 (which is the exit code) call exit # Call the exit function ``` Save in a file called *myProgram.s* and do the following: ``` $ gcc -o myProgram myProgram.s $ ./myProgram ``` [Answer] # [05AB1E](http://github.com/Adriandmen/05AB1E), ~~21~~ 17 bytes ``` ”Ÿ™ ÿ, I'm 05AB1E ``` [Try it online!](http://05ab1e.tryitonline.net/#code=4oCdxbjihKIgw78sIEknbSAwNUFCMUU&input=RW1pZ25h) [Answer] # Java, 88 bytes ``` interface A{static void main(String[]a){System.out.print("Hello "+a[0]+", I'm Java!");}} ``` Takes input on first command-line argument. Verbose Java is verbose. [Answer] # Cheddar, 26 bytes ``` "Hello %s I'm Cheddar"&(%) ``` [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 16 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) ``` “' ṗr>ƊḳȧT°ḋZ»Ỵj ``` [Try it online!](http://jelly.tryitonline.net/#code=4oCcJyDhuZdyPsaK4bizyKdUwrDhuItawrvhu7Rq&input=&args=RGVubmlz) ### How it works Call the argument of the main link **s**. ``` “' ṗr>ƊḳȧT°ḋZ» ``` represents an integer in bijective base 256 that encodes a sequence of dictionary words and/or characters. In this specific case, it encodes the dictionary word **Hello**, followed by **¶, I'm** with a leading space (**¶** represents a linefeed), followed by the dictionary word **Jelly** with a leading space. The result is as follows. ``` Hello , I'm Jelly ``` The `Ỵ` atoms splits this string at linefeeds, yielding the following array. ``` ["Hello ", "", I'm Jelly"] ``` Finally, the `j` atom joins that array, using the string **s** as separator. [Answer] ## [Straw](http://github.com/tuxcrafting/straw), 25 bytes ``` (Hello b, I'm Straw!)b</> ``` [Try it online!](http://straw.tryitonline.net/#code=KEhlbGxvIGIsIEknbSBTdHJhdyEpYjwvPg&input=VHV4) Simple regex substitution. [Answer] # Minecraft, 27 bytes ``` say Hello @p, I'm Minecraft ``` `say` Prints the given string and replaces `@p` with the name of the nearest player [Answer] # MATL, 24 bytes ``` 'Hello %s, I''m MATL'jYD ``` [**Try it Online!**](http://matl.tryitonline.net/#code=J0hlbGxvICVzLCBJJydtIE1BVEwnallE&input=U3VldmVy) [Answer] # [Element](http://github.com/PhiNotPi/Element), 28 bytes ``` Hello\ _\,\ I\'m\ Element..` ``` (link to [TIO](http://element.tryitonline.net/#code=SGVsbG9cIF9cLFwgSVwnbVwgRWxlbWVudC4uYA&input=UGhpTm90UGk)) Woo! Two months since this site's previous Element answer! [Answer] # [Emotinomicon](http://conorobrien-foxx.github.io/Emotinomicon/int.html), 73 bytes ``` 😭Hello😲💯😜🔟✖➕⏫😭, I'm Emotinomicon😲😎⏪⏬⏩ ``` If you go to the [Interpreter](http://conorobrien-foxx.github.io/Emotinomicon/int.html) you can generate an explanation Thanks to [@Oliver Ni](http://www.oliverni.com) for make me notice that bug that Emotinomicon removes whitespaces at the end of the String literal [Answer] ## Batch, 25 bytes ``` @echo Hello %*, I'm Batch ``` Conveniently `'` isn't a quote character in Batch. [Answer] # sh, 24 bytes ``` echo "Hello $1, I'm sh!" ``` [Answer] # PHP, 29 Bytes ``` <?="Hello $argv[1], I'm PHP"; ``` [Answer] # Nim, 40 bytes ``` echo "Hello "&stdin.readAll&", I'm Nim!" ``` [Answer] # dc, 23 bytes ``` [, I'm dc!]?[Hello ]PPP ``` dc doesn't provide any means of getting raw strings, so you have to wrap your input in `[`brackets`]`. For example: ``` $ dc hello.dc <<< [Daniel] Hello Daniel, I'm dc! ``` [Answer] # GolfScript, 27 bytes ``` "Hello "\", I'm GolfScript" ``` Takes input from STDIN. [Answer] ## Pyke, 21 bytes ``` "Hello , I'm Pyke"6Q: ``` [Try it here!](http://pyke.catbus.co.uk/?code=%22Hello+%2C+I%27m+Pyke%226Q%3A&input=Oliver) [Answer] ## Pyth, 21 bytes ``` X6"Hello , I'm Pyth"Q ``` [Try it here!](http://pyth.herokuapp.com/?code=X6%22Hello+%2C+I%27m+Pyth%22Q&input=%22Bob%22&debug=0) [Answer] # C, ~~50~~ 39 bytes ``` f(char*s){printf("Hello %s, I'm C",s);} ``` [Answer] # Scala, 25 bytes ``` n=>s"Hello $n, I'm Scala" ``` To use it, assign this function to a variable. ``` val greeting = n=>s"Hello $n, I'm Scala" greeting("Jacob") ``` I didn't expect that you can drop the type annotation if the parameter is of type `Any`. [Answer] # Jolf, ~~20~~ 17 bytes ``` "Ξ\x08£C¦i, I‘m Jolf ``` [Try it here!](http://conorobrien-foxx.github.io/Jolf/#code=Is6eCMKjQ8KmaSwgSeKAmG0gSm9sZg&input=Q29ub3I) Replace `\x08` with the literal character. `¦i` is interpolated input, and `Ξ\x08£C` is compressed form of `Hello` with a trailing space. This outputs, for input `Conor`: ``` Hello Conor, I'm Jolf ``` --- Alternatively, for 23 bytes: ``` "Hello ¦i, I‘m ¦ᖒ ``` [Answer] # J, 22 bytes ``` ', I''m J',~'Hello '&, ``` This is a fork: ``` ', I''m J' ,~ 'Hello '&, ``` `'Hello '&,` prepends `Hello` and `', I''m J' ,~` appends `, I'm J`. Example run: ``` (', I''m J',~'Hello '&,)'Conor' Hello Conor, I'm J ``` [Answer] # JavaScript, 32 bytes ``` x=>`Hello ${x}, I'm JavaScript` ``` Simple enough. `${x}` is inline `x`, the argument. [Answer] ## Ruby, 32 bytes ``` puts "Hello #{$*[0]}, I'm Ruby" ``` Save as `intro.rb`, run as `ruby intro.rb <name>`. [Answer] # [Wren](https://github.com/munificent/wren), 33 bytes ``` Fn.new{|x|"Hello %(x), I'm Wren"} ``` [Try it online!](https://tio.run/##Ky9KzftfllikkFaal6xgq/DfLU8vL7W8uqaiRskjNScnX0FVo0JTR8FTPVchHKhWqfZ/cGVxSWquXnlRZkmqBkibXnJiTo6Gkk9iXnppYnqqkqbmfwA "Wren – Try It Online") ## Explanation ``` Fn.new{|x| } // New anonymous function "Hello %(x), I'm Wren" // Surrounding the input w/ Hello & wren ``` [Answer] # Python, 33 bytes ``` lambda a:"Hello %s, I'm Python"%a ``` [Answer] # [CJam](http://sourceforge.net/projects/cjam/), 21 bytes ``` "Hello "l", I'm CJam" ``` [Try it online!](http://cjam.tryitonline.net/#code=IkhlbGxvICJsIiwgSSdtIENKYW0i&input=THVpcw) [Answer] # [S.I.L.O.S](http://rjhunjhunwala.github.io/S.I.L.O.S/) ~~112~~ 110 bytes ``` loadLine def : lbl print Hello a=256 :a x=get a if x c if 1 e :c printChar x a+1 if x a lble print , I'm S.I.L.O.S ``` It should be loosely readable. Just a trivial modification of the cat program [Try it online!](http://silos.tryitonline.net/#code=bG9hZExpbmUgCnByaW50IEhlbGxvIAphPTI1NgpsYmxhCng9Z2V0IGEKaWYgeCBjCmlmIDEgZQpsYmxjCnByaW50Q2hhciB4CmEgKyAxCmlmIHggYQpsYmxlCnByaW50ICwgSSdtIFMuSS5MLk8uUw&input=&args=dGVzdA) ]
[Question] [ Print the following output of a happy coincidence addition pattern: ``` 8 8 8 88 +888 ---- 1000 ``` Rules: * No leading spaces except the ones already present * There can be a trailing newline * `+` sign needs to be displayed * Order of parcels needs to be the same No winner. It is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") per language. [Answer] # [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~34~~ ~~33~~ 31 bytes ``` ,' 8'*3+" 88 +888"+'-'*4+1e3 ``` [Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X0ddQUHBQl3LWFsJSFtwaVtYWChpq@uqa5loG6Ya//8PAA "PowerShell – Try It Online") Five bytes shorter than [printing the string as-is](https://tio.run/##K8gvTy0qzkjNyfn/X11BQcGCC5mwsODStgASukDAZWhgYKD@/z8A "PowerShell – Try It Online"), ~~but still not very golfy.~~ now getting to be golfy. Constructs an array of 3x `' 8'` (saving a byte), then array-concatenates the remaining items, with `'-'*4` saving a byte. The other byte savings comes from using `1e3` in place of `1000`. [Answer] # [Charcoal](https://github.com/somebody1234/Charcoal), ~~15~~ 14 bytes ``` G↑↑↓↙³8←→⟦+⁴Iφ ``` [Try it online!](https://tio.run/##S85ILErOT8z5/z8gP6cyPT9Pwyq0QEcBQrjkl@dBKZ/UtBIdBWMdBSULJU1rLt/8slQNK5AgkBNQlJlXomEVlJmeAVQTraStpKNgoqPgnFhcopGmGatp/f//f92yHAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: ``` G↑↑↓↙³ Draw a polygon implicitly closing the path 8 Filled with the string 8 ← Move left one character + Literal string + ⁴ Integer 4 (prints as ----) φ Predefined variable 1000 I Cast to string ⟦ Wrap in array (implicit ⟧) → Override ← print direction Implicitly print one per line ``` [Answer] # Bash, 35 bytes ``` printf %4s\\n {,,,8,+88}8 ---- 1000 ``` [Try It Online](https://tio.run/##S0oszvj/v6AoM68kTUHVpDgmJk@hWkdHx0JH28Ki1kJBFwgUDA0MDP7/BwA) [Answer] # [Python 2](https://docs.python.org/2/), 40 bytes ``` print" 8\n"*3+" 88\n+888\n----\n1000" ``` [Try it online!](https://tio.run/##K6gsycjPM/r/v6AoM69ESUFBwSImT0nLWBvItAAytS1ApC4QxOQZGhgYKP3/DwA "Python 2 – Try It Online") [Answer] # [Python 3](https://docs.python.org/3/), [~~57~~](https://tio.run/##K6gsycjPM/7/Py2/SCFTITNPIdpCBwwtdNS1LSws1HXUdYFAXcfQwMAg1opLoaAoM69EQ13VpFhdQVUhU/P/fwA) [~~52~~](https://tio.run/##K6gsycjPM/7/Py2/SCFTITMv2kIHDC101LUtLCzUddR1gUBdx9DAwCDWqqAoM69EQ13VpFhdNVPz/38A) [~~51~~](https://tio.run/##K6gsycjPM/7/Py2/SCFTITNPwUIHDC101LUtLCzUddR1gUBdx9DAwMCqoCgzr0RDXdWkWF01U/P/fwA) 50 bytes -5 bytes thanks to Mr. Xcoder. -1 byte thanks to Dennis. -1 byte again, thanks to Mr. Xcoder. ``` for i in 8,8,8,88,'+888','-'*4,1000:print('%4s'%i) ``` [Try it online!](https://tio.run/##K6gsycjPM/7/Py2/SCFTITNPwUIHDC101LUtLCzUddR11bVMdAwNDAysCooy80o01FVNitVVMzX//wcA) [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E), 20 bytes -1 byte thanks to Riley ``` 8ÐЫD„8+«'-4×₄R).Bí» ``` [Try it online!](https://tio.run/##ASkA1v8wNWFiMWX//zjDkMOQwqtE4oCeOCvCqyctNMOX4oKEUikuQsOtwrv//w "05AB1E – Try It Online") [Answer] # [SOGL V0.12](https://github.com/dzaima/SOGL), 15 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md) ``` ≥č*xi«∙tν↔β⁸‘4n ``` [Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JXUyMjY1JXUwMTBEKnhpJUFCJXUyMjE5dCV1MDNCRCV1MjE5NCV1MDNCMiV1MjA3OCV1MjAxODRu) - simply `8 8 8 88+888----1000` compressed, then split to line lengths of 4 ~~20~~ 19 byte non-compression based method: ``` 8³'E■888+⁰§o┌4*LM*⁰ ``` [Try it Here!](https://dzaima.github.io/SOGLOnline/?code=OCVCMyUyN0UldTI1QTA4ODgrJXUyMDcwJUE3byV1MjUwQzQqTE0qJXUyMDcw) ``` 8 push 8 ³ triplicate the 8 'E push 88 ■888+ push "888+" ⁰ wrap those in an array § reverse horizontally, padding with spaces o output that ┌4* push "-"*4 LM* push 100*10 ⁰ wrap those two in an array, outputting both ``` [Answer] # [brainfuck](https://github.com/TryItOnline/brainfuck), 107 bytes ``` ++++++++[>+++++>+>+++++++>++++<<<<-]>+++++>++<<+++[->>>>...<.<.<<]>>>>..<..<.<--.>>...<.<++....>.<++++.-... ``` [Try it online!](https://tio.run/##SypKzMxLK03O/v9fGwqi7cCUnbYdVABM2wCBbixMCsgFqdS1AwI9PT0bELSJhfBswHxdXT2YlLY2kNazAzGATF0g@/9/AA "brainfuck – Try It Online") ## Explanation ``` ++++++++[>+++++>+>+++++++>++++<<<<-]>+++++>++<<+++ TAPE: >V_LOOP< C_DASH C_NL C_EIGHT C_SPACE 003 045 010 056 032 ~~~OUTPUT SECTION~~~ V_LOOP TIMES DO [- PRINT C_SPACE x 3 >>>> ... PRINT C_EIGHT <. PRINT C_NL <. <<] PRINT C_SPACE x 2 >>>>.. PRINT C_EIGHT x 2 <.. PRINT C_NL <. C_DASH = C_DASH MINUS 2 (PLUS SIGN) <-- PRINT PLUS SIGN . PRINT C_EIGHT x 3 >>... PRINT C_NL <. PRINT C_DASH x 4 <++.... PRINT C_EIGHT >. C_DASH = C_DASH PLUS 2 ('1') <++++ PRINT '1' . C_DASH = C_DASH MINUS 1 ('0') - PRINT '0' x 3 ... ``` [Answer] # [Bubblegum](https://esolangs.org/wiki/Bubblegum), 23 bytes ``` 00000000: 5350 50b0 e042 262c 2cb8 b42d 8084 2e10 SPP..B&,,..-.... 00000010: 7019 1a18 1800 00 p...... ``` [Try it online!](https://tio.run/##dcwxDoJAEIXh3lO8ygomb8ZdHSw5AQkncGBDo4kN5182auuXv/5jj3iWbX/Vyp878iUTmUEUJoNdbYEt4YhkK5yeYEUJzNMkMp67TqSX5vQ9aHvcqAP0oQ51Eq0/3vJR6wE "Bubblegum – Try It Online") [Answer] # [V](https://github.com/DJMcMayhem/V), 23 bytes ``` 3o³ 8òÙhr8òR1³0-Ò-kr+ ``` [Try it online!](https://tio.run/##ASIA3f92//8zb8KzIDgbw7LDmWhyOMOyUjHCszAbLcOSLWtyK/// "V – Try It Online") [Answer] # Javascript 44 bytes ``` a=x=>` 8 `.repeat(3)+` 88 +888 ---- 1000` console.log(a()) ``` [Answer] ## [GNU sed](https://www.gnu.org/software/sed/), 37 bytes ``` s:$: 8:p;p a\ 88 a+888 a---- a1000 ``` [Try it online!](https://tio.run/##K05N0U3PK/3/v9hKxUpBQcHCqsC6gCsxBsiy4ErUtgCRukDAlWhoYGDw/z8A) I use the `a` command to append text lines to output. For comparison, the trivial solution is to print the hardcoded text like below, 42 bytes. Reduction is 11.9 %. ``` c\ 8\n 8\n 8\n 88\n+888\n----\n1000 ``` [Answer] # [///](https://esolangs.org/wiki////), 31 bytes ``` /!/ 8 /!!! 88 +888 ---- 1000 ``` [Try it online!](https://tio.run/##K85JLM5ILf7/X19RX0FBwYJLX1FREUhbcGlbAAldIOAyNDAw@P8fAA "/// – Try It Online") A measly 3 bytes savings. [Answer] # [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ), 36 bytes ``` ?@ 8`?A?A?@ 88`?@+888`?@----`?z^3 ``` [Answer] # [LOLCODE](http://lolcode.org/), 66 bytes ``` HAI 1.3 VISIBLE " 8:) 8:) 8:) 88:)+888:)----:)1000" KTHXBYE ``` [Try it online!](https://tio.run/##y8nPSc5PSf3/38PRU8FQz5grzDPY08nHVUFJQUHBwkoTlbQAktoWIFIXCKw0DQ0MDJS4vEM8IpwiXf//BwA "LOLCODE – Try It Online") [Answer] # [R](https://www.r-project.org/), ~~46 bytes~~41 bytes ``` cat(' 8 8 8 88 +888 ---- 1000') ``` [Try it online!](https://tio.run/##K/r/PzmxRENdQUHBgguZsLDg0rYAErpAwGVoYGCgrvn/PwA "R – Try It Online") Thanks to Dennis for golfing off 5 bytes. [Answer] # Java 8, 45 bytes ``` v->" 8\n 8\n 8\n 88\n+888\n----\n1000" ``` Boring hard-coded output, but this can't be done any shorter in Java. Just utilizing the repeated part `" 8\n"` is already 52 bytes.. `v->"aaa 88\n+888\n----\n1000".replace("a"," 8\n")` [Try it here.](https://tio.run/##VU7BCoMwDL3vK4KnylDcTZDtD@ZlsMvcIavdqKup2FoYw2/vInpZSB4kebz3OgyY2UFR176jNOgcnFHTdwegyavxiVJBvawAFz9qeoEUV6tbCGnF15mH23n0WkINBEeIITslzC8b@seScV8umHE1dCiKIonVKjFMD8MSm1JYLHpOIlbX2x0w3WJ8nFd9biefD/zyhgTlUtBkTLplmuMP) [Answer] # [J](http://jsoftware.com/), ~~28~~ 27 bytes ``` |.|:'1-+','0-88888'$~3,4,:7 ``` [Try it online!](https://tio.run/##y/r/PzU5I79Gr8ZK3VBXW11H3UDXAgTUVeqMdUx0rMz//wcA) ``` 0-8 '0-88888'$~3,4,:7 Three rows: 0-88 0-88888 '1-+', "1-+" on top |.|: Rotate counter-clockwise ``` [Answer] # J, 37 bytes ``` 7 4 $' 8 8 8 88+888----1000' ``` [Answer] # Brainfuck, 104 bytes ``` ++[++[<->->->+>++<<<]>-]<<<<...<<<<<<.<-.>>--...<.<.>>...<.<.>>..<..<.>>>.<<...<.>>>++....<<<.<<<--.-... ``` Uses the same technique as [this](https://codegolf.stackexchange.com/a/68494/70894) genius answer. [Answer] # [Tcl](http://tcl.tk/), 42 bytes ``` puts " 8 8 8 88 +888 ---- 1000" ``` [Try it online!](https://tio.run/##K0nO@f@/oLSkWEFJQUHBgguZsLDg0rYAErpAwGVoYGCgxPX/PwA "Tcl – Try It Online") [Answer] # [Stax](https://github.com/tomtheisen/stax), 19 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax) ``` ∩π╚nY╤¼æ♂ç♦d└tä♂&lò ``` [Run and debug it](https://staxlang.xyz/#p=efe3c86e59d1ac910b870464c074840b266c95&a=1) ASCII equivalent: ``` .-+]125E{'8*eN$m+MrVk+m ``` Build the `8`s together with the line below by transposing the string representation of the array `[-8,-88,-88888]`. [Answer] # [Befunge-93](https://github.com/catseye/Befunge-93), 66 bytes ``` "0001"25*"-":::25*"888+"25*"88 "25*"8 "::25*"8 "::25*"8 "::>:#,_@ ``` [Try it online!](https://tio.run/##S0pNK81LT/3/X8nAwMBQychUS0lXycrKCsSwsLDQVoIwFBQgDAUlqBQKw85KWSfe4f9/AA "Befunge-93 – Try It Online") ]
[Question] [ The title is pretty self-explanatory, isn't it? Your task is to output the alphabet (the string `"abcdefghijklmnopqrstuvwxyz"`) to STDOUT, using each and every letter of the alphabet in your program once and only once. Oh, and for a bit of extra fun? The letters "g", "o", "l" and "f" must be in order (just for the code to be a bit more code-y). Rules: * Only standard letters of the alphabet from ASCII count as letters (`ë != e`). * Both uppercase and lowercase characters count as letters (if you have `E`, you are not allowed to have `e`). * You are allowed to use comments, but every character in the comment is equal to 2 bytes. * Your final score will be the byte-count of your program, subtracted by 26. This is `code-golf`, so shortest code in bytes wins. [Answer] # [05AB1E](http://github.com/Adriandmen/05AB1E), ~~27~~ 26 - 26 = 0 bytes Thanks to [Katenkyo](https://codegolf.stackexchange.com/users/41019/katenkyo) for saving 1 byte :). Code: ``` golfAqbcdehijkmnprstuvwxyz ``` [Try it online!](http://05ab1e.tryitonline.net/#code=Z29sZkFxYmNkZWhpamttbnByc3R1dnd4eXo&input=). [Answer] # Brainfuck, 67 - 26 + 26 (comment) = ~~41~~ 67 bytes ``` golfabcdehijkmnpqrstuvwxyz++++++++[>++++++++++++>+++<<-]>>++[-<+.>] ``` [Try it online!](http://brainfuck.tryitonline.net/#code=Z29sZmFiY2RlaGlqa21ucHFyc3R1dnd4eXorKysrKysrK1s-KysrKysrKysrKysrPisrKzw8LV0-PisrWy08Ky4-XQ&input=) [Answer] # Jolf, 27 - 26 = 1 byte ``` goΔaplfbcdehijkmnqrstuvwxyz ``` `o` assigns `Δ` to `apl`, which `a`lerts `pl`, which is the lowercase alphabet. I take it that "in order" does not mean "adjacent to". You can see that `f` follows `l` which follows `o` which follows `g`. [Try it out here!](http://conorobrien-foxx.github.io/Jolf/#code=Z2_OlGFwbGZiY2RlaGlqa21ucXJzdHV2d3h5eg) [Answer] ## Batch, 36 + 13 + 9 - 26 = 32 bytes ``` :g @echo ab%0pqrstuvwxyz :lfdijkmn ``` Requires that the batch file itself be named `cdefghijklmno`. Scored as 36 (size of file `cdefghijklmno`) + 13 (size of filename `cdefghijklmno`) + 9 (commented letters) - 26. Edit: Saved 29 bytes even under my scoring scheme thanks to @ΈρικΚωνσταντόπουλος. [Answer] # CJam, 29 - 26 = 3 bytes ``` "golfabcdehijkmnpqrstuvwxyz"$ ``` [Try it online!](http://cjam.tryitonline.net/#code=ImdvbGZhYmNkZWhpamttbnBxcnN0dXZ3eHl6IiQ&input=) [Answer] # MATL, 29-26 = 3 bytes ``` 'abcdehijkmnpqrstuvwxyzgolf'S ``` [Try it Online!](http://matl.tryitonline.net/#code=J2FiY2RlaGlqa21ucHFyc3R1dnd4eXpnb2xmJ1M&input=) [Answer] # Pyke, 29 - 26 = 3 bytes ``` "golfabcdehijkmnpqrstuvwxyz"S ``` [Answer] # J, 36 - 26 = 10 bytes ``` 'golfabcdehjkmnpqrstvwxyz']u:97+i.26 ``` Not a comment, just a string that's discarded. `u:` converts numbers to ASCII chars, and `97+i.26` is a range from 0..25 with vectorized addition over 97, the char code of `a`. Here's an alternative (albeit longer) solution using `a.`: ``` 'golfbcdehjkmnpqrstvwxyz']a.{~97+i.26 ``` [Answer] ## dc, 111 - 26 = 85 bytes ``` [gol][P]s@[abcdef]1 1=@103 1 1=@[hijk]1 1=@108 1 1=@[mn]1 1=@111 1 1=@112 1 1=@[qr]1 1=@115 1 1=@[tuvwxyz]1 1=@ ``` **Run:** dc -f alphabet\_letters.dc **Output:** ``` abcdefghijklmnopqrstuvwxyz ``` I use `1 1=@` as a trick to simulate `l@x`, that executes the print command `P` stored in register `@`. This is one example of a language that entailed a non-trivial solution for this task. [Answer] # Actually, 29 - 26 = 3 bytes ``` "golfabcdehijkmnpqrstuvwxyz"S ``` [Try it online!](http://actually.tryitonline.net/#code=ImdvbGZhYmNkZWhpamttbnBxcnN0dXZ3eHl6IlM&input=) [Answer] # Jelly, 29 - 26 = 3 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) ``` “golfabcdehijkmnpqrstuvwxyz”Ṣ ``` [Try it online!](http://jelly.tryitonline.net/#code=4oCcZ29sZmFiY2RlaGlqa21ucHFyc3R1dnd4eXrigJ3huaI&input=) [Answer] # Ruby, ~~57~~ ~~37~~ 47 - 26 = 21 bytes I'm ashamed it took me that many tries to arrive at this super obvious solution. ``` "gol";$><<"abcdef\147hijk\154mnp\157qrstuvwxyz" ``` See it on ideone: <http://ideone.com/FAtiy3> [Answer] # SmileBASIC, ~~68~~ 61 bytes -26 = 35 ``` _=97@V?CHR$(_); _=_+1GOSUB"@"+KEY(3)[2]*(_<123)@ADLIJFMNPQTWXZ ``` Explained: ``` _=97 'set variable _ to 97 (ascii value of "a") @V 'label ?CHR$(_) 'convert _ to a character and print _=_+1 'add 1 to _ GOSUB"@"+KEY(3)[2]*(_<123) 'jump to @V (KEY(3) is "SAVE") if _ is less than 123 (ascii code for z +1) @ADLIJFMNPQTWXZ 'create a label with the unused letters ``` ]
[Question] [ Write a program to find the sum of all odd numbers between a given range [a,b]. Input consists of a single line containing two integers a and b separated by a space. 0 ≤ a,b ≤ 1,000,000,000,000. Your program should not take more than 10 secs. ``` Sample Inputs 1 5 4 8 1 8 0 5 Sample Outputs 9 12 16 9 ``` [Answer] ## [Funciton](http://esolangs.org/wiki/Funciton) Not a language particularly suitable for golfing, but I gave it my best shot to cram everything together in best code-golf tradition. Near the end I was making rearrangements that gave net savings of a single character until I could find no more ways to improve it :) This is **398 characters** (or 786 bytes in UTF-16). I challenge anyone to find a way to make it smaller :) ``` ┌───┐ ┌──────────┐ ╔╧╗┌─┴╖┌─╖│╔═╗┌──╖┌─╖│ ║ ║│>>╟┤_╟┘║1╟┤>>╟┤♯╟┘ ╚═╝╘╤═╝╘═╝ ╚═╝╘═╤╝╘═╝ └┐ ┌─┐ ╔══╗┌┴───┐ ╔══╗┌┴╖│┌┴╖║32║│ ┌─╖│ ║21╟┤×╟┘│♯║╚╤═╝└─┤×╟┘ ╚══╝╘═╝ ╘╤╝┌┘ ┌─┐╘╤╝ ┌──────┬─┘┌┘ ┌┴╖└─┘ │╔═╗ ┌┴╖┌┘ │−╟┐┌───────╖ │║0║ ┌┤ʘ╟┘┌─┐╘╤╝└┤int→str╟ │╚╤╝ │╘═╝┌┴╖└─┘ ╘═══════╝ │┌┴╖╔╧╗┌─┤×╟┐ └┤ʃ╟╢ ║│ ╘═╝│ ╘╤╝╚═╝└┬───┘ │┌─╖┌─┴╖╔═╗╓─╖┌───────╖ └┤_╟┤>>╟╢1║║_╟┤str→int╟ ╘═╝╘══╝╚═╝╙─╜╘═══════╝ ``` [Answer] ## Ruby, 43 characters ``` p eval"-(%d/2)**2+((%d+1)/2)**2"%gets.split ``` Example for largest input: ``` $ time echo "1 10000000000000000" | ruby oddsum.rb 25000000000000000000000000000000 real 0m0.006s user 0m0.000s sys 0m0.000s ``` [Answer] ## Windows PowerShell, ~~84~~ ~~61~~ 55 ``` $a,$b=-split"$input+1"|iex|%{($_-band-2)/2} $b*$b-$a*$a ``` O(1) runtime. [Answer] ## Golfscript - 12 chars ``` ~)2/2?\2/2?- ``` can be done in 11 chars if the order of the inputs is reversed ``` ~)]{2/2?}/- ``` [Answer] # Python, 32 bytes As unnamed lambda function: ``` lambda a,b:((b+1)/2)**2-(a/2)**2 ``` Did some math to get a direct formula. Proof will follow. [Answer] # [Vyxal](https://github.com/Vyxal/Vyxal) `s`, 7 bytes ``` ›"2ḭ²Ḃ¯ ``` [Try it Online!](https://lyxal.pythonanywhere.com?flags=s&code=%E2%80%BA%222%E1%B8%AD%C2%B2%E1%B8%82%C2%AF&inputs=8%0A4&header=&footer=) ``` STACK = [4,8] › Increment, [5, 8] " Pair [[5, 8]] 2 Push 2 [[5, 8], 2] ḭ Integer Division [[2, 4]] ² Square [[4, 16]] Ḃ Reverse [[16, 4]] ¯ Deltas [[12]] Implicit Sum [12] ``` ]
[Question] [ The challenge today is to write a program that outputs a known proverb, `Where there is a will, there is a way.`, that means if someone is determined to do something, he will find a way to accomplish it regardless of obstacles. ## Output It has to be exactly the same, including the space bar and punctuation and excluding the newline at the end. ``` Where there is a will, there is a way. ``` You may not use `Where` `there` `is` `a` `will` or `way` anywhere in the source. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), shortest answer per language wins. [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E), 23 bytes -2 thanks to @Kevin Cruijssen ``` …€Ç€ˆ€…“‚à ÿ€§, ÿƒƒ.“.ª ``` [Try it online!](https://tio.run/##yy9OTMpM/f//UcOyR01rDrcDidNtQALEb5jzqGHW4WaFw/uBAoeW6wAZxyYdm6QHlNA7tOr/fwA "05AB1E – Try It Online") ## Older version, 24 bytes ``` “‚Àǀˆ€…€§,€Ç€ˆ€…ƒƒ.“.ª ``` -1 thanks to @petStorm [Try it online!](https://tio.run/##yy9OTMpM/f//UcOcRw2zDjc/alpzuB1InG4DEo8algHJQ8t10EWPTTo2SQ@oRe/Qqv//AQ "05AB1E – Try It Online") [Answer] # JavaScript (ES6), 50 bytes ``` _=>`W\here${s=' t\here i\s \x61 w'}ill,${s}\x61y.` ``` [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@z/e1i4hPCYjtShVpbrYVl2hBMxWyIwpVoipMDNUKFevzczJ0QFK1oL4lXoJ/5Pz84rzc1L1cvLTNdI0NDX/AwA "JavaScript (Node.js) – Try It Online") [Answer] # [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 38 bytes ``` Wht8ll,t0y. t th 8s 0 w h here T`d`l ``` [Try it online!](https://tio.run/##K0otycxL/P@fKzyjxCInR6fEoFKPq4RLoSRDwaJYwUChnCuDKyO1KJUrJCElIef/fwA "Retina 0.8.2 – Try It Online") Explanation: ``` Wht8ll,t0y. ``` Insert `Wht1ll,t0y.`. ``` t th 8s 0 w ``` Expand to `Wh th 8s 0 w8ll, th 8s 0 w0y.`. ``` h here ``` Expand to `Where there 8s 0 w8ll, there 8s 0 w0y.`. ``` T`d`l ``` Transliterate the digits to letters, so as to avoid having the words `is` or `a` in the code. [Answer] # [C (gcc)](https://gcc.gnu.org/), ~~87 78 75 ...~~ 59 bytes *-9 bytes thanks to @my pronoun is monicareinstate!* *-3 bytes thanks to @Arnauld!* *+1 byte for forgetting the period* *-3 bytes thanks to @petStorm!* *-3 bytes thanks to @ceilingcat!* ``` f(){printf("W\here%sill,%1$s\x61y."," t\here i\s \x61 w");} ``` [Try it online!](https://tio.run/##S9ZNT07@/z9NQ7O6oCgzryRNQyk8JiO1KFW1ODMnR0fVUKU4psLMsFJPSUdJoQQso5AZU6wAElQoV9K0rv2fm5iZp6GpUK0ANMRaofY/AA "C (gcc) – Try It Online") [Answer] # [APL (Dyalog Unicode)](https://www.dyalog.com/), 102 bytes ``` x←⎕UCS 97 ⎕←('⎕'⎕R'')'Wher⎕e ther⎕e i⎕s ',x,' w⎕ill, t⎕here i⎕s ',x,' w⎕ay.' ``` [Try it online!](https://tio.run/##SyzI0U2pTMzJT///v@JR24RHfVNDnYMVLM25gCwgX0MdSINwkLq6pnp4RmoRkJ2qUAJjZALJYgV1nQoddYVyIDszJ0dHoQTIACrAlE2s1FP//x8A "APL (Dyalog Unicode) – Try It Online") # Explanation: ``` x←⎕UCS 97 ``` Define x and store ASCII (⎕UCS) 97 ``` ⎕← ``` Print (not be confused with define ⎕) ``` ('⎕'⎕R'') ``` ⎕Replace '⎕' to empty string ``` 'Wher⎕e ther⎕e i⎕s ',x,' w⎕ill, t⎕here i⎕s ',x,' w⎕ay.' ``` will be ``` 'Where there is ',x,' will, there is ',x,' way.' ``` And ``` ...',x,'... ``` Means Followed by "a" followed by other string Or if you want everything in one code then ``` x←⎕UCS 97 x = "a" ⎕←('⎕'⎕R'')'Wher⎕e ther⎕e i⎕s ',x,' w⎕ill, t⎕here i⎕s ',x,' w⎕ay.' ⎕← Print ' w⎕ay.' The string 'w⎕ay.' , Join x "a" , Join ' w⎕ill, t⎕here i⎕s ' The string ' w⎕ill, t⎕here i⎕s ' ,x, Join, "a", Join 'Wher⎕e ther⎕e i⎕s ' The string 'Wher⎕e ther⎕e i⎕s ' ('⎕'⎕R'') Replace '⎕' to Empty String ``` [Answer] # [Bash](https://www.gnu.org/software/bash/) + Core utilities, ~~54~~ ~~52~~ ~~51~~ 50 bytes ``` echo WHERE "THERE IS A w"{ILL\,,Ay}|tr ?-V\\n _-v. ``` [Try it online!](https://tio.run/##S0oszvj/PzU5I18h3MM1yFVBKQRMeQYrOCqUK1V7@vjE6Og4VtbWlBQp2OuGxcTkKcTrlun9/w8A "Bash – Try It Online") --- --- If we're allowed to print a newline at the end, as several other entries appear to be doing, then: # [Bash](https://www.gnu.org/software/bash/) + Core utilities, 47 bytes ``` echo WHERE "THERE IS A w"{ILL\,,Ay.}|tr ?-V _-v ``` [Try it online!](https://tio.run/##S0oszvj/PzU5I18h3MM1yFVBKQRMeQYrOCqUK1V7@vjE6Og4VurV1pQUKdjrhinE65b9/w8A) [Answer] # [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 1170 bytes (by hand) I wrote this one by averaging the ascii value of every character in the saying. I then pushed the value (87) to the stack. Then on stack 2 I pushed the ascii value of the next character - 87 then added 87. The numbers were all coded by [this](https://brain-flak.github.io/integer/) program ``` ((((((()()()){}()){}){}())){}{})<>([(((()()()()()){}){}){}()])((((()()()()){}){}()){}<>({})<>)((()()()()()){}<>({})<>)((((()()()()){}){}){}<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)((()()()()()){}<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)((((()()()){}()){}){}<>({})<>)((((()()()){})){}{}<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)(((()()()){}()){}<>({})<>)(((((()()())){}{})){}{}<>({})<>)(((()()()){}()){}<>({})<>)(((()()()()){}){}()<>({})<>)((((()()()){}()){}){}()<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)([((((()()()){}()){})){}{}()]<>({})<>)((((()()()){}())){}{}<>({})<>)((((()()()){}())){}{}<>({})<>)((((()()()){})){}{}<>({})<>)((((()()()()){}){}){}<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)((()()()()()){}<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)((((()()()){}()){}){}<>({})<>)((((()()()){})){}{}<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)(((()()()){}()){}<>({})<>)(((((()()())){}{})){}{}<>({})<>)(((()()()){}()){}<>({})<>)(((()()()()){}){}()<>({})<>)((((()()()){}()){}){}()<>({})<>)([((()()()()()){}){({}[()])}{}]<>({})<>)((((()()()){}())()){}{}<>({})<>)(((()()()){}()){}<>({})<>)(((()()()()){}){}()<>({})<>)(<>{}<>) ``` [Try it online!](https://tio.run/##SypKzMzTTctJzP7/XwMCNEFQs7oWTEBoIAlk2thpRMMVQBXBlMRqaiBJwTVW1wI1gbVqomlEFtfAMBAhG41hIVAmGmQh0EmxhE0nXj@mz7HLQkKDLBtQLEA1HSoHCWk0G/DqRAty/D5ClifW3dFYTAI7EKgUp22YPiBSFqfcaOoYlKkDzRwN6rjOxg6kUpPr////uo4A "Brain-Flak – Try It Online") # [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 640 bytes (using text generator found [here](https://codegolf.stackexchange.com/a/157665/63187)) This was produced using an answer to a challenge I maded a while back. ``` (((((<(((<(<((<<((((<(<((((((((<(<(((((()(()(()()()()()){}){}){})(()(((()()[]){}){}){})({}){})[(((()[]){}){}){}])(()(()()[]){}){})>(((([]){}){}){})()((()([])({}){}){}){})>(((()()[]){}){})()(()((()()()[]){}){}){})[()()[]])[()((([]){}){}){}])(()(()[]){})({}){})()()[])[()[]])()()())((()()()){}){})>((()[]){})((()()()){}){})>(((()[])({}){}){}))[()()()])(()(()()()){}){})[()(()([]){}){}])>(()((()()[]){}){})>(()()()()()()()()()[])()()(()()()[])({}){})[(()()()()()){}])>(()()()()()()[])()(()()()()()()()[]){})>((()([]){}){})[()((()()()){}){}])()()())((()()()){}){})>([])()(()[]){})()((()()()){}){})[()((()()()){}){}])()()())[()((()()()()){}){}]) ``` [Try it online!](https://tio.run/##dVFJDoMwDPyOc@AHEVLfYflAD5WqVj1wrfp2l3iLEwQJYGbsydjc9@35WR7v7cUM7apyH89awUOAISy2bZXvz7bgwiAlVF8oVCIodAJcW85QW0TvgCAwz8uF5kkNZQFUgCQYtP14hSB0GoBaY/25bjrcq86MUN2sGoBCaWjJmvZmftboIQ@kzAvNWP@KAed/QlOxlp2kvKE@GoSpr@tBuKZNY064VkpM55h5uf0B "Brain-Flak – Try It Online") [Answer] # [Python 3](https://docs.python.org/3/), ~~95~~ ~~60~~ 59 bytes ``` exit("W""here%sill,%s\x61y."%((" t""here i""s \x61 w",)*2)) ``` [Try it online!](https://tio.run/##K6gsycjPM/7/P7Uis0RDKVxJKSO1KFW1ODMnR0e1OKbCzLBST0lVQ0NJoQQipZCppFSsAJJQKFfS0dQy0tT8/x8A "Python 3 – Try It Online") -35 bytes thanks to newbie and petStorm. -1 byte thanks to newbie and petStorm. I completely forgot that % did string formatting. [Answer] # [brainfuck](https://github.com/TryItOnline/brainfuck), 241 bytes ``` ++++++++++[>+++++++++>++++++++++>++++++++++>+++++++++++>++++>+++<<<<<<-]>---.>++++.>+.>++++.<.>>>++.<<++.<<.>.>--.<.>>>.<<<<+.>>+.>>.<<<----.>>>.<<++++.<<.+++..>>>++++.>.<<---.<<----.>++++.>--.<.>>>.<<<<+.>>+.>>.<<<----.>>>.<<++++.<.>++.>++. ``` [Try it online!](https://tio.run/##jYxBCoBADAMfJM0LSj8iHlQQRPAg@P7aprqeBAubzpYk0zGu@3LOm3vXpreGL31gcYpyZDARAa@hNyjMLLdSYAhXXZGp8KWXH2GeXFlFrmrIUtCDx1nH/3WZ4HO/AA "brainfuck – Try It Online") Could use some golfing but it's getting late. [Answer] # [Erlang (escript)](http://erlang.org/doc/man/escript.html), 65 bytes ``` z()->"W\here"++[" t\here i\x73 \x61 w"++X||X<-["ill,","\x61y."]]. ``` [Try it online!](https://tio.run/##Sy3KScxL100tTi7KLCj5z/W/SkNT104pPCYjtShVSVs7WkmhBMxWyIypMDdWiKkwM1QoB0pE1NRE2OhGK2Xm5Ogo6SiBxCv1lGJj9f7nJmbmaUTHairo2nEpAEFmvlVaeVFmSaoG0GxNvf8A "Erlang (escript) – Try It Online") # [Erlang (escript)](http://erlang.org/doc/man/escript.html), 65 bytes This simply employs the almighty hard-coding. ``` z()->"W\here t\here i\x73 \x61 w\ill, t\here i\x73 \x61 w\x61y.". ``` [Try it online!](https://tio.run/##Sy3KScxL100tTi7KLCj5z/W/SkNT104pPCYjtShVoQRCZcZUmBsrxFSYGSqUx2Tm5OhglQCSlXpKev9zEzPzNKJjNRV07bgUgCAz3yqtvCizJFUDaLam3n8A "Erlang (escript) – Try It Online") [Answer] # [V (vim)](https://github.com/DJMcMayhem/V), 44 bytes ``` iWh t wi²l, t w97y.Ót/&h i115 97 Óh/here ``` [Try it online!](https://tio.run/##K/v/PzM8Q6FEoTzz0KYcHRBDzNK8Uk/68OQSfbUMhUwxQ0NTBaAQ1@HJGfoZqUWp//8DAA "V (vim) – Try It Online") Hexdump: ``` 00000000: 6957 6820 7420 7769 b26c 2c20 7420 7716 iWh t wi.l, t w. 00000010: 3937 792e 1bd3 742f 2668 2069 1631 3135 97y...t/&h i.115 00000020: 2016 3937 0dd3 682f 6865 7265 .97..h/here ``` I suspect this can be shorter, but I'm a bit rusty with V. --- Yes it can be shorter! # [V (vim)](https://github.com/DJMcMayhem/V), 42 bytes ``` i.yaw 97 si ereht ,lliw 97 si e erehWæ ``` [Try it online!](https://tio.run/##K/v/P1OvMrFcQczSXKE4UyG1KDWjREEnJycTIcQHFg2XPrzs/38A "V (vim) – Try It Online") Hexdump: ``` 00000000: 692e 7961 7720 1639 3720 7369 2065 7265 i.yaw .97 si ere 00000010: 6874 202c 6c6c 6977 2016 3937 2073 6920 ht ,lliw .97 si 00000020: 650e 2065 7265 6857 1be6 e. erehW.. ``` --- # V or vim, either one, 38 bytes ``` iwHERE THERES A WILL, THERES A WAY.V~ ``` [Try it online!](https://tio.run/##K/v/P7PcwzXIVSEERAYrOCqEe/r46CBxHSP1pMPq/v8HAA "V (vim) – Try It Online") [Answer] # [Deadfish~](https://github.com/TryItOnline/deadfish-), 341 bytes ``` {{i}d}dddc{i}{i}dddcdddc{i}iiic{d}dddc{{d}iii}ic{{i}dd}iiiic{d}ddcdddc{i}iiic{d}dddc{{d}iii}ic{{i}ddd}iiic{i}c{{d}ii}dddc{{i}dddd}iiiiic{{d}iiii}dddddc{{i}d}dddc{d}ddddciiicc{{d}iiii}ddddc{d}ddc{{i}dd}iiiic{d}ddcdddc{i}iiic{d}dddc{{d}iii}ic{{i}ddd}iiic{i}c{{d}ii}dddc{{i}dddd}iiiiic{{d}iiii}dddddc{{i}d}dddc{d}{d}ddc{i}{i}iiiic{{d}iii}dddddc ``` [Try it online!](https://tio.run/##xZAxDoAwDANfxKNQDcIzY5S3hzQxEmxsTLbja1MV24qd57FEmNHhAEaa6dMpkRymLjWj56CYGVR@oNElXY2g0r6K95meqW2uBGNCb0r7/3iRNtePPWGxERc "Deadfish~ – Try It Online") Not as bad as usual! [Answer] # [Japt](https://github.com/ETHproductions/japt) [`-S`](https://codegolf.meta.stackexchange.com/a/14339/), 26 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1) ``` `ï,ÀnØi,ÌÀÎsn°y.`qn ``` [Test it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LVM&code=YO8AACzAAYluhNhpLMzAzg9zboSweS5gcW4) [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 25 bytes ``` “ḅṫ!Ḃḃ0ʋŀɼYẆḊỵ2Ƭqɦ⁷-&Y£z» ``` [Try it online!](https://tio.run/##ATsAxP9qZWxsef//4oCc4biF4bmrIeG4guG4gzDKi8WAybxZ4bqG4biK4bu1Msasccmm4oG3LSZZwqN6wrv//w "Jelly – Try It Online") [Answer] # [Stax](https://github.com/tomtheisen/stax), 13 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax) ``` üx♦r i0c@9lc¡ ``` [Run and debug it](https://staxlang.xyz/#p=817804722069306340396c63ad&i=&a=1) ]
[Question] [ ### Challenge You are supposed to output the series I recently designed which goes as follows which are pen stroke counts of ascending prime numbers: ``` 2, 3, 2, 4, 3, 5, 6, 5, 7, 7, 7, 10, 4, 6, 7, 4, 4, 4, 7, 6, 8... ``` ### Example This is an illustration of how this series is formed, first, it takes a prime number from in sequence form, so it takes the first prime number `2`. It converts it to the Roman numeral of 2, which is `II`, here pen stroke is a straight long line, in this case, it is two so the first element in this series is `2`. ### Dictionary It will really be confusing to explain the pen stroke for each letter, and we know all Roman numerals contain characters `I, V, X, L, C, D, M` only, here is already shown pen stroke value of each letter ``` 0 C 1 I, L, D 2 V, X 3 [None] 4 M ``` For example `MMMMMMMCMXIX` is the Roman numeral `7919` so you compare it with the above dictionary `M` has 4 pen strokes and so on, they add to `37` pen strokes. ### Ambiguities It can be queried why `M` is not assigned `2` strokes, and `L` is not assigned 2 strokes; it is because they are not written this way in numeral numbers. As M and L are written: [![enter image description here](https://i.stack.imgur.com/2uASe.jpg)](https://i.stack.imgur.com/2uASe.jpg) [![enter image description here](https://i.stack.imgur.com/mSgAN.jpg)](https://i.stack.imgur.com/mSgAN.jpg) In standard Roman numerals, M makes 4 pen strokes and L as 1 because another line of L is too small to be considered a pen stroke. ### Task Write the shortest code in the number of bytes that takes an input number, and outputs as many elements from the input as possible. ### Test Cases ``` 5 => 2, 3, 2, 4, 3 10 => 2, 3, 2, 4, 3, 5, 6, 5, 7, 7 15 => 2, 3, 2, 4, 3, 5, 6, 5, 7, 7, 7, 10, 4, 6, 7 ``` --- Do not forget that it is the implementation of pen stroke counts of Roman numerals of prime numbers in ascending order only! [Answer] # [Vyxal](https://github.com/Vyxal/Vyxal), ~~15~~ 14 [bytes](https://vyxapedia.hyper-neutrino.xyz/codepage) -1 thanks to [lyxal](https://codegolf.stackexchange.com/users/78850/lyxal) (vectorisation). ``` ʁǎøṘC»ṫN»$%5%Ṡ ``` **[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLKgceOw7jhuZhDwrvhuatOwrskJTUl4bmgIiwiIiwiMTAwIl0=)** ### How? ``` ʁǎøṘC»ṫN»$%5%∑ - input a non-negative integer, N ʁ - range -> [0..N-1] ǎ - ith prime -> [2,3,5,...p(N)] øṘ - to roman numerals : I V X L C D M C - cast to ordinals 73 86 88 76 67 68 77 »ṫN» - 39602 $ - swap % - modulo 36 42 2 6 5 26 24 5% - modulo five 1 2 2 1 0 1 4 Ṡ - sums ``` [Answer] # [Vyxal](https://github.com/Vyxal/Vyxal), ~~19~~ 18 bytes ``` ʀǎƛøṘkṘvḟ»øṪK»fvi∑ ``` [Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLKgMeOxpvDuOG5mGvhuZh24bifwrvDuOG5qkvCu2Z2aeKIkSIsIiIsIjUiXQ==) ``` ʀǎƛøṘkṘvḟ»øṪK»fvi∑ ʀǎƛ # map over each of the first n primes: øṘ # convert to roman numerals kṘvḟ # index of each character in "IVXLCDM" »øṪK»f # digits of compressed integer 1221014 vi # index each into digit list ∑ # sum ``` [Answer] # [Factor](https://factorcode.org/) + `math.primes math.unicode roman`, 63 bytes ``` [ nprimes [ >roman [ "c--ildvx----m"index 3 /i ] map Σ ] map ] ``` [Try it online!](https://tio.run/##LYyxCsIwGIT3PsXRPRURFwVXcXERp9AhJL8YTP7ENJX6PL6PrxQj7U133Hd3UzqHVK6X0/m4w4MSk4NX@d7FZD0NSMErxkDPkVjX/O9mYGSrgyHERDm/K84Z@6ZZb4sEL2uJw3wg0WohrDOvSVT51rKhCRusLPr6F/H9LKYvWjmHrvwA "Factor – Try It Online") ``` [ ! start quotation (anonymous function) nprimes ! get a list of the first number of primes indicated by input [ ! start map >roman ! convert current prime to roman numerals [ ! start map "c--ildvx----m" ! push string to stack index ! find the index of the current letter in the string 3 /i ! integer divide by 3 ] map ! map over each letter in the roman numerals of current prime Σ ! take sum of results of the letters ] map ! map over the first n primes ] ! end quotation ``` [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 14 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ``` Åpε.XÇŽœ s%5%O ``` Port of [JonathanAllan's Vyxal answer](https://codegolf.stackexchange.com/a/260398/52210), so make sure to upvote him as well! [Try it online.](https://tio.run/##yy9OTMpM/f//cGvBua16EYfbj@49OpmrWNVU1f//f0MDAwA) **Outputting the infinite sequence without input would be 14 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) as well:** ``` Žœ ∞<Ø.X€Ç%5%O ``` [Try it online.](https://tio.run/##ASAA3/9vc2FiaWX//8W9xZMK4oiePMOYLljigqzDhyU1JU///w) **Explanation:** ``` Åp # Get a list of the first (implicit) input amount of primes ε # Map over each prime number: .X # Convert it to a Roman number string Ç # Convert this string to a list of its codepoint integers Žœ\n # Push compressed integer 39602 s # Swap so the list of lists of codepoint integers is at the top % # Modulo the 39602 by each of these codepoints 5% # Modulo-5 that O # Take the sum of each inner list # (after which the resulting list is output implicitly) ``` [See this 05AB1E tip of mine (section *How to compress large integers?*)](https://codegolf.stackexchange.com/a/166851/52210) to understand why `Žœ\n` is `39602`. [Answer] # Excel, ~~142~~ 139 bytes ``` =LET( a,SEQUENCE(99), b,TOROW(a), MMULT( LOOKUP( MID(ROMAN(TAKE(FILTER(a,MMULT(N(MOD(a,b)=0),a^0)=2),A1)),b,1), {"","D","M","V"}, {0,1,4,2} ), a^0 ) ) ``` Input in cell `A1`. The static `99` within the part `SEQUENCE(99)` has been arbitrarily chosen and will generate a valid output for `A1<26`. [Answer] # [Wolfram Language(Mathematica)](https://www.wolfram.com/wolframscript/), ~~127~~ 101 bytes Saved 26 bytes thanks to @att's comment. --- Golfed version. [Try it online!](https://tio.run/##lY5JC8IwEIXv/ooQQVQibV3BjYpeBBVREaEUGcq4oElLmoLi8tdr2uJFPCgM7xtm3jyGgzogB3X0II53vZV0unc6pJW@yehYw2J0kmGUYa1RZXSTYapRv/cNe3gACZ5CGdoLn4OYRRwlnO25PHK0827hOZASrs98IQ6S0RzFUkn/hKEjtm67t3OE28kVywQvwIMzkiiEPZJyKfdptxquYehYoYi2@5EKIhWSW5WRGiNa62nTYKSZautdlpnu9LT1@Jpr/p37NeeH95K7@AU) ``` f=Tr[<|"C"->0,"I"->1,"L"->1,"D"->1,"V"->2,"X"->2,"M"->4|>/@Characters@RomanNumeral@Prime@#]&~Array~#& ``` Ungolfed versrion. [Try it online!](https://tio.run/##lZFRS8MwEMff@ymOPumIrNXNgXN7qS@DTYYOEUKQOENX1iYlTUDo@tnrNbO16h40hPAnufvd/y4ZNzuRcZNseV0XRqu9iJSVpoAZ3B7Aj3y4mENAwF84FaJaduquU09OXaJ67tTKqREc5lPPy4V8/MJT@cLgZgYr9WZTQUutMi7vbSY0TwkcfRQV8QBX/w1dLaQRsdAIS2RM1zrJBJUMyz00cT6buqRPBMZvlOEpXSq1tzntd0gg2nHNt0bogvaLMPYd4jG039RZtz0Urf8Nf0X7P3pL0E2ZkGYuskKUdzYA8c6zPBVgCx4LGJz/AoZjNhxiN9IAhitrcoufUOIcr0gzzZETYwLX7py0OwzcG95OqpPc4N/ck5w/2Gvy6voD) ``` strokeCounts = <| "C" -> 0, "I" -> 1, "L" -> 1, "D" -> 1, "V" -> 2, "X" -> 2, "M" -> 4 |>; penStrokeCount[n_] := Module[{romanNumeral, strokes}, romanNumeral = IntegerString[Prime[n], "Roman"]; strokes = Total[Lookup[strokeCounts, Characters[romanNumeral]]]; strokes ] primePenStrokes[n_] := Table[penStrokeCount[i], {i, 1, n}]; (* example usage *) primePenStrokes[15]//Print (* outputs {2, 3, 2, 4, 3, 5, 6, 5, 7, 7, 7, 10, 4, 6, 7} *) primePenStrokes[10]//Print (* outputs {2, 3, 2, 4, 3, 5, 6, 5, 7, 7} *) primePenStrokes[5]//Print (* outputs {2, 3, 2, 4, 3} *) ``` [Answer] # JavaScript (ES6), 155 bytes Full answer with all the irrelevant stuff. ``` f=(k,n=1)=>k?(g=d=>n%d--?g(d):d)(n++)?f(k,n):["2345545673"[n%10]-(g=d=>n/d%10%9<4)(10)-g(100)+11%~(q=-~n/10%5)*2+(q-4?4*!q:6)+(n/1e3+.1<<2),...f(k-1,n)]:[] ``` [Try it online!](https://tio.run/##LY3dCoMgGIavZYHwfZmWpY1J1oVEB5ElW2FrjR12683BTl54/3ge/affh9f9@WZ@teN5TgbmxBuBpp4bcMaa2hPLWOPAorYInlJspt8IdRvlhVRKqvJaRK0nIuvY/5Pa4MitkggiQ@aCZkiFIAdshh0@Da3COKewMdnI@LLpEimEfCwoF1WVY8I5DyAmAqrTbXcOq9/XZeTL6mACoRDPLw "JavaScript (Node.js) – Try It Online") ## Core task (96 bytes) Here is the interesting part for easier testing: a function taking an integer and returning the number of straight pen strokes in its Roman numeral representation. ``` n=>"2345545673"[n%10]-(g=d=>n/d%10%9<4)(10)-g(100)+11%~(q=-~n/10%5)*2+(q-4?4*!q:6)+(n/1e3+.1<<2) ``` [Try it online!](https://tio.run/##DYnRCoMgFEC/ZUFwb2JpauHI9iFjD5ElG3Fda@yxX3e@HDjnvKbfdMyf5/vLKfolrS6RG4tWaWO06XpV3KmU4sEhOO9Gany20g4aQQrkIVMgk7I8YXf8pCZfg1XLYOf6pqvLfu2QQe6LYrUchhbTHOmI21JvMcAKvZUWMf0B "JavaScript (Node.js) – Try It Online") ### Commented ``` n => // n = input "2345545673" // hard-coded number of straight strokes + 2 in I's [n % 10] - // and V's, which can be computed modulo 10 ( // g is a helper function processing L's and D's, g = d => // which follow the same logic: n / d % 10 // divide n by the argument and reduce modulo 10 % 9 // further reduce modulo 9 < 4 // is the result less than 4? )(10) - // first call to g with d = 10 g(100) + // 2nd call to g with d = 100 11 % // the number of X's can be computed modulo 50 ~( // we first evaluate the generic expression: q = // 11 mod floor(q + 1) -~n / 10 % 5 // with q = ((n + 1) / 10) mod 5 ) * 2 + // and double the result to get the number of strokes ( // we then apply two corrections: q - 4 ? // 4 * !q // +4 strokes if q = 0, i.e. n = 49 (mod 50) : // 6 // +6 strokes if q = 4, i.e. n = 39 (mod 50) ) + // ( // n / 1e3 + .1 // the number of M's is floor(n / 1000 + 1 / 10) << 2 // we multiply by 4 to get the number of strokes ) // ``` ]
[Question] [ Your challenge is to make a program(less number of bytes than what the below program takes) that should print the map of India with any special character of choice. [TIO Link](https://tio.run/##hVJhT8IwEP3Or7hBjBsTRWNMDEIydMtcFjbYEFTEbGXK4iiwdSpB/Ouz3ZQ4wNjkeu29Xu/1XVGFIJQkJR@jIB55cBGRkT89HDcKPiYwcXzMC4VlAehgAQfqcFw9AJd66lC6raUwGjthGSIS0ljRVhZcW4uhY0zBbmGeesHS58Csq0/FrhpBV5tDMU39PYr0eLlj4qO26co961Gzem3pWjOGraasm57aVFR7ZWNJvwma@o50Q5FeVMWIFdmeqZcWUaWuIj0jWfICFCA8DIfhYEDuXm/f@wv7w/o0MVjmZBcRy8CMO@NbpVaiVumpc66nRNC/Ilwxe/fb2A884B3gqCRCGsr0YlpROe5dUXyora//OV6pQAPOToU1sMwx8J@AF0Wqbx3Oq0IOWm5R/W4DwBYyiwnrC78/wPtCLQevcjsviLx/qjBKLuzBCSO1wWmrHrdZbmeRrTT4m2W2yubQI3GIgf68VZJ8AQ) ``` #include <stdio.h> int main() { int a = 10, b = 0, c = 10; char* str = "TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq " "TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBL" "OFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm " "SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; while (a != 0) { a = str[b++]; while (a-- > 64) { if (++c == 90) { c = 10; putchar('\n'); } else { if (b % 2 == 0) putchar('!'); else putchar(' '); } } } return 0; } ``` **The program outputs:** ``` !!!!!! !!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!! !!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!!!!!!!!! !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!! !!!!!! !!!! ``` [Answer] # [Charcoal](https://github.com/somebody1234/Charcoal), 135 134 133 132 126 bytes ``` F¹²⁶F…"§”kL↷DXry"R⁴¹¤'➙ω⎈v¬⌊π2κÿρ“q↷0h˜⁶!⌊P[±9NH|N≡H´“i¬›FE‹t⁵→Z£314➙yqt⟲“⌊⌊‖↷ÞIuA?↷|⁻c″!!<;‹YS00y/;↥L’D∧§⎈k≕X”ι⎇﹪L⊞Oυω⁷⁵§ *ι⸿ ``` [Try it online!](https://tio.run/##FY@9SgNxEMRfxUsj2Hh@NBLBxsJCxDJoFa6JRJCEKFz3v8LzLsoVCYpCjATzpQTFJBovrgQ2fe4d5gX2Ec4VtthlZn/DOIV82TnLn6apUJdjHsL70g2mm@EezGNxH/5kN1d2M0KqjdXSXkbzIQkRBRc8wE01MeuL6XyWeFwvqdku8L1CLFUOj/ljS@hNqC@/jQOErT0ewzRO9M9MNUaoAxNX4H3Crx3x88baprLdUgVPQ64r4X/MnVLnTaGXc6HWjh4Kg/fjwIwsazvL10Kx0Mi23dUs/I7QgGtCbQQ9rRAFRYS3Oa2yiBFdSfyqOqqKe08utYU30XTuLa2o/D1L0z8 "Charcoal – Try It Online") Port of [my C# answer](https://codegolf.stackexchange.com/a/135831/70347). Link to the [verbose version](https://tio.run/##PY9dT4MwGIXv/RVNQfu2FlI6mdEZwxKXhegEp84YmVuFCiQElg78@PWIXnhz8uTcPOekhTJpo6q@f28MAk@O6QFCf7xUda6BYMKnbVhn@guwhJxn3lasvY2r3NRVTPM3sZZJIq/IiT/l4mxkHXMeCJu4zpzZwLyNF1vu6NZ2OVgLBvwJiLdkh2LFLAlWGBBrHs7C2XUQBdHl3cX95PF8NX72X@SrHDRiO4gGFdNQHGFeUvq7D6HYlHULD9rUynzDosm6qoEbXedtAXG3L6KdNqptDHQcfVLK0ak/xP8RxDBH5dDgxGBKJ33fOx@9s69@AA). * 6 bytes saved thanks to Neil! [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), (110? 113?) 112 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) *Notes:* The 2 bytes, `a⁶` (near the end) may be dropped if `1` is acceptable for the ocean. If special character means digits are not acceptable and the ocean must be a space the byte count will be 113 (replace `Ḃa⁶s75Y` with `ị⁾ !s75Y`) which will use `!`. ``` “*ẊñDȯT¹^qɓ\j£œ%ñ2u{ṅʠỴ©ṾÇịṭxẏ¤Ḅʋ⁽~|}ṾṃƑ¡vṀGs®[Ȯkhɗṃ?ƇṿTṫ6HỌ¡ẏṣnD1ı¹ḍ1Ḣ4$ẸObẓ¢ƙṾⱮḃċỵ|)wY)ḌÇḤ~æṣt²5’ḃ70ĖŒṙḂa⁶s75Y ``` A full program printing the map. Uses `0` for the land. **[Try it online!](https://tio.run/##AdwAI/9qZWxsef//4oCcKuG6isOxRMivVMK5XnHJk1xqwqPFkyXDsTJ1e@G5hcqg4bu0wqnhub7Dh@G7i@G5rXjhuo/CpOG4hMqL4oG9fnx94bm@4bmDxpHCoXbhuYBHc8KuW8iua2jJl@G5gz/Gh@G5v1Thuas2SOG7jMKh4bqP4bmjbkQxxLHCueG4jTHhuKI0JOG6uE9i4bqTwqLGmeG5vuKxruG4g8SL4bu1fCl3WSnhuIzDh@G4pH7DpuG5o3TCsjXigJnhuIM3MMSWxZLhuZnhuIJh4oG2czc1Wf// "Jelly – Try It Online")** ### How? The first 99 bytes: ``` “*ẊñDȯT¹^qɓ\j£œ%ñ2u{ṅʠỴ©ṾÇịṭxẏ¤Ḅʋ⁽~|}ṾṃƑ¡vṀGs®[Ȯkhɗṃ?ƇṿTṫ6HỌ¡ẏṣnD1ı¹ḍ1Ḣ4$ẸObẓ¢ƙṾⱮḃċỵ|)wY)ḌÇḤ~æṣt²5’ ``` is a base 250 literal (a very large number). The rest of the code manipulates this number: ``` “ ... ’ḃ70ĖŒṙḂa⁶s75Y - Main link: no arguments “ ... ’ - the large number above ḃ70 - convert to bijective base 70 [16,6,69,10,66,...] Ė - enumerate [[1,16],[2,6],[3,69],[4,10],[5,66],...] Œṙ - run length decode [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,3,3,...(69 total)...,3,4,4,4,4,4,4,4,4,4,4,5,5,...(66 total)...,5,...] Ḃ - modulo 2 [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,1,...(69 total)...,1,0,0,0,0,0,0,0,0,0,0,1,1,...(66 total)...,1,...] ⁶ - literal space character a - logical and (vectorises) [' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',0,0,0,0,0,0,' ',' ',...(69 total)...,' ',0,0,0,0,0,0,0,0,0,0,' ',' ',...(66 total)...,' ',...] s75 - split into chunks of length 75 (representing the rows of "text") Y - join with newline characters (making a single list of ' ', 0, and '\n') - implicit print (a list containing any characters is smashed, so - the 0s print as `0` and none of the `[,]` are shown) ``` [Answer] # [Bubblegum](https://esolangs.org/wiki/Bubblegum), 132 bytes ``` 00000000: b595 b719 4421 18c3 7aa6 30fb 0f79 a93b ....D!..z.0..y.; 00000010: 4412 dfc3 25f6 2f32 a451 fda9 f49a 61c1 D...%./2.Q....a. 00000020: 4300 9163 84b7 7d60 6c3e 383b 2618 c852 C..c..}`l>8;&..R 00000030: e080 0290 9856 ed8b f503 1221 503b 106e .....V.....!P;.n 00000040: 1231 6335 9c70 3027 0245 6242 88a6 0410 .1c5.p0'.EbB.... 00000050: b097 c2dd ae27 c2c1 0346 8ca3 a05e 32fe .....'...F...^2. 00000060: c710 b993 a288 97cc 55f8 2eee 877d 5407 ........U....}T. 00000070: 91cb 6e2e 3ee4 1f5e 1f91 3f00 7423 002d ..n.>..^..?.t#.- 00000080: 6c98 70df l.p. ``` [Try it online!](https://tio.run/##hdA7b1RBDAXgnl9xIgSpYmzPm5WCBIEaEFBGzJNmiVKQAqT89sWX3K2xNKMpZj6PT3to7Th/PPw8nXiv12ihBLQkBd6rQHJ3SLVGOF4NvFJBLa4BZHVzQfSHmOg3HZ49CWKG96IYy15qWBG6nKL6IFijFixfKqJ0AW7MeEGvlD5tWqXd0M1wzCgSHbJvCWlERuxuwmXrrlEyeg4KvCPqRI/fj9f58JLo8244MyZnBmsxKIeIOXLDCuwgaqPZoUE4zqdZ6Nu//eLjge52w5sh6gTRuYDSE1sKmoz0AVG9ImdLhr2wGdID3fMlvW9vN2g3wpYpl4SuY6BO3U42OzsfkXt1qBxsKl3nf1za@mDrVs9GNKMna9JKsfuaM0rqHSGsDJ1zIqc0EDyn3bD6um2PX85GMqNIb4hTrd2cHrKssawicMvCTl4dLPyxGXd0bT8gekO/ntPVbmQzYi8ZicfCf@pI93Q6/QU "Bubblegum – Try It Online") [Answer] # [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 240 232 231 227 bytes ``` _=>{var r="";for(int i=0,j,k=0;i<126;i++)for(j=0;j++<@"2(g,d1`0]1_.a.c.a*e,b0]2\2D'45A,093#+,,@0$'.-G*$(*1_1P#.3N$.,(#M*(,W('1R*%0V*#2(#I@'#GIEIEK@O@O>Q<S;U:V6Y5[2^2]1_0`.a.a.c*e(h&"[i]-34;)r+=++k%75<1?'\n':" *"[i%2];return r;} ``` [Try it online!](https://tio.run/##bVDbTsJAFHznKzYt2G132bTlYmRbrFEkxCAoEWKgwloqLpc22S0khvDttS0JvjgP55zMnMkkE8hqEIswBRmCLZMSDEW8EmxXypljMXPIhCU8AIeYL0Gf8QjKRPBoNfUBEyupX/7@HDlGPzIJd@RxHwXO2YDPqw14tOQMuKV07raPByaAcBWFfsUC8igB3DXxGm9ck3LHspuUI6Tn2jpj1gg5nmLDFV5aC9O35oSRgDAjxJ@mb8/sB63euMPmTU1FGHtmWSPVrlGGhjW3hiqpPZcJhmrfgHgCNevVqJhjQ7Wh2vM0tdvr9DpP3sAbtF@cEX1rjZvvjan9YWcp5iLLyZKMEH5fKVPuV2t1qgvkIrSpXDcc61abRVpLAUYmVmyfijDZiwgIekpp6b9a7uNIxtuQTARPQlgUApViKbpOL45TcZ3SXw "C# (.NET Core) – Try It Online") Same approach as for [my C# answer for the Batman challenge](https://codegolf.stackexchange.com/a/126301/70347). * 4 bytes saved thanks to Neil! His Charcoal tip could also be applied here! :) [Answer] # [Python 2](https://docs.python.org/2/), ~~227 223 218~~ 216 bytes * Thanks @Mr. Xcoder for 2 bytes: `j%2>0` can be just `j%2` ``` for k in range(46):print''.join(ord(i)*' !'[j%2]for j,i in enumerate('''E B>;= ? A ?C @;:"   %=. , + 504' %'#'#) - - /13479<;=> ? ? ACF0'''))[75*k:][:75] ``` [Try it online!](https://tio.run/##Fc5dT8IwGIbhdLqm1KYtYuJHzJyS5V0REHFzcQioRP/EsgMSp3aEjjTzwF8/x/lz53p2f/VPZaZN81VZf@Nr49u1@S7C6FGlO6tNDTAuK23Cyn6GWg3Av4asDKb5fl8O9b4ozO@2sOu6CAFA4nf6JhZ8JuZsyV7ZkqzoC5/JVN64x70ryk@7qEOpxx2XHQXEwUTMxRix7tBhFKNbgmmMXTEhBzwiSGIEnosC6ENfeSNvdHl3cX/@cBadJL0n@SxbhS9ap5XICn8cTtoHSmVJPNikeZYmcd40/w "Python 2 – Try It Online") * [How I obtained the string!](https://tio.run/##zddBb4MgFADgs@9X4AmISdNlt2b8ks6D6boIMdSoSbNfb61xG2NU4amNHEylz89X@0Aov5r8ol/bNhOUUmK1uG8E08Btobx/loGFiuDow2Ir54WUVrfQ2qg1uybwNfbUmogXGUO@1E8YjEvTmBEIU5STi51/E0wwTm04twPAi7LE709Wv2deXjcBgsNc4wwICiOPLMedvB@ceQbIJ2WVqfkbcVR/nTWG8ImZZfs3LxLoPBjbAZbvPDGH8hvbntNGUF5hc@GzrNA5eobkb2HeHUtaBAt5Wpt4187Apq2trE1WWsttzUKuMketJdarAxa6H@p2alB3@7WdukjNsl1dFrJh9F1TzkGKPRSiPu5TqLoYuOayOBP5Vpw1q/kBIiVeIOp7mUwUH77I9Aepj11HKkRxUMk9SCZCdcfP36vvsEwhqhJxyiumOJSV1A2reNveAA "Python 3 – Try It Online") * Inspired from [this answer](https://codegolf.stackexchange.com/a/133267/59523) ## Explanation The idea is to store the information as the count of total characters in a cluster. For eg:`ssssss!!!!ssss` is encoded as `[6,4,4]`(and since we have to just alternate thru two characters, this becomes easy. ;) ) This info can be compiled as a string by ascii characters for each count (see the string literal). Now we simply obtain the count and draw `!` or a space alternately. [Answer] # [Retina](https://github.com/m-ender/retina), 289 bytes ``` 16:16;,7#/9#,7#/8-18<<"!%20;,9#,7#&,6#@34&/4#"!31;,3#;&!17!9;!%8'"14&5-7=!8&6"!%8'=%9=;&1-10=;2-3"1="!8:2''@!6@%6''8&%>'@8%6"1=&%7@!1=%1>;/3';/>:1>:1>&,>,>%15'¶16#",6#"%17#&,8#&,8#/9#!%20<<-22"!%22:23@45 @ && > 4' = '# < -20 ; "& : "¶ / &%1 - #¶ , !%1 ' ## & !! % !¶ # "" " !!!!!! \d+ $* ``` [Try it online!](https://tio.run/##HY5BTsQwDEX3/xTYIY4EiTpOO2mmaaochA0SLNiwQJxtDjAXKwmWbX0/b97P5@/X9/t5QtOmqfjVTDczdg6a953Jxkvx/0h8Mm1eZFoM06zFz6YI6Uq3QjY71kWuYa2UJfEA1d5qEQ16qSWGmbUy5S061yg1m5zLYg/Xsk39JXZtpNXqUabZlenYdLT4wx9Wr@5x12S4G7DVoZL/p7sOwX0PMQ7VuMW5LVc0iODA4lDhDHaEeEEBCzbw444JYhUBpmcP6tnBGAiIYEGdGjCD@z0Kbx@veH55Os8/ "Retina – Try It Online") [Answer] # JavaScript (ES6), ~~254~~ ~~253~~ 251 bytes ``` _=>`f5 f9 ge id ge hb hb jb j7 j9 id gf ffx4 diu9 cmg089 7td14b 6z07157 7zo 8z90b 9z71b 250z675 1zg54 5zb72 3zf70 550z2 640z0 dy cy dt dt dr dp do en fj fi gf hf he id jb jb jb l7 l5 m3`.replace(/./g,m=>" !"[i%2].repeat(parseInt(m,36)+1,i+=m<"z"),i=0) ``` --- ## Test it ``` o.innerText=( _=>`f5 f9 ge id ge hb hb jb j7 j9 id gf ffx4 diu9 cmg089 7td14b 6z07157 7zo 8z90b 9z71b 250z675 1zg54 5zb72 3zf70 550z2 640z0 dy cy dt dt dr dp do en fj fi gf hf he id jb jb jb l7 l5 m3`.replace(/./g,m=>" !"[i%2].repeat(parseInt(m,36)+1,i+=m<"z"),i=0) )() ``` ``` <pre id=o> ``` [Answer] ## JavaScript (ES7), 239 bytes Encodes the shape and the line breaks separately. ``` let f = _=>'h7hbigkfigjdjdldl9lbkfihhhz6fkwbeoi2ab9vf36d812937991qa1b2db193d472189731i7671d9451h927721486212f10e10fvfvftfrfqgphlhkihjhjgkfldldldn9n7o5'.replace(/1?./g,n=>' X'[i&1].repeat(parseInt(n,36)-1)+((++i|716000693/2**(i/2))&1?'':` `),i=-26) o.innerHTML = f() ``` ``` <pre id=o style="font-size:6px"></pre> ``` [Answer] # [C (gcc)](https://gcc.gnu.org/), ~~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!](https://tio.run/##JY7RToMwAEV/pcwsAWsjOmOMjZqiNB0ho6xFpk4MNHMaWRkMzJY5fx0hPpych/twrkJLpdo2O1F4lX5qM7X270Vl4vRmIOnOCL0GTIMCyIk2O1vCL0FP5BcwYhsQeWW/HU@5Pg155sbizRNxSMZekEwc1@cL5lAmD1IT/zF3/ICSL0aDhrpyze5FzUhEyVK5ZJGrXOmkSqr5vH7@ftrOdvJH/HINBF8BEeg@02ftjqMOFLPSiOkGzB5qY/CSQfiKrf/rCN1eXuB1U6uPtDIhVMMr@240Qtnw/PrMtix8aNs/ "C (gcc) – Try It Online") Minimally less golfed: ``` 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); } ``` [Answer] # [C (gcc)](https://gcc.gnu.org/), 205 bytes My solution quickly converged on something extremely close to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)'s [golfed version of OP's implementation](https://codegolf.stackexchange.com/a/195252/75886), 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 missing the leading spaces required for code text, but there *are* answers using that text as reference, so it's somewhat ambiguous. ``` i,j;main(c){for(;c="B8w<tAp@mAo>q>s>q:u<r@mBlBT7DEQ<@IC3;<<P@47>=W:48:AoA`3>C^4><83]:8<g87Ab:5@f:3B83YP73WYUYU[P_P_NaLcKeJfFiEkBnBmAo@p>q>q>s:u8x6b"[i++];)for(;c---50;j++)printf("\n%c"+(!j||j%75),33-i%2);} ``` [Try it online!](https://tio.run/##Jc4LasIwAADQs1goNMSALO0SkhiSOAfTMSooUtT5CVbSrR@rojB39lrwBO9ZdLC2aVw34/nWFYEFf2lZB9z2PUOv4qwrletSHuVJHtlF1Co3v2ZK3oYToT4GmAsRq5DI/pyFlOlSb7AcfIdSULxiVBwo0TsWqZRhQ3ESEzxPZslsEa/j9df20473o/TdDX9MYVpFVa3TSuxCb687b@EgXHHw7CCEoh7PIARV7YpzGnjLwrceDDrZ/Z75JAJdjJHzXwD/b5oH "C (gcc) – Try It Online") [Answer] # [Vyxal](https://github.com/Lyxal/Vyxal) `j`, 442 bytes ``` »⌐ṫżṫṗƛ&%≠ɽ_~ẇ*⁼3L ≈;n~U7⋏₇ḭǔ°₁>Aµ1I(□]:ȯ≤KWƒʁY•₇⟩-RCa⟨&8ẋżṫẏL_ġN⇧ṗḞΠṄẇ%¨ḃ₆Q<Zǒ,]„∨TC⁋⟩`ɾOn^≬ݾ¨Ṫlṅ^£†i-ẏ₂↓∷×ṘǍ¶G?∑x∪ż∪İɖ¹p*₴Ḣ≈J₀↳₁‡x⌈↳D4xJḢmḃẇDpeH&⋏¹!≥₇∑;↑≬m†¥⁋†₇,Ż∪ß^ċ¡}GBİ£:U~ʁ⌈∴Ṡ^ṗ⁺Ȯo↓Ṅ%Ẏṗ§∴ḭ₈Ṁ‛∑ø≈dOƒ¥¤ɖ4Ẏ{⅛I∞_uė∇ṫḭB?U≤ǔ9F⟑q₴ẆŀṠz∞₁XṖ¨‛₇VB₁τḟAsżǒxP∵9)&∵β"Ż∆ ↲,₴øxJT.t꘍/₴ǎpe↔ḟqȯ(^≥Vḭ⁰Ȯɽτ∆ṙ°÷lW≠⇧Cb≠²∩]±ḭy∧D℅øJǔ₅⅛EGḭ≥ẋZ≥×8nΠḋ⟩)Ṗv‹'⇧@jq≥ḟ⁽]¾fǎ⅛Ȯ⌊bDa^ṀP;}ṫ⁼τ1„√ɽh⇩GW€⁼[6¼U~j_IṘ†gJ↔Ȧ$°§_„)Ż"₅‡xußġ₃ǔ↔×ɖɖ[æ¥s‹⁰≈c†t‹ṪṙḊ꘍bεβ¶∩∩{ǒḢġ†₅⟨L⌐∨H»`! `τ75ẇ ``` [Try it Online!](http://lyxal.pythonanywhere.com?flags=j&code=%C2%BB%E2%8C%90%E1%B9%AB%C5%BC%E1%B9%AB%E1%B9%97%C6%9B%26%25%E2%89%A0%C9%BD_%7E%E1%BA%87*%E2%81%BC3L%20%E2%89%88%3Bn%7EU7%E2%8B%8F%E2%82%87%E1%B8%AD%C7%94%C2%B0%E2%82%81%3EA%C2%B51I%28%E2%96%A1%5D%3A%C8%AF%E2%89%A4KW%C6%92%CA%81Y%E2%80%A2%E2%82%87%E2%9F%A9-RCa%E2%9F%A8%268%E1%BA%8B%C5%BC%E1%B9%AB%E1%BA%8FL_%C4%A1N%E2%87%A7%E1%B9%97%E1%B8%9E%CE%A0%E1%B9%84%E1%BA%87%25%C2%A8%E1%B8%83%E2%82%86Q%3CZ%C7%92%2C%5D%E2%80%9E%E2%88%A8TC%E2%81%8B%E2%9F%A9%60%C9%BEOn%5E%E2%89%AC%C4%B0%C2%BE%C2%A8%E1%B9%AAl%E1%B9%85%5E%C2%A3%E2%80%A0i-%E1%BA%8F%E2%82%82%E2%86%93%E2%88%B7%C3%97%E1%B9%98%C7%8D%C2%B6G%3F%E2%88%91x%E2%88%AA%C5%BC%E2%88%AA%C4%B0%C9%96%C2%B9p*%E2%82%B4%E1%B8%A2%E2%89%88J%E2%82%80%E2%86%B3%E2%82%81%E2%80%A1x%E2%8C%88%E2%86%B3D4xJ%E1%B8%A2m%E1%B8%83%E1%BA%87DpeH%26%E2%8B%8F%C2%B9!%E2%89%A5%E2%82%87%E2%88%91%3B%E2%86%91%E2%89%ACm%E2%80%A0%C2%A5%E2%81%8B%E2%80%A0%E2%82%87%2C%C5%BB%E2%88%AA%C3%9F%5E%C4%8B%C2%A1%7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%C2%A7_%E2%80%9E%29%C5%BB%22%E2%82%85%E2%80%A1xu%C3%9F%C4%A1%E2%82%83%C7%94%E2%86%94%C3%97%C9%96%C9%96%5B%C3%A6%C2%A5s%E2%80%B9%E2%81%B0%E2%89%88c%E2%80%A0t%E2%80%B9%E1%B9%AA%E1%B9%99%E1%B8%8A%EA%98%8Db%CE%B5%CE%B2%C2%B6%E2%88%A9%E2%88%A9%7B%C7%92%E1%B8%A2%C4%A1%E2%80%A0%E2%82%85%E2%9F%A8L%E2%8C%90%E2%88%A8H%C2%BB%60!%20%60%CF%8475%E1%BA%87&inputs=&header=&footer=) Plain old binary, AKA I'm losing to everyone. ]
[Question] [ This challenge is to produce the shortest code for the constant \$\pi^{1/\pi}\$. Your code must output the first \$n\$ consecutive digits of \$\pi^{1/\pi}\$, where \$n\$ is given in the input. **Alternatively**, your program may accept no input, and output digits indefinitely This is code golf, so the shortest submission (in bytes) wins except that it must output the 1000 digits for \$n = 1000\$ in less than 10 seconds on a reasonable PC. You may not use a built-in for \$\pi\$, the gamma function or any trigonometic functions. If the input is \$n = 1000\$ then the output should be: ``` 1.439619495847590688336490804973755678698296474456640982233160641890243439489175847819775046598413042034429435933431518691836732951984722119433079301671110102682697604070399426193641233251599869541114696602206159806187886346672286578563675195251197506612632994951137598102148536309069039370150219658973192371016509932874597628176884399500240909395655677358944562363853007642537831293187261467105359527145042168086291313192180728142873804095866545892671050160887161247841159801201214341008864056957496443082304938474506943426362186681975818486755037531745030281824945517346721827951758462729435404003567168481147219101725582782513814164998627344159575816112484930170874421446660340640765307896240719748580796264678391758752657775416033924968325379821891397966642420127047241749775945321987325546370476643421107677192511404620404347945533236034496338423479342775816430095564073314320146986193356277171415551195734877053835347930464808548912190359710144741916773023586353716026553462614686341975282183643 ``` Note the 1000 decimal places includes the first \$1\$. **Output format** Your code can output in any format you wish. This [related question](https://codegolf.stackexchange.com/questions/47808/transmit-pi-precisely) tackles a simpler variant but with the same restrictions. **Notes** If it's helpful, you can assume \$\pi^{1/\pi}\$ is irrational and in fact you can even assume it is a [Normal number](https://en.wikipedia.org/wiki/Normal_number). [Answer] # Python, 149 bytes *Saved one byte due to [@H.PWiz](https://codegolf.stackexchange.com/questions/185842/output-first-n-digits-of-pi1-pi/186241?noredirect=1#comment446287_186241).* ``` k=n=int(input())+1 i=j=8*n e=l=p=z=10**n while i:p=2*z-i//2*p//~i;i-=2 q=z-z*z//p while j:l=q//j+q*l//z;j-=1 while k:e=z+e*l//k//p;k-=1 print(e//100) ``` [Try it online!](https://tio.run/##LY6xCsMwEEP3fEXHxMGcnS4lQZ9jyNnGPZeU0hv6624MWQTSk0DyPfZnubeWUMDlGLnI@xinafYDI@JhyhCQIVB4Z0732TmHG6@CxahlosUI0Y83tliGCrVqlEiuYlwzKlGcq8lEukULf6G0Bugcep7OwZY6kld/EYi8c1Nrp7o/ "Python 3 – Try It Online") Input *n = 1000* finishes in less than 0.5s. \$\sqrt[\pi]{\pi}\$ is calculated as the \$e^\frac{\ln(\pi)}{\pi}\$.\$\pi\$ is calculated with the usual Euler-Leibniz: \$\pi=\sum\_{n=0}\limits^{\infty}{\frac{n!}{(2n+1)!!}}\$. \$e^x\$ and \$\ln(x)\$ are both computed using a Taylor series: \$e^x=\sum\limits\_{n=0}^{\infty}{\frac{x^n}{n!}}\$ and \$\ln(1-x)=-\sum\limits\_{n=1}^{\infty}{\frac{x^n}{n}}\$. Because the iteration for \$\ln(x)\$ converges only when \$|x|<1\$, this is instead calculated as \$\ln(\pi)=-\ln(\frac{1}{\pi})\$. Given that Python uses [Karasuba Multiplication](https://en.wikipedia.org/wiki/Karatsuba_algorithm#Algorithm), the overall runtime complexity is \$\mathcal{O}(n^{1+\log\_2(3)})\$ - in other words, twice as many digits will take approximately 6 times as long. --- ### Subquadratic Complexity ``` import sys from gmpy2 import isqrt, mpz def piks(a, b): if a == b: if a == 0: return (1, 1, 1123) p = a*(a*(32*a-48)+22)-3 q = a*a*a*24893568 t = 21460*a+1123 return (p, -q, p*t) m = (a+b) >> 1 p1, q1, t1 = piks(a, m) p2, q2, t2 = piks(m+1, b) return (p1*p2, q1*q2, q2*t1 + p1*t2) n = int(sys.argv[1])-1 m = n*20//3 z = mpz(10)**n # n / log(777924, 10) pi_terms = mpz(n*0.16975227728583067) pp, pq, pt = piks(0, pi_terms) pq *= 3528 pi2m = (pq << m) // pt a, b = 2 << m, 8 while a != b: a, b = (a + b) >> 1, isqrt(a*b) mlog2_pi = (z << m) // a a, b = 2*pi2m, 8 while a != b: a, b = (a + b) >> 1, isqrt(a*b) logpi_pi = z * pi2m // a - mlog2_pi mlog2 = mlog2_pi * pq // pt d = e = (15044673 << m) // 10450451 pt //= z while d: a, b = 2*e, 8 while a != b: a, b = (a + b) >> 1, isqrt(a*b) lnx = (pq * e) // (pt * a) - mlog2 d = e * (lnx - logpi_pi) // z e -= d print(e * z >> m) ``` [Try it online!](https://tio.run/##nVLbjpswFHz3V0zVF@zAYhsIpNrsj1TViigkixqIIe4l/Hx6jgNK1JdK5SLhc8Yzc8a4q/8499nt1nbuPHpcrhdxGM8djp27WszV9jKMPkbnJiH2zQGu/X6J6hg7@UUA7QE1tlvsePFY6vsSGBv/Y@wRmRj8GJvJ0HHYolYRPZlVdZJXcmWtTLLQHEKTb5tXm6xYV6HsqWxNvtaqXjGTeBZwMZIhhlOeBTqCRvVqJ/H2BkMFR@oDvd5QZxmhY6iz1KHX26XTrQyPJ57IjQowo4aAVkSzIk7lrRSip41t7yPK76Uejz@/mm8yMYI99MrqNM3ERN@UYGS0VKoX4jN6pDidj1FZlhubUzRaCte@@2bsLjO4V/rFrDdlYW1Z2qqoMr0uSc/RrI5n9YtjTYt5L7EMUFtkha0I2toQBdVeX2lepCltE4LPj9MM1RiV@PXRnho6u0/zUc6AqKY55xTj@69AZ0bZiI7M23fXMmh6kNcPbsXi/8NNzDRNoJ6gEGZgaiRYVGd9DmrxQcBhGW9PjYYlTKHzfF1mD4NG51QrjKD00pQUZnv7J2dWNewb@Nv5v70Dp/73nLhCEyQjklKo5eKfQHeDChGjEywTB/hE/QbJFns6v5F/LEZOrNXJ2@1mNV1/AA "Python 3 – Try It Online") Input *n = 20000* finishes in less than one second. \$\pi\$ can be computed in subquadratic time by use of Karatsuba splitting a.k.a. [Fast E-function Evaluation](https://en.wikipedia.org/wiki/FEE_method), which reduces a summation to *n* terms to a single rational value *p/q*, splitting in binary descent. I've chosen to use [Ramanujan #39](https://books.google.com/books?id=oSioAM4wORMC&pg=PA38&hl=en&redir_esc=y#v=onepage&q&f=false), which is the fastest converging series of its kind that doesn't require an arbitrary precision square root, to my knowledge. Explicitly, this is computed as: \$\large{\left.{3528}\middle/{\sum\limits\_{n=0}^{\infty}\frac{(-1)^n (4n)! (1123+21460n)}{(n!)^4 14112^{2n}}}\right.}\$ For \$\ln(x)\$ and \$e^x\$, using the same technique wouldn't provide any benefit, because both are computed as a power series of an arbitrary precision variable. Fortunately, Gauss has gifted us with an elegant quadratically converging formula for \$\ln(x)\$, based on the [Arithmetic-Geometric Mean](https://en.wikipedia.org/wiki/Arithmetic%E2%80%93geometric_mean): \$\DeclareMathOperator{\AGM}{AGM}\large\ln(x)=\lim\limits\_{n\rightarrow\infty}\frac{\pi x^n}{2n\AGM(x^n,4)}\$ or, in cases when large powers of *x* are inconvenient, this can also be computed as: \$\large\ln(x)\approx\frac{\pi x 2^m}{2\AGM(x 2^m,4)}-m\log(2)\$ Conveniently, division by \$\pi\$ can be acheived simply by not multiplying through by \$\pi\$. With the natural logarithm thusly defined, \$e^\frac{\ln(\pi)}{\pi}\$ can be computed via Newton's method on \$x\_{n+1}=x\_n-x\_n(\ln(x\_n)-\frac{\ln(\pi)}{\pi})\$. The overall complexity is then \$\mathcal{O}(n^\*\log^3(n))\$, where \$n^\*\$ will vary with the complexity of the multiplication algorithm GMP is using for any given bit length. [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 62 bytes In my first try I used Zeta function but this one uses the imaginary part of ln(-1) for pi. (@someone) Prints more than 4000 digits in the first 10 seconds, ``` q=Im@Log@-1;Do[Print@RealDigits[N[q^(1/q),2k]][[1,k]],{k,∞}] ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78/7/Q1jPXwSc/3UHX0NolPzqgKDOvxCEoNTHHJTM9s6Q42i@6ME7DUL9QU8coOzY2OtpQB0jpVGfrPOqYVxv7//9/AA "Wolfram Language (Mathematica) – Try It Online") *9 bytes saved from @someone* [Answer] # AXIOM, 221 bytes ``` m(k)==(v:=8.*k;(4/(v+1)-2/(v+4)-1/(v+5)-1/(v+6))*16^-k) p(n:PI):String==(d:=digits(n+9);e:=10.^-digits();i:=s:=0;repeat(k:=m(i);k<e=>break;s:=s+k;i:=i+1);r:=concat split((s^(1/s))::String,char " ");digits(d);r.(1..(n+1))) ``` test and ungolf: ``` (3) -> p 1000 (3) "1.43961949584759068833649080497375567869829647445664098223316064189024343948 91758478197750465984130420344294359334315186918367329519847221194330793016711 10102682697604070399426193641233251599869541114696602206159806187886346672286 57856367519525119750661263299495113759810214853630906903937015021965897319237 10165099328745976281768843995002409093956556773589445623638530076425378312931 87261467105359527145042168086291313192180728142873804095866545892671050160887 16124784115980120121434100886405695749644308230493847450694342636218668197581 84867550375317450302818249455173467218279517584627294354040035671684811472191 01725582782513814164998627344159575816112484930170874421446660340640765307896 24071974858079626467839175875265777541603392496832537982189139796664242012704 72417497759453219873255463704766434211076771925114046204043479455332360344963 38423479342775816430095564073314320146986193356277171415551195734877053835347 93046480854891219035971014474191677302358635371602655346261468634197528218364 3" Type: String Time: 0.03 (IN) + 0.53 (EV) + 0.25 (OT) + 0.15 (GC) = 0.97 sec -- Bailey-Borwein-Plouffe formula for pi -- https://en.m.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%93Plouffe_formula -- +oo -- ----- -- -- -- \ 1 | 4 2 1 1 | -- pi= | -------| ------- - ------- - ------- - ------- | -- / k | 8*k+1 8*k+4 8*k+5 8*k+6 | -- ----- k 16 -- -- -- 0 m(k)==(v:=8.*k;(4/(v+1)-2/(v+4)-1/(v+5)-1/(v+6))*16^-k) p(n:PI):String== d:=digits(n+9); e:=10.^-digits(); i:=s:=0 repeat k:=m(i) k<e=>break s:=s+k;i:=i+1 r:=concat split((s^(1/s))::String,char " ") digits(d) r.(1..(n+1)) ``` the function m calculate the term of the sum; the p() function loop, sum them in the variable s until the term is < than min float value (one can see as epsilon); p() function return one string of that number pi^(1/pi); it seems the required digits are returned in less than 1 second for input to p() function 1000. [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~23~~ 22 bytes ``` (p=Log@-1/I)^p^-1~N~#& ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78n6ZgqxDzX6PA1ic/3UHXUN9TM64gTtewzq9OWe1/QFFmXkl0SH5wCZCRHp0WbWhgEBsb@x8A "Wolfram Language (Mathematica) – Try It Online") -1 byte by @someone — the use and reuse of `p` beats the pure function Taking a lot of inspiration from @J42161217 and displaying n digits instead of an infinite stream. Note that I'm using `ToString` in Tio to suppress the trailing precision specifier in the output, which does not appear when this code is executed in Mathematica. Maybe using `180°` for pi would work; but maybe that's too close to being trigonometric and is disallowed. [Answer] # APL(NARS), 304 chars ``` r←a P w;⎕ct;s;y;k;b ⎕ct←0⋄s←''⋄→B×⍳∼w<0⋄s←'¯'⋄w←-w B: y←⌊w×10x*a⋄b←'' C: b,←10∣y⋄→C×⍳0<y←⌊y÷10⋄k←≢r←⎕D[1+⌽b]⋄→D×⍳∼a=0⋄r←s,r⋄→0 D: →F×⍳∼0≥y←k-a⋄r←s,'0.',('0'⍴⍨-y),r⋄→0 F: r←s,(y↑r),'.',y↓r Q w;r;i;d;e;k;⎕FPC ⎕FPC←4×w⋄r←i←0v⋄e←÷10v*w k←1+8×i⋄d←(+/4 2 1 1÷k,-k+3..5)×÷16*i⋄r+←d⋄i+←1⋄→2×⍳e<∣d⋄⎕←(w-1)P r*÷r ``` 19+33+18+56+39+20+5 +18+24+70+2=304 Now it is possible using big float for Nars...For the use of 4×w above, it seems ``` Ndigits=number of significative digits Number=the number in memory seen as one integer(with all fractional part too in it) Ndigits_base_10(Number)=1+⌊log_10(Number) log_10(Number) Ndigits_base_10(Number) Ndigits_base_2(Number)=1+⌊log_2(Number)=1+⌊------------------=1+⌊----------------------- log_10(2) 0.301029995663 1/0.301029995663=3.32192809 Ndigits_base_2(Number)=1+⌊Ndigits_base_10(Number) x 3.32192809 ``` Because in general Ndigits are not only the ones in the left of point, but the ones in the right of point too, i prefer not use 3.4 or 3.5 but 4. Before there was some problem of rounding for the last digits sometime because no round metod has to be used for print each sequence number,even the last; so I wrote one work around the function P for print float, I don't know if it is ok, i thought of that function for to be ok for all numbers from int to float, to big float to rationals ``` Q¨1..10 1 1.4 1.43 1.439 1.4396 1.43961 1.439619 1.4396194 1.43961949 1.439619495 Q 90 1.43961949584759068833649080497375567869829647445664098223316064189024343948917584781977504 Q 91 1.439619495847590688336490804973755678698296474456640982233160641890243439489175847819775046 ``` Q it seems here print the number even without "⎕←" ]
[Question] [ # Challenge You must output the Chinese character for [biáng](http://en.m.wikipedia.org/wiki/Biangbiang_noodles). Your program must not access any external sources and must exactly reproduce [this SVG](http://commons.wikimedia.org/wiki/File%3ABi%C3%A1ng.svg) in every way. Note that the image below is just a gif version of the image. The output should be an SVG file. Your program must be a program, therefore you cannot hardcode the SVG. ![](https://i.stack.imgur.com/ZL8uk.gif) The shortest code wins. --- Just in case Wikipedia goes down or changes the file, [here's](http://pastebin.com/UzeSqkJk) the SVG file you are required to output. ``` <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" id="svg2" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="500px" height="500px" viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve"> <g> <path d="M408.997,122.382l3.629-2.032l-10.012-6.497l-10.009-6.497l-2.195,7.083c-2.958,9.552-8.487,20.773-14.003,28.416 c-4.355,6.038-13.775,14.106-16.467,14.106c-1.68,0-1.755-0.338,1.861,8.345c1.729,4.151,3.555,8.729,4.06,10.174l0.918,2.628 l3.079-2.823c1.695-1.553,2.253-3.035,8.304-4.512c6.57-2.126,17.534-4.232,19.088-3.667c0.664,0.242-2.23,5.356-6.649,11.744 c-7.984,11.543-16.75,20.515-23.942,24.513l-4.021,2.23l2.822,5.478c1.553,3.012,3.536,6.505,4.409,7.765 c1.581,2.29,1.583,2.29,5.064,0.121c4.438-2.765,10.479-4.206,26.281-6.271c6.966-0.912,14.321-1.902,16.349-2.202 c3.173-0.472,3.769-0.204,4.293,1.928c0.602,3.25,0.421,6.658,1.686,9.72c1.433,2.916,2.298,2.712,6.408-1.512 c6.831-7.014,5.967-13.847-3.337-26.405c-8.965-12.096-10.583-13.513-14.101-12.321l-2.938,0.995l4.938,9.333 c2.719,5.134,4.939,9.727,4.939,10.207c-11.883,3.042-30.03,1.979-40.493-0.616c11.232-11.183,22.685-22.159,32.729-34.656 c4.926-6.111,10.282-11.712,11.905-12.445c1.625-0.731,2.952-1.666,2.952-2.075c0-1.163-13.91-14.435-15.127-14.435 c-0.598,0-1.084,0.441-1.084,0.98c0,0.54-1.685,5.007-3.74,9.931l-3.743,8.95h-15.509c-8.531,0-15.511-0.396-15.511-0.879 C371.832,155.722,405.104,124.561,408.997,122.382z"/> <path d="M258.98,130.742c0.053,0.014,1.647-0.792,3.545-1.79c7.975-3.285-2.358-2.285,55.517-2.333l52.069-0.518l-10.669-10.107 c-5.87-5.56-11.147-10.108-11.729-10.108s-5.587,2.333-11.124,5.184c-9.552,4.919-10.469,5.183-18.048,5.167l-7.983-0.018 l3.958-2.316c2.174-1.272,4.808-3.489,5.847-4.924c5.623-7.761-5.982-19.346-28.117-28.067c-8.884-3.5-9.777-3.59-13.149-1.33 l-2.516,1.685l8.925,8.95c4.908,4.921,10.896,11.744,13.305,15.16c2.41,3.415,5.583,7.258,7.053,8.539l2.671,2.327l-65.431,0.01 L258.98,130.742z"/> <path d="M186.128,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.062,57.187,0.062,57.187l3.226,4.437l3.226,4.436 l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.891-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818 c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.406,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899 c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059 c0-1.607,8.525-6.173,15.958-8.546c2.368-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304 c-2.329,4.018-5.628,8.578-7.331,10.139c-3.63,3.326-3.103,3.846-9.879-9.668l-4.288-8.553h21.934 c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.189,4.654l-15.856-0.304l-15.855-0.305v-15.445l21.001-0.299 l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.192-4.654l-4.025,5.506h-23.713l0.156-16.187 c0,0,9.811-0.366,21.283-0.366h20.856l-2.92-4.137c-1.606-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.208-3.035-2.771-3.035 c-3.22,1.875-5.566,5.064-8.179,7.793l-23.601,0.083l-0.079-16.15l23.023-0.296l23.022-0.297l-5.762-8.254 c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.691,5.271l-27.793-0.132l-6.333-4.694l-6.333-4.694v78.42 h-6.791h-6.792l3.884,4.332C183.125,316.086,184.001,316.543,186.128,315.664z M204.417,314.583c0,0,8.866,27.05,12.347,32.667 c1.747,2.82,3.275,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C204.395,356.627,204.417,314.583,204.417,314.583z"/> <path d="M261.965,181.771c1.221,9.539,1.402,12.767,1.438,25.451c0.021,7.555,0.445,13.736,0.945,13.736l17.965-4.775l46.482-0.927 l0.329,2.951c0.243,2.176,0.775,2.827,2.026,2.48c17.15-4.759,18.48-5.351,17.973-8.02c-0.273-1.428-0.788-4.786-1.147-7.462 l-0.65-4.867l5.256-3.307c4.265-2.687,4.999-3.544,3.904-4.574c-5.08-4.773-18.053-15.041-19.002-15.041 c-0.636,0-3.405,1.167-6.154,2.591c-4.897,2.54-5.468,2.592-28.083,2.591c-21.454,0-30.73-0.863-40.001-3.72 C261.818,178.44,261.602,178.93,261.965,181.771z M282.587,194.416l46.771-0.173l-0.059,10.129h-46.714L282.587,194.416 L282.587,194.416z"/> <path d="M132.747,117.241c5.765,0,14.563-3.956,18.616-8.368c5.548-6.042,7.219-12.919,7.151-29.423l-0.058-14.067l290.407,0.713 c-5.424,10.956-12.065,21.715-19.278,31.285c-0.598,0-2.317-0.685-3.823-1.522c-6.836-3.802-53.454-19.196-54.545-18.01 c-0.255,0.278-0.558,1.815-0.671,3.417c-0.188,2.659,0.501,3.226,8.055,6.619c28.843,12.951,58.013,34.96,66.693,50.322 c1.543,2.73,3.762,6.105,4.927,7.498c2.953,3.523,6.4,2.758,10.109-2.247c3.724-5.028,4.797-13.614,2.451-19.628 c-2.584-6.627-9.453-13.933-16.926-18.004l-6.975-3.799l8.284-8.739c15.736-16.604,30.355-25.762,47.054-29.475l5.333-1.186 L466.338,26.51l-19.287,25.631l-131.934-0.837c0-0.46,0.95-1.485,2.108-2.273c1.162-0.79,3.008-3.638,4.102-6.331 c2.848-7.014,1.793-11.743-3.981-17.855c-5.167-5.468-21.688-14.674-36.105-20.121c-8.871-3.351-9.092-3.378-10.965-1.339 c-1.873,2.04-1.717,2.346,7.752,15.212c9.431,12.81,16.824,26.532,16.824,31.215v2.329l-136.913-1.104 c-0.07-0.606-0.209-1.476-0.309-1.931c-0.747-6.734-1.197-13.502-1.782-20.254l-8.098,0.669l-2.87,12.137 c-4.672,19.751-12.426,37.031-21.287,47.445c-8.19,9.624-11.13,19.299-7.177,23.606 C118.529,115.012,126.565,117.241,132.747,117.241z"/> <path d="M497.863,453.926c0,0-6.328,1.162-11.621,1.771c-53.488,6.135-95.518,8.235-164.648,8.235 c-92.593,0-150.715-4.537-186.435-14.549c-21.072-5.908-37.036-18.377-43.876-34.272l-2.732-6.346l-0.556-207.73l8.155-6.395 c4.486-3.517,8.03-6.792,7.876-7.278c-0.553-1.763-29.472-28.583-30.439-28.232c-0.547,0.199-4.038,5.058-7.757,10.798 l-6.765,10.436l-28.088,0.552l-28.089,0.551l9.016,9.771l9.016,9.771l8.486-2.245c12.449-3.293,19.834-4.607,25.896-4.607h5.386 v208.28L0,454.15l27.968,27.782c0.589-0.797,6.647-11.381,13.463-23.516c6.816-12.139,14.04-24.721,16.056-27.961 c4.235-6.812,10.905-13.735,12.644-13.133c0.658,0.229,6.095,8.291,12.084,17.92c12.337,19.834,13.402,21.227,20.836,27.254 c22.951,18.607,65.076,28.838,128.873,31.293c74.453,2.68,148.922,4.115,223.418,3.92l1.873-5.76 c3.664-11.26,17.123-22.103,33.396-26.896l6.779-2v-4.248C497.389,456.469,497.863,453.926,497.863,453.926z"/> <path d="M67.377,99.175c3.615,13.117,7.038,20.628,10.361,22.734c4.389,2.782,9.84,0.074,15.801-7.847 c6.25-8.306,9.067-16.414,9.077-26.118c0.018-20.292-12.427-36.144-44.859-57.137c-7.896-5.112-24.133-14.715-24.878-14.715 c-1.627,1.909-3.001,4.063-4.373,6.208l5.627,7.655C50.934,52.805,59.531,70.706,67.377,99.175z"/> <path d="M173.771,362.742l0.52-190.884l3.063-2.758l3.062-2.759l-7.109-7.678l-7.108-7.678l-3.356,3.542 c-3.192,3.369-3.737,3.542-11.244,3.542c-6.402,0-9.319-0.623-15.48-3.311c-4.175-1.82-8.006-3.31-8.513-3.31 c-0.549,0-0.621,11.039-0.176,27.31c0.955,34.97,0.958,91.285,0.006,111.164c-1.267,26.447-4.287,49.291-9.586,72.48 c-3.079,13.479-3.482,16.498-2.39,17.932c0.721,0.947,1.631,1.721,2.021,1.721c1.117,0,8.793-15.195,12.104-23.961 c5.931-15.701,10.866-37.443,12.781-56.309l0.701-6.898h17.026l-1.326,55.17c-1.423,3.031-2.515,3.168-13.619,1.717 c-6.279-0.819-6.333-0.807-6.333,1.927c0,1.928,2.073,5.016,6.923,10.313c4.599,5.021,7.539,9.328,8.759,12.826 c1.563,4.484,2.151,5.162,3.969,4.582c5.182-1.656,9.604-6.027,12.419-12.273L173.771,362.742z M160.092,286.059h-17.225v-55.169 h17.225V286.059z M160.092,222.062h-17.225V169.1h17.225V222.062z"/> <path d="M293.07,161.867l-28.633,0.519l9.645,13.688l4.053-1.601c9.032-3.139-3.802-2.639,40.807-2.178l36.75-0.577l-9.136-9.302 l-9.138-9.302l-15.717,8.237L293.07,161.867z"/> <path d="M222.14,68.533l-13.546,14.79c-10.902,11.906-16.242,16.731-27.367,24.737c-13.609,9.792-34.075,21.463-47.984,27.362 c-8.677,3.68-8.933,3.929-7.692,7.482l0.995,2.851l11.961-3.866c26.478-8.556,46.305-17.892,73.013-34.374 c22.589-13.94,23.673-14.466,32.708-15.858l8.12-1.25l-15.104-10.938L222.14,68.533z"/> <path d="M346.897,139.838c-4.937-4.418-9.556-8.035-10.266-8.035c-0.711,0-4.132,1.274-7.604,2.83 c-6.304,2.824-6.376,2.832-36.464,3.368l-30.149,0.54l9.534,13.669L280.5,149c20.153-0.787,75.367-1.13,75.367-1.13 L346.897,139.838z"/> <path d="M191.97,200.99l-7.131,5.135l3.792,7.141c2.085,3.927,4.154,7.11,4.598,7.071s2.631-0.968,4.859-2.064 c4.674-2.301,15.125-4.473,32.423-6.736c6.687-0.875,12.5-1.596,12.919-1.602c0.418-0.005,0.76,1.944,0.76,4.333 s0.445,5.615,0.988,7.172c1.354,3.878,2.733,3.569,7.275-1.629c3.089-3.538,3.895-5.307,3.886-8.552 c-0.012-5.345-4.213-13.069-12.353-22.718c-6.06-7.182-6.586-7.55-9.729-6.798l-3.324,0.795l2.109,3.488 c2.306,3.813,8.108,15.761,8.108,16.697c0,0.321-9.46,0.571-21.024,0.557l-21.024-0.027l5.573-5.173 c9.319-8.649,25.171-25.794,30.967-33.491c3.499-4.647,7.001-8.021,9.703-9.348l4.227-2.077l-7.502-7.476 c-4.127-4.112-7.962-7.478-8.522-7.478c-0.56-0.001-2.04,2.853-3.289,6.343c-1.25,3.49-3.177,7.958-4.286,9.931l-2.016,3.586 h-15.214c-8.367,0-15.214-0.389-15.214-0.863c0-1.57,32.485-31.646,36.547-33.836c2.19-1.181,3.977-2.423,3.971-2.758 c-0.01-0.471-16.511-11.646-19.253-13.038c-0.314-0.159-1.139,2.018-1.831,4.838c-4.399,17.911-17.597,37.768-28.624,43.065 c-2.208,1.061-3.893,2.242-3.744,2.625c0.147,0.384,2.041,4.976,4.206,10.205l3.936,9.507l3.157-2.587 c1.735-1.424,1.981-2.978,7.862-4.304c5.551-2.023,17.526-4.417,19.151-3.827c1.393,0.506-8.597,15.994-15.084,23.384 C201.226,193.434,195.893,198.165,191.97,200.99z"/> <g> <path d="M212.273,453.381c3.344,0.342,48.484,0.586,100.309,0.541c104.205-0.092,103.413-0.051,118.041-5.967 c5.849-2.363,13.173-7.344,13.173-8.955c0-0.326-1.924-1.367-4.281-2.314c-6.762-2.721-13.946-8.301-16.041-12.454 c-1.045-2.07-2.46-6.722-3.145-10.333l-1.247-6.569h-7.71l-0.052,8.836c-0.064,11.17-0.775,16.463-2.543,18.949 c-0.769,1.08-3.727,3.758-7.037,3.852c-75.582,2.135-45.149,2.668-178.322,1.857l-3.958-2.023 c-7.031-3.596-8.162-5.832-8.495-16.811l-0.294-9.677l7.403-9.295c-0.404-0.127-7.347-2.629-15.428-5.555l-14.692-5.318 l-0.294,17.783c-0.404,24.496,0.977,30.943,7.974,37.199C199.686,450.748,204.608,452.6,212.273,453.381z"/> <path d="M154.256,404.033c-8.408,11.227-12.161,14.928-23.174,22.85c-9.769,7.023-12.531,9.717-12.531,12.219 c0,2.013,2.844,4.125,7.092,5.271c5.889,1.586,15.512,0.643,20.592-2.021c11.565-6.061,17.982-18.053,19.518-36.479l0.688-8.248 l-2.993-0.937C160.487,395.766,160.388,395.846,154.256,404.033z"/> <path d="M467.429,427.342c7.128,6.679,13.961,12.64,15.182,13.246c2.935,1.459,3.889,1.433,6.477-0.188 c4.783-2.996,7.222-17.277,3.925-22.98c-2.907-5.024-19.268-12.119-49.51-21.471l-6.883-2.13l-1.896,2.789l-1.896,2.789 l10.818,7.902C449.596,411.645,460.298,420.664,467.429,427.342z"/> <path d="M269.754,387.078c23.155,8.477,43.153,21.201,61.019,38.826c4.429,4.369,9.442,8.715,11.146,9.653 c5.188,2.869,9.702,1.068,12.854-5.127c3.214-6.315,1.988-12.452-3.85-19.299c-7.554-8.856-35.523-19.508-81.013-30.853 c-5.78-1.442-6.18-1.364-7.217,1.421C261.796,384.111,261.941,384.221,269.754,387.078z"/> </g> <g> <path d="M467.412,353.047c-2.155,3.582-4.95,3.83-15.26,1.361c-8.745-2.096-8.292-2.172-8.292,1.41 c0.002,2.524,0.918,3.666,4.922,6.123c7.375,4.526,13.388,10.608,15.398,15.578l1.795,4.434l3.04-1.924 c4.878-3.088,12.663-13.078,14.016-17.979c0.923-3.36,1.241-28.937,1.241-99.608c0-94.833,0.008-95.104,2.189-98.953 c1.205-2.123,2.022-4.032,1.813-4.239c-1.136-1.142-19.828-13.102-20.033-12.818c0.024,38.464,2.318,76.997,1.136,115.494 C469.258,344.197,469.128,350.195,467.412,353.047z"/> <path d="M460.258,187.415c-0.833-0.828-19.634-12.998-20.08-12.998c-0.276,0-0.206,1.396,0.158,3.104 c0.88,4.141,0.673,134.569,0.673,134.569l-1.222,13.625l4.368-2.914c2.401-1.604,6.139-4.033,8.304-5.404 c3.392-2.143,3.833-2.873,3.206-5.307c-2.539-38.09-0.279-76.467-1.546-114.606l3.234-4.867 C459.136,189.939,460.443,187.599,460.258,187.415z"/> </g> <g> <path d="M324.872,336.477c0.914,3.049,2.071,6.414,2.574,7.476c0.503,1.063,1.563,1.934,2.354,1.934 c1.909,0,6.542-8.731,7.288-13.739c0.53-3.578,0.188-4.396-3.511-8.222c-7.599-7.87-18.464-13.133-18.464-8.938 c0,0.475,1.821,4.258,4.047,8.406C321.389,327.535,323.957,333.424,324.872,336.477z"/> <path d="M305.599,322.059c-4.9-3.918-6.319-4.567-7.93-3.629c-1.078,0.629-1.729,1.725-1.446,2.437 c5.487,13.84,7.747,19.838,7.747,20.557c0,0.486,0.688,2.681,1.534,4.879c0.843,2.197,2.206,3.996,3.025,3.996 c2.134,0,6.729-8.422,7.35-13.467C316.503,331.787,314.914,329.504,305.599,322.059z"/> <path d="M267.803,322.389l-2.938,0.803c-1.614,0.443-2.983,0.89-3.041,0.99c-0.06,0.103-1.337,3.164-2.841,6.805 c-1.502,3.642-5.028,10.438-7.834,15.105c-2.808,4.664-4.946,9.367-4.754,10.451c0.192,1.086,1.484,2.6,2.874,3.363 c3.453,1.902,5.027,1.771,8.807-0.736c5.485-3.646,8.052-11.264,9.083-26.965L267.803,322.389z"/> <path d="M292.098,349.443c5.434-10.875,4.582-14.133-6.117-23.508c-6.394-5.601-7.758-6.367-9.508-5.349 c-1.121,0.654-1.82,1.772-1.552,2.483c0.871,2.291,7.397,20.984,9.218,26.396C286.454,356.352,288.646,356.346,292.098,349.443z" /> <path d="M358.401,313.439c0.123-1.76,1.138-4.265,2.258-5.562l2.036-2.36l-7.324-6.765l-7.323-6.762l-6.177,6.446h-29.793v-8.83 h37.606l-5.834-7.723c-3.209-4.248-6.22-7.723-6.688-7.723c-0.467,0-2.638,0.994-4.822,2.205 c-6.396,3.053-13.453,2.074-20.265,2.207v-9.93h37.669l-8.936-11.33l-3.434-4.158l-4.488,2.227 c-3.313,1.645-6.624,2.227-12.65,2.227h-8.161v-9.929h23.938h23.941l-10.257-8.925l-10.26-8.924l-5.087,3.407l-5.085,3.409 h-28.884h-28.885l-6.724-3.319c-3.697-1.827-6.853-3.181-7.01-3.009c-0.158,0.172,0.092,4.273,0.555,9.113 c1.08,11.3,1.058,51.577-0.039,67.229c-0.467,6.647-0.75,12.157-0.631,12.248c0.119,0.088,4.18-0.32,9.025-0.906l8.811-1.063 l0.31-3.459l0.31-3.457h32.93h32.93l-0.027,11.033c-0.035,14.659-2.152,22.293-7.934,28.588 c-5.641,6.143-10.338,7.366-28.119,7.342c-7.742-0.01-14.074,0.404-14.074,0.924c0,1.494,2.207,2.934,6.586,4.293 c7.826,2.428,15.965,9.639,17.98,15.93c0.399,1.252,9.794-1.801,15.963-5.188c8.899-4.885,15.709-11.869,19.164-19.662 c2.923-6.592,6.166-20.684,6.166-26.797C357.673,324.498,358.316,314.664,358.401,313.439z M275.777,251.361l0.33-3.128h21.277 v8.828l-10.402,0.314C275.643,257.719,275.139,257.449,275.777,251.361z M297.893,298.439h-22.291v-8.83h22.291V298.439z M297.386,278.023l-21.075-0.148c-0.968-2.947-0.68-6.131-0.709-9.23h22.408L297.386,278.023z"/> </g> <path d="M365.116,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.063,57.187,0.063,57.187l3.227,4.437l3.226,4.436 l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.892-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818 c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.405,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899 c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059 c0-1.607,8.525-6.173,15.959-8.546c2.367-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304 c-2.328,4.018-5.628,8.578-7.33,10.139c-3.631,3.326-3.104,3.846-9.88-9.668l-4.288-8.553h21.935 c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.188,4.654l-15.856-0.304l-15.854-0.305v-15.445l21.001-0.299 l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.191-4.654l-4.025,5.506h-23.713l0.156-16.187 c0,0,9.811-0.366,21.283-0.366h20.855l-2.92-4.137c-1.605-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.207-3.035-2.771-3.035 c-3.22,1.875-5.566,5.064-8.179,7.793l-23.602,0.083l-0.079-16.15l23.022-0.296l23.022-0.297l-5.762-8.254 c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.69,5.271l-27.793-0.132l-6.334-4.694l-6.332-4.694v78.42 h-6.791h-6.793l3.885,4.332C362.113,316.086,362.989,316.543,365.116,315.664z M383.404,314.583c0,0,8.866,27.05,12.348,32.667 c1.746,2.82,3.274,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C383.383,356.627,383.404,314.583,383.404,314.583z"/> </g> </svg> ``` [Answer] # perl 17055 ``` print '<?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version="1.1" id="svg2" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="500px" height="500px" viewBox="0 0 500 500" enable-background="new 0 0 500 500" xml:space="preserve"> <g> <path d="M408.997,122.382l3.629-2.032l-10.012-6.497l-10.009-6.497l-2.195,7.083c-2.958,9.552-8.487,20.773-14.003,28.416 c-4.355,6.038-13.775,14.106-16.467,14.106c-1.68,0-1.755-0.338,1.861,8.345c1.729,4.151,3.555,8.729,4.06,10.174l0.918,2.628 l3.079-2.823c1.695-1.553,2.253-3.035,8.304-4.512c6.57-2.126,17.534-4.232,19.088-3.667c0.664,0.242-2.23,5.356-6.649,11.744 c-7.984,11.543-16.75,20.515-23.942,24.513l-4.021,2.23l2.822,5.478c1.553,3.012,3.536,6.505,4.409,7.765 c1.581,2.29,1.583,2.29,5.064,0.121c4.438-2.765,10.479-4.206,26.281-6.271c6.966-0.912,14.321-1.902,16.349-2.202 c3.173-0.472,3.769-0.204,4.293,1.928c0.602,3.25,0.421,6.658,1.686,9.72c1.433,2.916,2.298,2.712,6.408-1.512 c6.831-7.014,5.967-13.847-3.337-26.405c-8.965-12.096-10.583-13.513-14.101-12.321l-2.938,0.995l4.938,9.333 c2.719,5.134,4.939,9.727,4.939,10.207c-11.883,3.042-30.03,1.979-40.493-0.616c11.232-11.183,22.685-22.159,32.729-34.656 c4.926-6.111,10.282-11.712,11.905-12.445c1.625-0.731,2.952-1.666,2.952-2.075c0-1.163-13.91-14.435-15.127-14.435 c-0.598,0-1.084,0.441-1.084,0.98c0,0.54-1.685,5.007-3.74,9.931l-3.743,8.95h-15.509c-8.531,0-15.511-0.396-15.511-0.879 C371.832,155.722,405.104,124.561,408.997,122.382z"/> <path d="M258.98,130.742c0.053,0.014,1.647-0.792,3.545-1.79c7.975-3.285-2.358-2.285,55.517-2.333l52.069-0.518l-10.669-10.107 c-5.87-5.56-11.147-10.108-11.729-10.108s-5.587,2.333-11.124,5.184c-9.552,4.919-10.469,5.183-18.048,5.167l-7.983-0.018 l3.958-2.316c2.174-1.272,4.808-3.489,5.847-4.924c5.623-7.761-5.982-19.346-28.117-28.067c-8.884-3.5-9.777-3.59-13.149-1.33 l-2.516,1.685l8.925,8.95c4.908,4.921,10.896,11.744,13.305,15.16c2.41,3.415,5.583,7.258,7.053,8.539l2.671,2.327l-65.431,0.01 L258.98,130.742z"/> <path d="M186.128,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.062,57.187,0.062,57.187l3.226,4.437l3.226,4.436 l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.891-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818 c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.406,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899 c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059 c0-1.607,8.525-6.173,15.958-8.546c2.368-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304 c-2.329,4.018-5.628,8.578-7.331,10.139c-3.63,3.326-3.103,3.846-9.879-9.668l-4.288-8.553h21.934 c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.189,4.654l-15.856-0.304l-15.855-0.305v-15.445l21.001-0.299 l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.192-4.654l-4.025,5.506h-23.713l0.156-16.187 c0,0,9.811-0.366,21.283-0.366h20.856l-2.92-4.137c-1.606-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.208-3.035-2.771-3.035 c-3.22,1.875-5.566,5.064-8.179,7.793l-23.601,0.083l-0.079-16.15l23.023-0.296l23.022-0.297l-5.762-8.254 c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.691,5.271l-27.793-0.132l-6.333-4.694l-6.333-4.694v78.42 h-6.791h-6.792l3.884,4.332C183.125,316.086,184.001,316.543,186.128,315.664z M204.417,314.583c0,0,8.866,27.05,12.347,32.667 c1.747,2.82,3.275,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C204.395,356.627,204.417,314.583,204.417,314.583z"/> <path d="M261.965,181.771c1.221,9.539,1.402,12.767,1.438,25.451c0.021,7.555,0.445,13.736,0.945,13.736l17.965-4.775l46.482-0.927 l0.329,2.951c0.243,2.176,0.775,2.827,2.026,2.48c17.15-4.759,18.48-5.351,17.973-8.02c-0.273-1.428-0.788-4.786-1.147-7.462 l-0.65-4.867l5.256-3.307c4.265-2.687,4.999-3.544,3.904-4.574c-5.08-4.773-18.053-15.041-19.002-15.041 c-0.636,0-3.405,1.167-6.154,2.591c-4.897,2.54-5.468,2.592-28.083,2.591c-21.454,0-30.73-0.863-40.001-3.72 C261.818,178.44,261.602,178.93,261.965,181.771z M282.587,194.416l46.771-0.173l-0.059,10.129h-46.714L282.587,194.416 L282.587,194.416z"/> <path d="M132.747,117.241c5.765,0,14.563-3.956,18.616-8.368c5.548-6.042,7.219-12.919,7.151-29.423l-0.058-14.067l290.407,0.713 c-5.424,10.956-12.065,21.715-19.278,31.285c-0.598,0-2.317-0.685-3.823-1.522c-6.836-3.802-53.454-19.196-54.545-18.01 c-0.255,0.278-0.558,1.815-0.671,3.417c-0.188,2.659,0.501,3.226,8.055,6.619c28.843,12.951,58.013,34.96,66.693,50.322 c1.543,2.73,3.762,6.105,4.927,7.498c2.953,3.523,6.4,2.758,10.109-2.247c3.724-5.028,4.797-13.614,2.451-19.628 c-2.584-6.627-9.453-13.933-16.926-18.004l-6.975-3.799l8.284-8.739c15.736-16.604,30.355-25.762,47.054-29.475l5.333-1.186 L466.338,26.51l-19.287,25.631l-131.934-0.837c0-0.46,0.95-1.485,2.108-2.273c1.162-0.79,3.008-3.638,4.102-6.331 c2.848-7.014,1.793-11.743-3.981-17.855c-5.167-5.468-21.688-14.674-36.105-20.121c-8.871-3.351-9.092-3.378-10.965-1.339 c-1.873,2.04-1.717,2.346,7.752,15.212c9.431,12.81,16.824,26.532,16.824,31.215v2.329l-136.913-1.104 c-0.07-0.606-0.209-1.476-0.309-1.931c-0.747-6.734-1.197-13.502-1.782-20.254l-8.098,0.669l-2.87,12.137 c-4.672,19.751-12.426,37.031-21.287,47.445c-8.19,9.624-11.13,19.299-7.177,23.606 C118.529,115.012,126.565,117.241,132.747,117.241z"/> <path d="M497.863,453.926c0,0-6.328,1.162-11.621,1.771c-53.488,6.135-95.518,8.235-164.648,8.235 c-92.593,0-150.715-4.537-186.435-14.549c-21.072-5.908-37.036-18.377-43.876-34.272l-2.732-6.346l-0.556-207.73l8.155-6.395 c4.486-3.517,8.03-6.792,7.876-7.278c-0.553-1.763-29.472-28.583-30.439-28.232c-0.547,0.199-4.038,5.058-7.757,10.798 l-6.765,10.436l-28.088,0.552l-28.089,0.551l9.016,9.771l9.016,9.771l8.486-2.245c12.449-3.293,19.834-4.607,25.896-4.607h5.386 v208.28L0,454.15l27.968,27.782c0.589-0.797,6.647-11.381,13.463-23.516c6.816-12.139,14.04-24.721,16.056-27.961 c4.235-6.812,10.905-13.735,12.644-13.133c0.658,0.229,6.095,8.291,12.084,17.92c12.337,19.834,13.402,21.227,20.836,27.254 c22.951,18.607,65.076,28.838,128.873,31.293c74.453,2.68,148.922,4.115,223.418,3.92l1.873-5.76 c3.664-11.26,17.123-22.103,33.396-26.896l6.779-2v-4.248C497.389,456.469,497.863,453.926,497.863,453.926z"/> <path d="M67.377,99.175c3.615,13.117,7.038,20.628,10.361,22.734c4.389,2.782,9.84,0.074,15.801-7.847 c6.25-8.306,9.067-16.414,9.077-26.118c0.018-20.292-12.427-36.144-44.859-57.137c-7.896-5.112-24.133-14.715-24.878-14.715 c-1.627,1.909-3.001,4.063-4.373,6.208l5.627,7.655C50.934,52.805,59.531,70.706,67.377,99.175z"/> <path d="M173.771,362.742l0.52-190.884l3.063-2.758l3.062-2.759l-7.109-7.678l-7.108-7.678l-3.356,3.542 c-3.192,3.369-3.737,3.542-11.244,3.542c-6.402,0-9.319-0.623-15.48-3.311c-4.175-1.82-8.006-3.31-8.513-3.31 c-0.549,0-0.621,11.039-0.176,27.31c0.955,34.97,0.958,91.285,0.006,111.164c-1.267,26.447-4.287,49.291-9.586,72.48 c-3.079,13.479-3.482,16.498-2.39,17.932c0.721,0.947,1.631,1.721,2.021,1.721c1.117,0,8.793-15.195,12.104-23.961 c5.931-15.701,10.866-37.443,12.781-56.309l0.701-6.898h17.026l-1.326,55.17c-1.423,3.031-2.515,3.168-13.619,1.717 c-6.279-0.819-6.333-0.807-6.333,1.927c0,1.928,2.073,5.016,6.923,10.313c4.599,5.021,7.539,9.328,8.759,12.826 c1.563,4.484,2.151,5.162,3.969,4.582c5.182-1.656,9.604-6.027,12.419-12.273L173.771,362.742z M160.092,286.059h-17.225v-55.169 h17.225V286.059z M160.092,222.062h-17.225V169.1h17.225V222.062z"/> <path d="M293.07,161.867l-28.633,0.519l9.645,13.688l4.053-1.601c9.032-3.139-3.802-2.639,40.807-2.178l36.75-0.577l-9.136-9.302 l-9.138-9.302l-15.717,8.237L293.07,161.867z"/> <path d="M222.14,68.533l-13.546,14.79c-10.902,11.906-16.242,16.731-27.367,24.737c-13.609,9.792-34.075,21.463-47.984,27.362 c-8.677,3.68-8.933,3.929-7.692,7.482l0.995,2.851l11.961-3.866c26.478-8.556,46.305-17.892,73.013-34.374 c22.589-13.94,23.673-14.466,32.708-15.858l8.12-1.25l-15.104-10.938L222.14,68.533z"/> <path d="M346.897,139.838c-4.937-4.418-9.556-8.035-10.266-8.035c-0.711,0-4.132,1.274-7.604,2.83 c-6.304,2.824-6.376,2.832-36.464,3.368l-30.149,0.54l9.534,13.669L280.5,149c20.153-0.787,75.367-1.13,75.367-1.13 L346.897,139.838z"/> <path d="M191.97,200.99l-7.131,5.135l3.792,7.141c2.085,3.927,4.154,7.11,4.598,7.071s2.631-0.968,4.859-2.064 c4.674-2.301,15.125-4.473,32.423-6.736c6.687-0.875,12.5-1.596,12.919-1.602c0.418-0.005,0.76,1.944,0.76,4.333 s0.445,5.615,0.988,7.172c1.354,3.878,2.733,3.569,7.275-1.629c3.089-3.538,3.895-5.307,3.886-8.552 c-0.012-5.345-4.213-13.069-12.353-22.718c-6.06-7.182-6.586-7.55-9.729-6.798l-3.324,0.795l2.109,3.488 c2.306,3.813,8.108,15.761,8.108,16.697c0,0.321-9.46,0.571-21.024,0.557l-21.024-0.027l5.573-5.173 c9.319-8.649,25.171-25.794,30.967-33.491c3.499-4.647,7.001-8.021,9.703-9.348l4.227-2.077l-7.502-7.476 c-4.127-4.112-7.962-7.478-8.522-7.478c-0.56-0.001-2.04,2.853-3.289,6.343c-1.25,3.49-3.177,7.958-4.286,9.931l-2.016,3.586 h-15.214c-8.367,0-15.214-0.389-15.214-0.863c0-1.57,32.485-31.646,36.547-33.836c2.19-1.181,3.977-2.423,3.971-2.758 c-0.01-0.471-16.511-11.646-19.253-13.038c-0.314-0.159-1.139,2.018-1.831,4.838c-4.399,17.911-17.597,37.768-28.624,43.065 c-2.208,1.061-3.893,2.242-3.744,2.625c0.147,0.384,2.041,4.976,4.206,10.205l3.936,9.507l3.157-2.587 c1.735-1.424,1.981-2.978,7.862-4.304c5.551-2.023,17.526-4.417,19.151-3.827c1.393,0.506-8.597,15.994-15.084,23.384 C201.226,193.434,195.893,198.165,191.97,200.99z"/> <g> <path d="M212.273,453.381c3.344,0.342,48.484,0.586,100.309,0.541c104.205-0.092,103.413-0.051,118.041-5.967 c5.849-2.363,13.173-7.344,13.173-8.955c0-0.326-1.924-1.367-4.281-2.314c-6.762-2.721-13.946-8.301-16.041-12.454 c-1.045-2.07-2.46-6.722-3.145-10.333l-1.247-6.569h-7.71l-0.052,8.836c-0.064,11.17-0.775,16.463-2.543,18.949 c-0.769,1.08-3.727,3.758-7.037,3.852c-75.582,2.135-45.149,2.668-178.322,1.857l-3.958-2.023 c-7.031-3.596-8.162-5.832-8.495-16.811l-0.294-9.677l7.403-9.295c-0.404-0.127-7.347-2.629-15.428-5.555l-14.692-5.318 l-0.294,17.783c-0.404,24.496,0.977,30.943,7.974,37.199C199.686,450.748,204.608,452.6,212.273,453.381z"/> <path d="M154.256,404.033c-8.408,11.227-12.161,14.928-23.174,22.85c-9.769,7.023-12.531,9.717-12.531,12.219 c0,2.013,2.844,4.125,7.092,5.271c5.889,1.586,15.512,0.643,20.592-2.021c11.565-6.061,17.982-18.053,19.518-36.479l0.688-8.248 l-2.993-0.937C160.487,395.766,160.388,395.846,154.256,404.033z"/> <path d="M467.429,427.342c7.128,6.679,13.961,12.64,15.182,13.246c2.935,1.459,3.889,1.433,6.477-0.188 c4.783-2.996,7.222-17.277,3.925-22.98c-2.907-5.024-19.268-12.119-49.51-21.471l-6.883-2.13l-1.896,2.789l-1.896,2.789 l10.818,7.902C449.596,411.645,460.298,420.664,467.429,427.342z"/> <path d="M269.754,387.078c23.155,8.477,43.153,21.201,61.019,38.826c4.429,4.369,9.442,8.715,11.146,9.653 c5.188,2.869,9.702,1.068,12.854-5.127c3.214-6.315,1.988-12.452-3.85-19.299c-7.554-8.856-35.523-19.508-81.013-30.853 c-5.78-1.442-6.18-1.364-7.217,1.421C261.796,384.111,261.941,384.221,269.754,387.078z"/> </g> <g> <path d="M467.412,353.047c-2.155,3.582-4.95,3.83-15.26,1.361c-8.745-2.096-8.292-2.172-8.292,1.41 c0.002,2.524,0.918,3.666,4.922,6.123c7.375,4.526,13.388,10.608,15.398,15.578l1.795,4.434l3.04-1.924 c4.878-3.088,12.663-13.078,14.016-17.979c0.923-3.36,1.241-28.937,1.241-99.608c0-94.833,0.008-95.104,2.189-98.953 c1.205-2.123,2.022-4.032,1.813-4.239c-1.136-1.142-19.828-13.102-20.033-12.818c0.024,38.464,2.318,76.997,1.136,115.494 C469.258,344.197,469.128,350.195,467.412,353.047z"/> <path d="M460.258,187.415c-0.833-0.828-19.634-12.998-20.08-12.998c-0.276,0-0.206,1.396,0.158,3.104 c0.88,4.141,0.673,134.569,0.673,134.569l-1.222,13.625l4.368-2.914c2.401-1.604,6.139-4.033,8.304-5.404 c3.392-2.143,3.833-2.873,3.206-5.307c-2.539-38.09-0.279-76.467-1.546-114.606l3.234-4.867 C459.136,189.939,460.443,187.599,460.258,187.415z"/> </g> <g> <path d="M324.872,336.477c0.914,3.049,2.071,6.414,2.574,7.476c0.503,1.063,1.563,1.934,2.354,1.934 c1.909,0,6.542-8.731,7.288-13.739c0.53-3.578,0.188-4.396-3.511-8.222c-7.599-7.87-18.464-13.133-18.464-8.938 c0,0.475,1.821,4.258,4.047,8.406C321.389,327.535,323.957,333.424,324.872,336.477z"/> <path d="M305.599,322.059c-4.9-3.918-6.319-4.567-7.93-3.629c-1.078,0.629-1.729,1.725-1.446,2.437 c5.487,13.84,7.747,19.838,7.747,20.557c0,0.486,0.688,2.681,1.534,4.879c0.843,2.197,2.206,3.996,3.025,3.996 c2.134,0,6.729-8.422,7.35-13.467C316.503,331.787,314.914,329.504,305.599,322.059z"/> <path d="M267.803,322.389l-2.938,0.803c-1.614,0.443-2.983,0.89-3.041,0.99c-0.06,0.103-1.337,3.164-2.841,6.805 c-1.502,3.642-5.028,10.438-7.834,15.105c-2.808,4.664-4.946,9.367-4.754,10.451c0.192,1.086,1.484,2.6,2.874,3.363 c3.453,1.902,5.027,1.771,8.807-0.736c5.485-3.646,8.052-11.264,9.083-26.965L267.803,322.389z"/> <path d="M292.098,349.443c5.434-10.875,4.582-14.133-6.117-23.508c-6.394-5.601-7.758-6.367-9.508-5.349 c-1.121,0.654-1.82,1.772-1.552,2.483c0.871,2.291,7.397,20.984,9.218,26.396C286.454,356.352,288.646,356.346,292.098,349.443z" /> <path d="M358.401,313.439c0.123-1.76,1.138-4.265,2.258-5.562l2.036-2.36l-7.324-6.765l-7.323-6.762l-6.177,6.446h-29.793v-8.83 h37.606l-5.834-7.723c-3.209-4.248-6.22-7.723-6.688-7.723c-0.467,0-2.638,0.994-4.822,2.205 c-6.396,3.053-13.453,2.074-20.265,2.207v-9.93h37.669l-8.936-11.33l-3.434-4.158l-4.488,2.227 c-3.313,1.645-6.624,2.227-12.65,2.227h-8.161v-9.929h23.938h23.941l-10.257-8.925l-10.26-8.924l-5.087,3.407l-5.085,3.409 h-28.884h-28.885l-6.724-3.319c-3.697-1.827-6.853-3.181-7.01-3.009c-0.158,0.172,0.092,4.273,0.555,9.113 c1.08,11.3,1.058,51.577-0.039,67.229c-0.467,6.647-0.75,12.157-0.631,12.248c0.119,0.088,4.18-0.32,9.025-0.906l8.811-1.063 l0.31-3.459l0.31-3.457h32.93h32.93l-0.027,11.033c-0.035,14.659-2.152,22.293-7.934,28.588 c-5.641,6.143-10.338,7.366-28.119,7.342c-7.742-0.01-14.074,0.404-14.074,0.924c0,1.494,2.207,2.934,6.586,4.293 c7.826,2.428,15.965,9.639,17.98,15.93c0.399,1.252,9.794-1.801,15.963-5.188c8.899-4.885,15.709-11.869,19.164-19.662 c2.923-6.592,6.166-20.684,6.166-26.797C357.673,324.498,358.316,314.664,358.401,313.439z M275.777,251.361l0.33-3.128h21.277 v8.828l-10.402,0.314C275.643,257.719,275.139,257.449,275.777,251.361z M297.893,298.439h-22.291v-8.83h22.291V298.439z M297.386,278.023l-21.075-0.148c-0.968-2.947-0.68-6.131-0.709-9.23h22.408L297.386,278.023z"/> </g> <path d="M365.116,315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.063,57.187,0.063,57.187l3.227,4.437l3.226,4.436 l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.892-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818 c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.405,4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899 c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059 c0-1.607,8.525-6.173,15.959-8.546c2.367-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304 c-2.328,4.018-5.628,8.578-7.33,10.139c-3.631,3.326-3.104,3.846-9.88-9.668l-4.288-8.553h21.935 c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.188,4.654l-15.856-0.304l-15.854-0.305v-15.445l21.001-0.299 l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.191-4.654l-4.025,5.506h-23.713l0.156-16.187 c0,0,9.811-0.366,21.283-0.366h20.855l-2.92-4.137c-1.605-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.207-3.035-2.771-3.035 c-3.22,1.875-5.566,5.064-8.179,7.793l-23.602,0.083l-0.079-16.15l23.022-0.296l23.022-0.297l-5.762-8.254 c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.69,5.271l-27.793-0.132l-6.334-4.694l-6.332-4.694v78.42 h-6.791h-6.793l3.885,4.332C362.113,316.086,362.989,316.543,365.116,315.664z M383.404,314.583c0,0,8.866,27.05,12.348,32.667 c1.746,2.82,3.274,5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C383.383,356.627,383.404,314.583,383.404,314.583z"/> </g> </svg>' ``` kolmogorov who? [Answer] # HTML/JavaScript 14184 Bytes Using [Obfuscatweet] we can get 7146 chars! (<http://xem.github.io/obfuscatweet/>): ``` document.write(unescape(escape('🁳𨱲𪑰𭀾𩡵𫡣𭁩𫱮𘁤𚁡𚑻𩁯𨱵𫑥𫡴𛡷𬡩𭁥𚁡𚑽𞱦𭑮𨱴𪑯𫠠𬠨𨐬𨠬𨰩𮱲𩑴𭑲𫠠𨐮𬡥𬁬𨑣𩐨𨠬𨰩𯐻𡀽𙰼𩰾𙰻𡐽𙰼𛱧🠧𞱆🐧𘠯🠧𞱇🐧🁰𨑴𪀠𩀽𘡍𙰻𢀽𙰬𝀮𜀹𜠬𝰮𜀵𜠬𜠮𜰰𜑣𜠮𜠷𜰭𜠮𝀷𝠬𝰮𝠷𜐭𝀮𞀹𞐬𜐰𛠹𜀸𛐴𛠸𞐹𨰱𛠸𝀱𛀰𛀲𛠵𝠶𛐰𛠵𞐬𜠮𝐶𝠭𜠮𜀸𜡣𜀭𜐮𝐷𝀭𜠮𜀱𝠭𜠮𞐶𝰭𞀮𜠴𞀭𝐮𝰰𜑣𛐱𜰮𜠲𝰭𝐮𞀰𝰭𜠳𛠱𝠴𛐱𜰮𞐸𜠭𜠳𛠱𝠴𛐱𞐮𜀵𞑣𜀭𜐮𝠰𝰬𞀮𝐲𝐭𝠮𜐷𜰬𜐵𛠹𝐧𞱉🐧𛐴𛠵𜐴𛀵𛠵𜀳𛐶𛠱𜰳𨰭𜀮𜰱𝀭𜐮𜰰𝰬𜐮𝠶𛀰𛠱𜠷𛀵𛠲𝐱𛀳𛠸𜐸𨰳𛠱𝠴𛀳𛠲𝐴𛀸𛠱𝀴𛀷𛠸𜀱𛀱𜐮𜀶𝀬𜐰𛠱𜀸𨰵𛠰𜠱𛀳𛠹𝠹𛀵𛠴𜀧𞱊🐧𛐰𛠲𞐶𫀲𜰮𜀲𜠭𜀮𜠹𝱬𛐵𛠷𝠲𛐸𛠲𝐴𨰭𜰮𜐶𞀭𝀮𝐴𜐭𝠮𜀷𜐭𞀮𜠵𝐭𝠮𝀴𞐭𞀮𜠵𝑳𛐲𛠳𝀷𛀲𛠳𝰱𛐴𛠳𝰷𛀵𛠲𝰱𫀭𜰮𝠹𙰻𢰽𙰭𜀮𜰰𝑶𛐱𝐮𝀴𝑬𜠱𛠰𜀱𛐰𛠲𞐹𫀲𜐮𜀰𜐭𜀮𜠹𞑬𛐴𛠱𝀷𛐷𛠴𜠶𨰭𝠮𜠲𝠭𜐱𛠱𝀵𛐵𛠶𝀱𛐱𜀮𞀷𝰭𜐰𛠱𞐧𞱎🐧𛐰𛠷𝐶𛀴𛠳𜀶𛐱𛠵𜰬𝀮𜰰𝠭𜐮𝰲𝱳𛐲𛠲𜠹𛐴𛠱𝠭𝀮𞐵𝠭𞀮𞀱𜱬𛐴𛠹𝐸𛐸𛠴𝠲𫀭𝀮𜠳𝐬𝰮𜰰𝁣𛐲𛠳𜠧𞱏🐧𛀴𛠴𜰷𫀳𛠲𜠶𛀴𛠴𜰶𫀷𛠷𜐭𝠮𜀲𜑣𝀮𜠴𛐳𛠳𜐳𛀱𜀮𝀱𜰭𝰮𞀴𜠬𜐳𛠷𜐶𛐱𜀮𜀶𜱣𝀮𝠴𝀭𜰮𜐲𜐬𝐮𞀹𙰻𤀽𙰭𝀮𝠵𝁬𛐴𛠰𜠵𛀵𛠵𜀶𪀭𜠳𛠷𜐳𫀰𛠱𝐶𛐱𝠮𜐸𝱣𜀬𜀬𞐮𞀱𜐭𜀮𜰶𝠬𜠱𛠲𞀳𛐰𛠳𝠶𪀲𜀮𞀵𙰻𤐽𙱣𜠴𛠹𝠹𛀰𛀲𜰮𝀰𞐬𜐮𜀶𞐬𜐴𛠵𜀷𛐹𛠹𝐵𫀭𝀮𝰷𞀭𝐮𞐱𞁬𛐴𛠱𞐬𝀮𝠵𜱬𛐴𛠱𞀧𞱒🐧𛀳𜐵𛠶𝠴𨰱𛠳𝐶𛐰𛠵𝠳𛀲𛠶𞐷𛐱𛠰𜠱𛀲𛠹𝰸𛐱𛠰𜠱𨰰𛠰𜰸𛀰𛠳𝰶𛀰𛠰𝠧𞱓🐧𛐳𛠰𜰵𛐲𛠷𝰱𛐳𛠰𜰵𨰭𜰮𜠲𛀱𛠸𝰵𛐵𛠵𝠶𛀵𛠰𝠴𛐸𛠱𝰹𛀷𛠷𞐳𫀭𜠳𛠶𜀧𞱔🐧𛀵𛠶𜐵𛀳𛠳𞐶𛀶𛠲𜐵𨰰𛠱𞀬𜀮𞀹𜐭𜐵𛠲𜐱𛀸𛠰𜀶𛐱𝐮𝠰𞐬𝰮𜠱𜱃𙰻𥐽𙰭𜠮𜠷𝐭𜰮𝰰𝰭𝐮𝐰𝀭𝀮𝠶𞀭𝰮𜐷𜡣𛐰𛠹𝠱𛐱𛠶𝰭𜠮𜠰𙰻𥰽𙰬𜰱𝀮𝐸𜱣𜀬𜀬𞀮𞀶𝠬𜠷𛠰𝐬𜐲𛠳𝀧𞱘🐧𛀴𛠶𝐴𫀭𜐵𛠸𝐶𛐰𛠳𜀴𫀭𜐵𛠸𝐧𞱙🐧𛀵𛠲𝰱𫀭𜠷𛠷𞐳𛐰𛠱𜰲𫀭𝠮𜰳𙰻𩀨𙰼𬱶𩰠𭱩𩁴𪀽𘠵𜀰𘠠𪁥𪑧𪁴🐢𝐰𜀢🠧𚱄𚐻𩀨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𬠨𙱄𡰴𜀸𛠹𞐷𛀱𜠲𛠳𞀲𫀳𛠶𜠹𛐲𛠰𜰲𫀭𜐰𛠰𜐲𛐶𛠴𞐷𫀭𜐰𛠰𜀹𛐶𛠴𞐷𫀭𜠮𜐹𝐬𝰮𜀸𜱣𛐲𛠹𝐸𛀹𛠵𝐲𛐸𛠴𞀷𛀲𜀮𝰷𜰭𜐴𛠰𜀳𛀲𞀮𝀱𝡣𛐴𛠳𝐵𛀶𛠰𜰸𛐱𜰮𝰷𝐬𜐴𛠱𜀶𛐱𝠮𝀶𝰬𜐴𛠱𜀶𨰭𜐮𝠸𛀰𛐱𛠷𝐵𛐰𛠳𜰸𛀱𛠸𝠱𛀸𛠳𝀵𨰱𛠷𜠹𛀴𛠱𝐱𛀳𛠵𝐵𛀸𛠷𜠹𛀴𛠰𝠬𜐰𛠱𝰴𫀰𛠹𜐸𛀲𛠶𜠸𫀳𛠰𝰹𛐲𛠸𜠳𨰱𛠶𞐵𛐱𛠵𝐳𛀲𛠲𝐳𛐳𛠰𜰵𛀸𛠳𜀴𛐴𛠵𜐲𨰶𛠵𝰭𜠮𜐲𝠬𜐷𛠵𜰴𛐴𛠲𜰲𛀱𞐮𜀸𞀭𜰮𝠶𝱣𜀮𝠶𝀬𜀮𜠴𜠭𜠮𜠳𛀵𛠳𝐶𛐶𛠶𝀹𛀱𜐮𝰴𝁣𛐷𛠹𞀴𛀱𜐮𝐴𜰭𜐶𛠷𝐬𜠰𛠵𜐵𛐲𜰮𞐴𜠬𜠴𛠵𜐳𫀭𝀮𜀲𜐬𜠮𜠳𫀲𛠸𜠲𛀵𛠴𝰸𨰱𛠵𝐳𛀳𛠰𜐲𛀳𛠵𜰶𛀶𛠵𜀵𛀴𛠴𜀹𛀷𛠷𝠵𨰱𛠵𞀱𛀲𛠲𞐬𜐮𝐸𜰬𜠮𜠹𛀵𛠰𝠴𛀰𛠱𜠱𨰴𛠴𜰸𛐲𛠷𝠵𛀱𜀮𝀷𞐭𝀮𜠰𝠬𜠶𛠲𞀱𛐶𛠲𝰱𨰶𛠹𝠶𛐰𛠹𜐲𛀱𝀮𜰲𜐭𜐮𞐰𜠬𜐶𛠳𝀹𛐲𛠲𜀲𨰳𛠱𝰳𛐰𛠴𝰲𛀳𛠷𝠹𛐰𛠲𜀴𛀴𛠲𞐳𛀱𛠹𜠸𨰰𛠶𜀲𛀳𛠲𝐬𜀮𝀲𜐬𝠮𝠵𞀬𜐮𝠸𝠬𞐮𝰲𨰱𛠴𜰳𛀲𛠹𜐶𛀲𛠲𞐸𛀲𛠷𜐲𛀶𛠴𜀸𛐱𛠵𜐲𨰶𛠸𜰱𛐷𛠰𜐴𛀵𛠹𝠷𛐱𜰮𞀴𝰭𜰮𜰳𝰭𜠶𛠴𜀵𨰭𞀮𞐶𝐭𜐲𛠰𞐶𛐱𜀮𝐸𜰭𜐳𛠵𜐳𛐱𝀮𜐰𜐭𜐲𛠳𜠱𫀭𜠮𞐳𞀬𜀮𞐹𝑬𝀮𞐳𞀬𞐮𜰳𜱣𜠮𝰱𞐬𝐮𜐳𝀬𝀮𞐳𞐬𞐮𝰲𝰬𝀮𞐳𞐬𜐰𛠲𜀷𨰭𜐱𛠸𞀳𛀳𛠰𝀲𛐳𜀮𜀳𛀱𛠹𝰹𛐴𜀮𝀹𜰭𜀮𝠱𝡣𜐱𛠲𜰲𛐱𜐮𜐸𜰬𜠲𛠶𞀵𛐲𜠮𜐵𞐬𜰲𛠷𜠹𛐳𝀮𝠵𝡣𝀮𞐲𝠭𝠮𜐱𜐬𜐰𛠲𞀲𛐱𜐮𝰱𜠬𜐱𛠹𜀵𛐱𜠮𝀴𝑣𜐮𝠲𝐭𜀮𝰳𜐬𜠮𞐵𜠭𜐮𝠶𝠬𜠮𞐵𜠭𜠮𜀷𝑣𜀭𜐮𜐶𜰭𜐳𛠹𜐭𜐴𛠴𜰵𛐱𝐮𜐲𝰭𜐴𛠴𜰵𨰭𜀮𝐹𞀬𜀭𜐮𜀸𝀬𜀮𝀴𜐭𜐮𜀸𝀬𜀮𞐸𨰰𛀰𛠵𝀭𜐮𝠸𝐬𝐮𜀰𝰭𜰮𝰴𛀹𛠹𜰱𫀭𜰮𝰴𜰬𞀮𞐵𪀭𜐵𛠵𜀹𨰭𞀮𝐳𜐬𜀭𜐵𛠵𜐱𛐰𛠳𞐶𛐱𝐮𝐱𜐭𜀮𞀷𞑃𜰷𜐮𞀳𜠬𜐵𝐮𝰲𜠬𝀰𝐮𜐰𝀬𜐲𝀮𝐶𜐬𝀰𞀮𞐹𝰬𜐲𜠮𜰸𜡺𡡇𜠵𞀮𞐸𛀱𜰰𛠷𝀲𨰰𛠰𝐳𛀰𛠰𜐴𛀱𛠶𝀷𛐰𛠷𞐲𛀳𛠵𝀵𛐱𛠷𞑣𝰮𞐷𝐭𜰮𜠸𝐭𜠮𜰵𞀭𜠮𜠸𝐬𝐵𛠵𜐷𛐲𛠳𜰳𫀵𜠮𜀶𞐭𜀮𝐱𞁬𛐱𜀮𝠶𞐭𜐰𛠱𜀷𨰭𝐮𞀷𛐵𛠵𝠭𜐱𛠱𝀷𛐱𜀮𜐰𞀭𜐱𛠷𜠹𛐱𜀮𜐰𞁳𛐵𛠵𞀷𛀲𛠳𜰳𛐱𜐮𜐲𝀬𝐮𜐸𝁣𛐹𛠵𝐲𛀴𛠹𜐹𛐱𜀮𝀶𞐬𝐮𜐸𜰭𜐸𛠰𝀸𛀵𛠱𝠷𫀭𝰮𞐸𜰭𜀮𜀱𞁬𜰮𞐵𞀭𜠮𜰱𝡣𜠮𜐷𝀭𜐮𜠷𜠬𝀮𞀰𞀭𜰮𝀸𞐬𝐮𞀴𝰭𝀮𞐲𝁣𝐮𝠲𜰭𝰮𝰶𜐭𝐮𞐸𜠭𜐹𛠳𝀶𛐲𞀮𜐱𝰭𜠸𛠰𝠷𨰭𞀮𞀸𝀭𜰮𝐭𞐮𝰷𝰭𜰮𝐹𛐱𜰮𜐴𞐭𜐮𜰳𫀭𜠮𝐱𝠬𜐮𝠸𝑬𞀮𞐲𝐬𞀮𞐵𨰴𛠹𜀸𛀴𛠹𜠱𛀱𜀮𞀹𝠬𜐱𛠷𝀴𛀱𜰮𜰰𝐬𜐵𛠱𝡣𜠮𝀱𛀳𛠴𜐵𛀵𛠵𞀳𛀷𛠲𝐸𛀷𛠰𝐳𛀸𛠵𜰹𫀲𛠶𝰱𛀲𛠳𜠷𫀭𝠵𛠴𜰱𛀰𛠰𜑌𜠵𞀮𞐸𛀱𜰰𛠷𝀲𮡆𡰱𞀶𛠱𜠸𤠲𛀵𝰮𜐸𝰬𜀮𜀶𜠬𝐷𛠱𞀷𫀳𛠲𜠶𣰱𢐶𢀸𛐸𛠵𝀶𨰲𛠳𝠸𣠹𛀴𛠰𜐸𛐵𛠶𜠸𛀸𛠵𝰸𛐷𛠳𜰱𛀱𜀮𜐳𞑣𛐳𛠶𜰬𜰮𜰲𝠭𜰮𜐰𜰬𜰮𞀴𝠭𞐮𞀷𞐭𞐮𝠶𞁬𛐴𛠲𞀸𛐸𛠵𝐳𪀲𜐮𞐳𝁑𞑘𝑋𜡐𝡬𛐲𛠹𜠭𝀮𜐳𝱣𛐱𛠶𜀶𥐸𤰱𛀰𛠰𞀳𫀭𜀮𜀷𞐭𜐶𛠱𝑬𜠳𛠰𜠳𢠱𦐳𛐴𛠶𞐴𫀭𝠮𜰳𜰭𝀮𝠹𝁶𝰸𛠴𜡨𛐶𛠷𞐱𪀭𝠮𝰹𜡬𜰮𞀸𝀬𝀮𜰳𜡃𜐸𜰮𜐲𝐬𜰱𝠮𜀸𝠬𜐸𝀮𜀰𜐬𜰱𝠮𝐴𜰬𜐸𝠮𜐲𞀬𜰱𝐮𝠶𝁺𘁍𜠰𝀮𝀱𝱗𝰬𜰲𛠶𝠷𨰱𛠷𝀷𛀲𛠸𜠬𜰮𜠷𝑔𜠰𝀮𜰹𝐬𜰵𝠮𝠲𝰬𜠰𝀮𝀱𝰬𜰱𝀮𝐸𜰬𜠰𝀮𝀱𝰬𜰱𝀮𝐸𜱺𡡇𜠶𜐮𞐶𝐬𜐸𜐮𝰷𜑣𜐮𜠲𜐬𞐮𝐳𞐬𜐮𝀰𜠬𜐲𛠷𝠷𛀱𛠴𜰸𛀲𝐮𝀵𜑣𜀮𜀲𜐬𝰮𝐵𝐬𜀮𝀴𝐬𜐳𛠷𜰶𛀰𛠹𝀵𛀱𜰮𝰳𝡬𜐷𛠹𝠵𛐴𛠷𝰵𫀴𝠮𝀸𜠭𜀮𞐲𝱬𜀮𜰲𞐬𜠮𞐵𜑣𜀮𜠴𜰬𜠮𜐷𝠬𜀮𝰷𝐬𜠮𞀲𝰬𜠮𜀲𝠬𜠮𝀸𨰱𝰮𜐵𛐴𛠷𝐹𛀱𞀮𝀸𛐵𛠳𝐱𛀱𝰮𞐷𜰭𞀮𜀲𨰭𜀮𜠷𜰭𜐮𝀲𞀭𜀮𝰸𞀭𝀮𝰸𝠭𜐮𜐴𝰭𝰮𝀶𜡬𛐰𛠶𝐭𝀮𞀶𝱬𝐮𜠵𝠭𜰮𜰰𝱣𝀮𜠶𝐭𜠮𝠸𝰬𝀮𞐹𞐭𜰮𝐴𝀬𜰮𞐰𝀭𝀮𝐷𝁣𛐵𛠰𞀭𝀮𝰷𜰭𜐸𛠰𝐳𛐱𝐮𜀴𜐭𜐹𛠰𜀲𛐱𝐮𜀴𜑣𛐰𛠶𜰶𛀰𛐳𛠴𜀵𛀱𛠱𝠷𛐶𛠱𝐴𛀲𛠵𞐱𨰭𝀮𞀹𝰬𜠮𝐴𛐵𛠴𝠸𛀲𛠵𞐲𛐲𞀮𜀸𜰬𜠮𝐹𜑣𛐲𜐮𝀵𝀬𜀭𜰰𛠷𜰭𜀮𞀶𜰭𝀰𛠰𜀱𛐳𛠷𜡃𜠶𜐮𞀱𞀬𜐷𞀮𝀴𛀲𝠱𛠶𜀲𛀱𝰸𛠹𜰬𜠶𜐮𞐶𝐬𜐸𜐮𝰷𜑺𘁍𜠸𜠮𝐸𝰬𜐹𝀮𝀱𝡬𝀶𛠷𝰱𛐰𛠱𝰳𫀭𜀮𜀵𞐬𜐰𛠱𜠹𪀭𝀶𛠷𜐴𣀲𞀲𛠵𞀷𛀱𞐴𛠴𜐶𣀲𞀲𛠵𞀷𛀱𞐴𛠴𜐶𮡆𡰱𜰲𛠷𝀷𛀱𜐷𛠲𝀱𨰵𛠷𝠵𛀰𛀱𝀮𝐶𜰭𜰮𞐵𝠬𜐸𛠶𜐶𛐸𛠳𝠸𨰵𛠵𝀸𛐶𛠰𝀲𛀷𛠲𜐹𛐱𜠮𞐱𞐬𝰮𜐵𜐭𜠹𛠴𜠳𫀭𜀮𜀵𞀭𜐴𛠰𝠷𫀲𞐰𛠴𜀷𛀰𛠷𜐳𨰭𝐮𝀲𝀬𜐰𛠹𝐶𛐱𜠮𜀶𝐬𜠱𛠷𜐵𛐱𞐮𜠷𞀬𜰱𛠲𞀵𨰭𜀮𝐹𞀬𜀭𜠮𜰱𝰭𜀮𝠸𝐭𜰮𞀲𜰭𜐮𝐲𜡣𛐶𛠸𜰶𛐳𛠸𜀲𛐵𜰮𝀵𝀭𜐹𛠱𞐶𛐵𝀮𝐴𝐭𜐸𛠰𜑣𛐰𛠲𝐵𛀰𛠲𝰸𛐰𛠵𝐸𛀱𛠸𜐵𛐰𛠶𝰱𛀳𛠴𜐷𨰭𜀮𜐸𞀬𜠮𝠵𞐬𜀮𝐰𜐬𜰮𜠲𝠬𞀮𜀵𝐬𝠮𝠱𞑣𜠸𛠸𝀳𛀱𜠮𞐵𜐬𝐸𛠰𜐳𛀳𝀮𞐶𛀶𝠮𝠹𜰬𝐰𛠳𜠲𨰱𛠵𝀳𛀲𛠷𜰬𜰮𝰶𜠬𝠮𜐰𝐬𝀮𞐲𝰬𝰮𝀹𞁣𜠮𞐵𜰬𜰮𝐲𜰬𝠮𝀬𜠮𝰵𞀬𜐰𛠱𜀹𛐲𛠲𝀷𨰳𛠷𜠴𛐵𛠰𜠸𛀴𛠷𞐷𛐱𜰮𝠱𝀬𜠮𝀵𜐭𜐹𛠶𜠸𨰭𜠮𝐸𝀭𝠮𝠲𝰭𞐮𝀵𜰭𜐳𛠹𜰳𛐱𝠮𞐲𝠭𜐸𛠰𜀴𫀭𝠮𞐷𝐭𜰮𝰹𞑬𞀮𜠸𝀭𞀮𝰳𞑣𜐵𛠷𜰶𛐱𝠮𝠰𝀬𜰰𛠳𝐵𛐲𝐮𝰶𜠬𝀷𛠰𝐴𛐲𞐮𝀷𝑬𝐮𜰳𜰭𜐮𜐸𝡌𝀶𝠮𜰳𞀬𜠶𛠵𜑬𛐱𞐮𜠸𝰬𜠵𛠶𜰱𫀭𜐳𜐮𞐳𝀭𜀮𞀳𝱣𜀭𜀮𝀶𛀰𛠹𝐭𜐮𝀸𝐬𜠮𜐰𞀭𜠮𜠷𜱣𜐮𜐶𜠭𜀮𝰹𛀳𛠰𜀸𛐳𛠶𜰸𛀴𛠱𜀲𛐶𛠳𜰱𨰲𛠸𝀸𛐷𛠰𜐴𛀱𛠷𞐳𛐱𜐮𝰴𜰭𜰮𞐸𜐭𜐷𛠸𝐵𨰭𝐮𜐶𝰭𝐮𝀶𞀭𜠱𛠶𞀸𛐱𝀮𝠷𝀭𜰶𛠱𜀵𛐲𜀮𜐲𜑣𛐸𛠸𝰱𛐳𛠳𝐱𛐹𛠰𞐲𛐳𛠳𝰸𛐱𜀮𞐶𝐭𜐮𜰳𞑣𛐱𛠸𝰳𛀲𛠰𝀭𜐮𝰱𝰬𜠮𜰴𝠬𝰮𝰵𜠬𜐵𛠲𜐲𨰹𛠴𜰱𛀱𜠮𞀱𛀱𝠮𞀲𝀬𜠶𛠵𜰲𛀱𝠮𞀲𝀬𜰱𛠲𜐵𭠲𛠳𜠹𫀭𜐳𝠮𞐱𜰭𜐮𜐰𝁣𛐰𛠰𝰭𜀮𝠰𝠭𜀮𜠰𞐭𜐮𝀷𝠭𜀮𜰰𞐭𜐮𞐳𜑣𛐰𛠷𝀷𛐶𛠷𜰴𛐱𛠱𞐷𛐱𜰮𝐰𜠭𜐮𝰸𜠭𜠰𛠲𝐴𫀭𞀮𜀹𞀬𜀮𝠶𞑬𛐲𛠸𝰬𜐲𛠱𜰷𨰭𝀮𝠷𜠬𜐹𛠷𝐱𛐱𜠮𝀲𝠬𜰷𛠰𜰱𛐲𜐮𜠸𝰬𝀷𛠴𝀵𨰭𞀮𜐹𛀹𛠶𜠴𛐱𜐮𜐳𛀱𞐮𜠹𞐭𝰮𜐷𝰬𜠳𛠶𜀶𠰱𜐸𛠵𜠹𛀱𜐵𛠰𜐲𛀱𜠶𛠵𝠵𛀱𜐷𛠲𝀱𛀱𜰲𛠷𝀷𛀱𜐷𛠲𝀱𮡆𡰴𞐷𛠸𝠳𛀴𝐳𛠹𜠶𨰰𛀰𛐶𛠳𜠸𛀱𛠱𝠲𛐱𜐮𝠲𜐬𜐮𝰷𜑣𛐵𜰮𝀸𞀬𝠮𜐳𝐭𞐵𛠵𜐸𛀸𛠲𜰵𛐱𝠴𛠶𝀸𛀸𛠲𜰵𨰭𞐲𛠵𞐳𛀰𛐱𝐰𛠷𜐵𛐴𛠵𜰷𛐱𞀶𛠴𜰵𛐱𝀮𝐴𞑣𛐲𜐮𜀷𜠭𝐮𞐰𞀭𜰷𛠰𜰶𛐱𞀮𜰷𝰭𝀳𛠸𝰶𛐳𝀮𜠷𜡬𛐲𛠷𜰲𛐶𛠳𝀶𫀭𜀮𝐵𝠭𜠰𝰮𝰳𫀸𛠱𝐵𛐶𛠳𞐵𨰴𛠴𞀶𛐳𛠵𜐷𛀸𛠰𜰭𝠮𝰹𜠬𝰮𞀷𝠭𝰮𜠷𞁣𛐰𛠵𝐳𛐱𛠷𝠳𛐲𞐮𝀷𜠭𜠸𛠵𞀳𛐳𜀮𝀳𞐭𜠸𛠲𜰲𨰭𜀮𝐴𝰬𜀮𜐹𞐭𝀮𜀳𞀬𝐮𜀵𞀭𝰮𝰵𝰬𜐰𛠷𞐸𫀭𝠮𝰶𝐬𜐰𛠴𜰶𫀭𜠸𛠰𞀸𛀰𛠵𝐲𫀭𜠸𛠰𞀹𛀰𛠵𝐱𫀹𛠰𜐶𛀹𛠷𝰱𫀹𛠰𜐶𛀹𛠷𝰱𫀸𛠴𞀶𛐲𛠲𝀵𨰱𜠮𝀴𞐭𜰮𜠹𜰬𜐹𛠸𜰴𛐴𛠶𜀷𛀲𝐮𞀹𝠭𝀮𝠰𝱨𝐮𜰸𝡶𜠰𞀮𜠸𣀰𛀴𝐴𛠱𝑬𜠷𛠹𝠸𛀲𝰮𝰸𜡣𜀮𝐸𞐭𜀮𝰹𝰬𝠮𝠴𝰭𜐱𛠳𞀱𛀱𜰮𝀶𜰭𜠳𛠵𜐶𨰶𛠸𜐶𛐱𜠮𜐳𞐬𜐴𛠰𝀭𜠴𛠷𜠱𛀱𝠮𜀵𝠭𜠷𛠹𝠱𨰴𛠲𜰵𛐶𛠸𜐲𛀱𜀮𞐰𝐭𜐳𛠷𜰵𛀱𜠮𝠴𝀭𜐳𛠱𜰳𨰰𛠶𝐸𛀰𛠲𜠹𛀶𛠰𞐵𛀸𛠲𞐱𛀱𜠮𜀸𝀬𜐷𛠹𜡣𜐲𛠳𜰷𛀱𞐮𞀳𝀬𜐳𛠴𜀲𛀲𜐮𜠲𝰬𜠰𛠸𜰶𛀲𝰮𜠵𝁣𜠲𛠹𝐱𛀱𞀮𝠰𝰬𝠵𛠰𝰶𛀲𞀮𞀳𞀬𜐲𞀮𞀷𜰬𜰱𛠲𞐳𨰷𝀮𝀵𜰬𜠮𝠸𛀱𝀸𛠹𜠲𛀴𛠱𜐵𛀲𜠳𛠴𜐸𛀳𛠹𜡬𜐮𞀷𜰭𝐮𝰶𨰳𛠶𝠴𛐱𜐮𜠶𛀱𝰮𜐲𜰭𜠲𛠱𜀳𛀳𜰮𜰹𝠭𜠶𛠸𞐶𫀶𛠷𝰹𛐲𭠭𝀮𜠴𞁃𝀹𝰮𜰸𞐬𝀵𝠮𝀶𞐬𝀹𝰮𞀶𜰬𝀵𜰮𞐲𝠬𝀹𝰮𞀶𜰬𝀵𜰮𞐲𝡺𡡇𝠷𛠳𝰷𛀹𞐮𜐷𝑣𜰮𝠱𝐬𜐳𛠱𜐷𛀷𛠰𜰸𛀲𜀮𝠲𞀬𜐰𛠳𝠱𛀲𜠮𝰳𝁣𝀮𜰸𞐬𜠮𝰸𜠬𞐮𞀴𛀰𛠰𝰴𛀱𝐮𞀰𜐭𝰮𞀴𝱣𝠮𜠵𛐸𛠳𜀶𛀹𛠰𝠷𛐱𝠮𝀱𝀬𞐮𜀷𝰭𜠶𛠱𜐸𨰰𛠰𜐸𛐲𜀮𜠹𜠭𜐲𛠴𜠷𛐳𝠮𜐴𝀭𝀴𛠸𝐹𛐵𝰮𜐳𝱣𛐷𛠸𞐶𛐵𛠱𜐲𛐲𝀮𜐳𜰭𜐴𛠷𜐵𛐲𝀮𞀷𞀭𜐴𛠷𜐵𨰭𜐮𝠲𝰬𜐮𞐰𞐭𜰮𜀰𜐬𝀮𜀶𜰭𝀮𜰷𜰬𝠮𜠰𞁬𝐮𝠲𝰬𝰮𝠵𝑃𝐰𛠹𜰴𛀵𜠮𞀰𝐬𝐹𛠵𜰱𛀷𜀮𝰰𝠬𝠷𛠳𝰷𛀹𞐮𜐷𝑺𡡇𜐷𜰮𝰷𜐬𜰶𜠮𝰴𜡬𜀮𝐲𛐱𞐰𛠸𞀴𫀳𛠰𝠳𛐲𛠷𝐸𫀳𛠰𝠲𛐲𛠷𝐹𫀭𝰮𜐰𞐭𝰮𝠷𞁬𛐷𛠱𜀸𛐷𛠶𝰸𫀭𜰮𜰵𝠬𜰮𝐴𜡣𛐳𛠱𞐲𛀳𛠳𝠹𛐳𛠷𜰷𛀳𛠵𝀲𛐱𜐮𜠴𝀬𜰮𝐴𜡣𛐶𛠴𜀲𛀰𛐹𛠳𜐹𛐰𛠶𜠳𛐱𝐮𝀸𛐳𛠳𜐱𨰭𝀮𜐷𝐭𜐮𞀲𛐸𛠰𜀶𛐳𛠳𜐭𞀮𝐱𜰭𜰮𜰱𨰭𜀮𝐴𞐬𜀭𜀮𝠲𜐬𜐱𛠰𜰹𛐰𛠱𝰶𛀲𝰮𜰱𨰰𛠹𝐵𛀳𝀮𞐷𛀰𛠹𝐸𛀹𜐮𜠸𝐬𜀮𜀰𝠬𜐱𜐮𜐶𝁣𛐱𛠲𝠷𛀲𝠮𝀴𝰭𝀮𜠸𝰬𝀹𛠲𞐱𛐹𛠵𞀶𛀷𜠮𝀸𨰭𜰮𜀷𞐬𜐳𛠴𝰹𛐳𛠴𞀲𛀱𝠮𝀹𞀭𜠮𜰹𛀱𝰮𞐳𜡣𜀮𝰲𜐬𜀮𞐴𝰬𜐮𝠳𜐬𜐮𝰲𜐬𜠮𜀲𜐬𜐮𝰲𜑣𜐮𜐱𝰬𜀬𞀮𝰹𜰭𜐵𛠱𞐵𛀱𜠮𜐰𝀭𜠳𛠹𝠱𨰵𛠹𜰱𛐱𝐮𝰰𜐬𜐰𛠸𝠶𛐳𝰮𝀴𜰬𜐲𛠷𞀱𛐵𝠮𜰰𞑬𜀮𝰰𜐭𝠮𞀹𞁨𜐷𛠰𜠶𫀭𜐮𜰲𝠬𝐵𛠱𝱣𛐱𛠴𜠳𛀳𛠰𜰱𛐲𛠵𜐵𛀳𛠱𝠸𛐱𜰮𝠱𞐬𜐮𝰱𝱣𛐶𛠲𝰹𛐰𛠸𜐹𛐶𛠳𜰳𛐰𛠸𜀷𛐶𛠳𜰳𛀱𛠹𜠷𨰰𛀱𛠹𜠸𛀲𛠰𝰳𛀵𛠰𜐶𛀶𛠹𜠳𛀱𜀮𜰱𜱣𝀮𝐹𞐬𝐮𜀲𜐬𝰮𝐳𞐬𞐮𜰲𞀬𞀮𝰵𞐬𜐲𛠸𜠶𨰱𛠵𝠳𛀴𛠴𞀴𛀲𛠱𝐱𛀵𛠱𝠲𛀳𛠹𝠹𛀴𛠵𞀲𨰵𛠱𞀲𛐱𛠶𝐶𛀹𛠶𜀴𛐶𛠰𜠷𛀱𜠮𝀱𞐭𜐲𛠲𝰳𣀱𝰳𛠷𝰱𛀳𝠲𛠷𝀲𮠠𣐱𝠰𛠰𞐲𛀲𞀶𛠰𝐹𪀭𜐷𛠲𜠵𭠭𝐵𛠱𝠹𪀱𝰮𜠲𝑖𜠸𝠮𜀵𞑺𘁍𜐶𜀮𜀹𜠬𜠲𜠮𜀶𜡨𛐱𝰮𜠲𝑖𜐶𞐮𜑨𜐷𛠲𜠵𥠲𜠲𛠰𝠲𮡆𡰲𞐳𛠰𝰬𜐶𜐮𞀶𝱬𛐲𞀮𝠳𜰬𜀮𝐱𞑬𞐮𝠴𝐬𜐳𛠶𞀸𫀴𛠰𝐳𛐱𛠶𜀱𨰹𛠰𜰲𛐳𛠱𜰹𛐳𛠸𜀲𛐲𛠶𜰹𛀴𜀮𞀰𝰭𜠮𜐷𞁬𜰶𛠷𝐭𜀮𝐷𝱬𛐹𛠱𜰶𛐹𛠳𜀲𫀭𞐮𜐳𞀭𞐮𜰰𜡬𛐱𝐮𝰱𝰬𞀮𜠳𝱌𜠹𜰮𜀷𛀱𝠱𛠸𝠷𮡆𡰲𜠲𛠱𝀬𝠸𛠵𜰳𫀭𜐳𛠵𝀶𛀱𝀮𝰹𨰭𜐰𛠹𜀲𛀱𜐮𞐰𝠭𜐶𛠲𝀲𛀱𝠮𝰳𜐭𜠷𛠳𝠷𛀲𝀮𝰳𝱣𛐱𜰮𝠰𞐬𞐮𝰹𜠭𜰴𛠰𝰵𛀲𜐮𝀶𜰭𝀷𛠹𞀴𛀲𝰮𜰶𜡣𛐸𛠶𝰷𛀳𛠶𞀭𞀮𞐳𜰬𜰮𞐲𞐭𝰮𝠹𜠬𝰮𝀸𜡬𜀮𞐹𝐬𜠮𞀵𜑬𜐱𛠹𝠱𛐳𛠸𝠶𨰲𝠮𝀷𞀭𞀮𝐵𝠬𝀶𛠳𜀵𛐱𝰮𞀹𜠬𝰳𛠰𜐳𛐳𝀮𜰷𝁣𜠲𛠵𞀹𛐱𜰮𞐴𛀲𜰮𝠷𜰭𜐴𛠴𝠶𛀳𜠮𝰰𞀭𜐵𛠸𝐸𫀸𛠱𜠭𜐮𜠵𫀭𜐵𛠱𜀴𛐱𜀮𞐳𞁌𜠲𜠮𜐴𛀶𞀮𝐳𜱺𡡇𜰴𝠮𞀹𝰬𜐳𞐮𞀳𞁣𛐴𛠹𜰷𛐴𛠴𜐸𛐹𛠵𝐶𛐸𛠰𜰵𛐱𜀮𜠶𝠭𞀮𜀳𝑣𛐰𛠷𜐱𛀰𛐴𛠱𜰲𛀱𛠲𝰴𛐷𛠶𜀴𛀲𛠸𜱣𛐶𛠳𜀴𛀲𛠸𜠴𛐶𛠳𝰶𛀲𛠸𜰲𛐳𝠮𝀶𝀬𜰮𜰶𞁬𛐳𜀮𜐴𞐬𜀮𝐴𫀹𛠵𜰴𛀱𜰮𝠶𞑌𜠸𜀮𝐬𜐴𞑣𜠰𛠱𝐳𛐰𛠷𞀷𛀷𝐮𜰶𝰭𜐮𜐳𛀷𝐮𜰶𝰭𜐮𜐳𣀳𝀶𛠸𞐷𛀱𜰹𛠸𜰸𮡆𡰱𞐱𛠹𝰬𜠰𜀮𞐹𫀭𝰮𜐳𜐬𝐮𜐳𝑬𜰮𝰹𜠬𝰮𜐴𜑣𜠮𜀸𝐬𜰮𞐲𝰬𝀮𜐵𝀬𝰮𜐱𛀴𛠵𞐸𛀷𛠰𝰱𬰲𛠶𜰱𛐰𛠹𝠸𛀴𛠸𝐹𛐲𛠰𝠴𨰴𛠶𝰴𛐲𛠳𜀱𛀱𝐮𜐲𝐭𝀮𝀷𜰬𜰲𛠴𜠳𛐶𛠷𜰶𨰶𛠶𞀷𛐰𛠸𝰵𛀱𜠮𝐭𜐮𝐹𝠬𜐲𛠹𜐹𛐱𛠶𜀲𨰰𛠴𜐸𛐰𛠰𜀵𛀰𛠷𝠬𜐮𞐴𝀬𜀮𝰶𛀴𛠳𜰳𬰰𛠴𝀵𛀵𛠶𜐵𛀰𛠹𞀸𛀷𛠱𝰲𨰱𛠳𝐴𛀳𛠸𝰸𛀲𛠷𜰳𛀳𛠵𝠹𛀷𛠲𝰵𛐱𛠶𜠹𨰳𛠰𞀹𛐳𛠵𜰸𛀳𛠸𞐵𛐵𛠳𜀷𛀳𛠸𞀶𛐸𛠵𝐲𨰭𜀮𜀱𜠭𝐮𜰴𝐭𝀮𜠱𜰭𜐳𛠰𝠹𛐱𜠮𜰵𜰭𜠲𛠷𜐸𨰭𝠮𜀶𛐷𛠱𞀲𛐶𛠵𞀶𛐷𛠵𝐭𞐮𝰲𞐭𝠮𝰹𞁬𛐳𛠳𜠴𛀰𛠷𞐵𫀲𛠱𜀹𛀳𛠴𞀸𨰲𛠳𜀶𛀳𛠸𜐳𛀸𛠱𜀸𛀱𝐮𝰶𜐬𞀮𜐰𞀬𜐶𛠶𞐷𨰰𛀰𛠳𜠱𛐹𛠴𝠬𜀮𝐷𜐭𜠱𛠰𜠴𛀰𛠵𝐷𫀭𜠱𛠰𜠴𛐰𛠰𜠷𫀵𛠵𝰳𛐵𛠱𝰳𨰹𛠳𜐹𛐸𛠶𝀹𛀲𝐮𜐷𜐭𜠵𛠷𞐴𛀳𜀮𞐶𝰭𜰳𛠴𞐱𨰳𛠴𞐹𛐴𛠶𝀷𛀷𛠰𜀱𛐸𛠰𜠱𛀹𛠷𜀳𛐹𛠳𝀸𫀴𛠲𜠷𛐲𛠰𝰷𫀭𝰮𝐰𜠭𝰮𝀷𝡣𛐴𛠱𜠷𛐴𛠱𜐲𛐷𛠹𝠲𛐷𛠴𝰸𛐸𛠵𜠲𛐷𛠴𝰸𨰭𜀮𝐶𛐰𛠰𜀱𛐲𛠰𝀬𜠮𞀵𜰭𜰮𜠸𞐬𝠮𜰴𜱣𛐱𛠲𝐬𜰮𝀹𛐳𛠱𝰷𛀷𛠹𝐸𛐴𛠲𞀶𛀹𛠹𜰱𫀭𜠮𜀱𝠬𜰮𝐸𝡨𛐱𝐮𜠱𝁣𛐸𛠳𝠷𛀰𛐱𝐮𜠱𝀭𜀮𜰸𞐭𜐵𛠲𜐴𛐰𛠸𝠳𨰰𛐱𛠵𝰬𜰲𛠴𞀵𛐳𜐮𝠴𝠬𜰶𛠵𝀷𛐳𜰮𞀳𝡣𜠮𜐹𛐱𛠱𞀱𛀳𛠹𝰷𛐲𛠴𜠳𛀳𛠹𝰱𛐲𛠷𝐸𨰭𜀮𜀱𛐰𛠴𝰱𛐱𝠮𝐱𜐭𜐱𛠶𝀶𛐱𞐮𜠵𜰭𜐳𛠰𜰸𨰭𜀮𜰱𝀭𜀮𜐵𞐭𜐮𜐳𞐬𜠮𜀱𞀭𜐮𞀳𜐬𝀮𞀳𞁣𛐴𛠳𞐹𛀱𝰮𞐱𜐭𜐷𛠵𞐷𛀳𝰮𝰶𞀭𜠸𛠶𜠴𛀴𜰮𜀶𝑣𛐲𛠲𜀸𛀱𛠰𝠱𛐳𛠸𞐳𛀲𛠲𝀲𛐳𛠷𝀴𛀲𛠶𜠵𨰰𛠱𝀷𛀰𛠳𞀴𛀲𛠰𝀱𛀴𛠹𝰶𛀴𛠲𜀶𛀱𜀮𜠰𝑬𜰮𞐳𝠬𞐮𝐰𝱬𜰮𜐵𝰭𜠮𝐸𝱣𜐮𝰳𝐭𜐮𝀲𝀬𜐮𞐸𜐭𜠮𞐷𞀬𝰮𞀶𜠭𝀮𜰰𝁣𝐮𝐵𜐭𜠮𜀲𜰬𜐷𛠵𜠶𛐴𛠴𜐷𛀱𞐮𜐵𜐭𜰮𞀲𝱣𜐮𜰹𜰬𜀮𝐰𝠭𞀮𝐹𝰬𜐵𛠹𞐴𛐱𝐮𜀸𝀬𜠳𛠳𞀴𠰲𜀱𛠲𜠶𛀱𞐳𛠴𜰴𛀱𞐵𛠸𞐳𛀱𞐸𛠱𝠵𛀱𞐱𛠹𝰬𜠰𜀮𞐹𮡆𡁇𜠱𜠮𜠷𜰬𝀵𜰮𜰸𜑣𜰮𜰴𝀬𜀮𜰴𜠬𝀸𛠴𞀴𛀰𛠵𞀶𛀱𜀰𛠳𜀹𛀰𛠵𝀱𨰱𜀴𛠲𜀵𛐰𛠰𞐲𛀱𜀳𛠴𜐳𛐰𛠰𝐱𛀱𜐸𛠰𝀱𛐵𛠹𝠷𨰵𛠸𝀹𛐲𛠳𝠳𛀱𜰮𜐷𜰭𝰮𜰴𝀬𜐳𛠱𝰳𛐸𛠹𝐵𨰰𛐰𛠳𜠶𛐱𛠹𜠴𛐱𛠳𝠷𛐴𛠲𞀱𛐲𛠳𜐴𨰭𝠮𝰶𜠭𜠮𝰲𜐭𜐳𛠹𝀶𛐸𛠳𜀱𛐱𝠮𜀴𜐭𜐲𛠴𝐴𨰭𜐮𜀴𝐭𜠮𜀷𛐲𛠴𝠭𝠮𝰲𜠭𜰮𜐴𝐭𜐰𛠳𜰳𫀭𜐮𜠴𝰭𝠮𝐶𞑨𛐷𛠷𜑬𛐰𛠰𝐲𛀸𛠸𜰶𨰭𜀮𜀶𝀬𜐱𛠱𝰭𜀮𝰷𝐬𜐶𛠴𝠳𛐲𛠵𝀳𛀱𞀮𞐴𞑣𛐰𛠷𝠹𛀱𛠰𞀭𜰮𝰲𝰬𜰮𝰵𞀭𝰮𜀳𝰬𜰮𞀵𜡣𛐷𝐮𝐸𜠬𜠮𜐳𝐭𝀵𛠱𝀹𛀲𛠶𝠸𛐱𝰸𛠳𜠲𛀱𛠸𝐷𫀭𜰮𞐵𞀭𜠮𜀲𜱣𛐷𛠰𜰱𛐳𛠵𞐶𛐸𛠱𝠲𛐵𛠸𜰲𛐸𛠴𞐵𛐱𝠮𞀱𜑬𛐰𛠲𞐴𛐹𛠶𝰷𫀷𛠴𜀳𛐹𛠲𞐵𨰭𜀮𝀰𝀭𜀮𜐲𝰭𝰮𜰴𝰭𜠮𝠲𞐭𜐵𛠴𜠸𛐵𛠵𝐵𫀭𜐴𛠶𞐲𛐵𛠳𜐸𫀭𜀮𜠹𝀬𜐷𛠷𞀳𨰭𜀮𝀰𝀬𜠴𛠴𞐶𛀰𛠹𝰷𛀳𜀮𞐴𜰬𝰮𞐷𝀬𜰷𛠱𞐹𠰱𞐹𛠶𞀶𛀴𝐰𛠷𝀸𛀲𜀴𛠶𜀸𛀴𝐲𛠶𛀲𜐲𛠲𝰳𛀴𝐳𛠳𞀱𮡆𡰱𝐴𛠲𝐶𛀴𜀴𛠰𜰳𨰭𞀮𝀰𞀬𜐱𛠲𜠷𛐱𜠮𜐶𜐬𜐴𛠹𜠸𛐲𜰮𜐷𝀬𜠲𛠸𝑣𛐹𛠷𝠹𛀷𛠰𜠳𛐱𜠮𝐳𜐬𞐮𝰱𝰭𜐲𛠵𜰱𛀱𜠮𜠱𞑣𜀬𜠮𜀱𜰬𜠮𞀴𝀬𝀮𜐲𝐬𝰮𜀹𜠬𝐮𜠷𜑣𝐮𞀸𞐬𜐮𝐸𝠬𜐵𛠵𜐲𛀰𛠶𝀳𛀲𜀮𝐹𜠭𜠮𜀲𜑣𜐱𛠵𝠵𛐶𛠰𝠱𛀱𝰮𞐸𜠭𜐸𛠰𝐳𛀱𞐮𝐱𞀭𜰶𛠴𝰹𫀰𛠶𞀸𛐸𛠲𝀸𫀭𜠮𞐹𜰭𜀮𞐳𝱃𜐶𜀮𝀸𝰬𜰹𝐮𝰶𝠬𜐶𜀮𜰸𞀬𜰹𝐮𞀴𝠬𜐵𝀮𜠵𝠬𝀰𝀮𜀳𜱺𡡇𝀶𝰮𝀲𞐬𝀲𝰮𜰴𜡣𝰮𜐲𞀬𝠮𝠷𞐬𜐳𛠹𝠱𛀱𜠮𝠴𛀱𝐮𜐸𜠬𜐳𛠲𝀶𨰲𛠹𜰵𛀱𛠴𝐹𛀳𛠸𞀹𛀱𛠴𜰳𛀶𛠴𝰷𛐰𛠱𞀸𨰴𛠷𞀳𛐲𛠹𞐶𛀷𛠲𜠲𛐱𝰮𜠷𝰬𜰮𞐲𝐭𜠲𛠹𞁣𛐲𛠹𜀷𛐵𛠰𜠴𛐱𞐮𜠶𞀭𜐲𛠱𜐹𛐴𞐮𝐱𛐲𜐮𝀷𜑬𛐶𛠸𞀳𛐲𛠱𜱬𛐱𛠸𞐶𛀲𛠷𞀹𫀭𜐮𞀹𝠬𜠮𝰸𞑬𜐰𛠸𜐸𛀷𛠹𜀲𠰴𝀹𛠵𞐶𛀴𜐱𛠶𝀵𛀴𝠰𛠲𞐸𛀴𜠰𛠶𝠴𛀴𝠷𛠴𜠹𛀴𜠷𛠳𝀲𮡆𡰲𝠹𛠷𝐴𛀳𞀷𛠰𝰸𨰲𜰮𜐵𝐬𞀮𝀷𝰬𝀳𛠱𝐳𛀲𜐮𜠰𜐬𝠱𛠰𜐹𛀳𞀮𞀲𝡣𝀮𝀲𞐬𝀮𜰶𞐬𞐮𝀴𜠬𞀮𝰱𝐬𜐱𛠱𝀶𛀹𛠶𝐳𨰵𛠱𞀸𛀲𛠸𝠹𛀹𛠷𜀲𛀱𛠰𝠸𛀱𜠮𞀵𝀭𝐮𜐲𝱣𜰮𜠱𝀭𝠮𜰱𝐬𜐮𞐸𞀭𜐲𛠴𝐲𛐳𛠸𝐭𜐹𛠲𞐹𨰭𝰮𝐵𝀭𞀮𞀵𝠭𜰵𛠵𜠳𛐱𞐮𝐰𞀭𞀱𛠰𜐳𛐳𜀮𞀵𜱣𛐵𛠷𞀭𜐮𝀴𜠭𝠮𜐸𛐱𛠳𝠴𛐷𛠲𜐷𛀱𛠴𜠱𠰲𝠱𛠷𞐶𛀳𞀴𛠱𜐱𛀲𝠱𛠹𝀱𛀳𞀴𛠲𜠱𛀲𝠹𛠷𝐴𛀳𞀷𛠰𝰸𮡆𡑄𡰴𝠷𛠴𜐲𛀳𝐳𛠰𝀷𨰭𜠮𜐵𝐬𜰮𝐸𜠭𝀮𞐵𛀳𛠸𜰭𜐵𛠲𝠬𜐮𜰶𜑣𛐸𛠷𝀵𛐲𛠰𞐶𛐸𛠲𞐲𛐲𛠱𝰲𛐸𛠲𞐲𛀱𛠴𜑣𜀮𜀰𜠬𜠮𝐲𝀬𜀮𞐱𞀬𜰮𝠶𝠬𝀮𞐲𜠬𝠮𜐲𜱣𝰮𜰷𝐬𝀮𝐲𝠬𜐳𛠳𞀸𛀱𜀮𝠰𞀬𜐵𛠳𞐸𛀱𝐮𝐷𞁬𜐮𝰹𝐬𝀮𝀳𝁬𜰮𜀴𛐱𛠹𜠴𨰴𛠸𝰸𛐳𛠰𞀸𛀱𜠮𝠶𜰭𜐳𛠰𝰸𛀱𝀮𜀱𝠭𜐷𛠹𝰹𨰰𛠹𜠳𛐳𛠳𝠬𜐮𜠴𜐭𜠸𛠹𜰷𛀱𛠲𝀱𛐹𞐮𝠰𞁣𜀭𞐴𛠸𜰳𛀰𛠰𜀸𛐹𝐮𜐰𝀬𜠮𜐸𞐭𞐸𛠹𝐳𨰱𛠲𜀵𛐲𛠱𜠳𛀲𛠰𜠲𛐴𛠰𜰲𛀱𛠸𜐳𛐴𛠲𜰹𨰭𜐮𜐳𝠭𜐮𜐴𜠭𜐹𛠸𜠸𛐱𜰮𜐰𜠭𜠰𛠰𜰳𛐱𜠮𞀱𞁣𜀮𜀲𝀬𜰸𛠴𝠴𛀲𛠳𜐸𛀷𝠮𞐹𝰬𜐮𜐳𝠬𜐱𝐮𝀹𝁃𝀶𞐮𜠵𞀬𜰴𝀮𜐹𝰬𝀶𞐮𜐲𞀬𜰵𜀮𜐹𝐬𝀶𝰮𝀱𜠬𜰵𜰮𜀴𝱺𡡇𝀶𜀮𜠵𞀬𜐸𝰮𝀱𝑣𛐰𛠸𜰳𛐰𛠸𜠸𛐱𞐮𝠳𝀭𜐲𛠹𞐸𛐲𜀮𜀸𛐱𜠮𞐹𞁣𛐰𛠲𝰶𛀰𛐰𛠲𜀶𛀱𛠳𞐶𛀰𛠱𝐸𛀳𛠱𜀴𨰰𛠸𞀬𝀮𜐴𜐬𜀮𝠷𜰬𜐳𝀮𝐶𞐬𜀮𝠷𜰬𜐳𝀮𝐶𞑬𛐱𛠲𜠲𛀱𜰮𝠲𝑬𝀮𜰶𞀭𜠮𞐱𝁣𜠮𝀰𜐭𜐮𝠰𝀬𝠮𜐳𞐭𝀮𜀳𜰬𞀮𜰰𝀭𝐮𝀰𝁣𜰮𜰹𜠭𜠮𜐴𜰬𜰮𞀳𜰭𜠮𞀷𜰬𜰮𜠰𝠭𝐮𜰰𝱣𛐲𛠵𜰹𛐳𞀮𜀹𛐰𛠲𝰹𛐷𝠮𝀶𝰭𜐮𝐴𝠭𜐱𝀮𝠰𝡬𜰮𜠳𝀭𝀮𞀶𝱃𝀵𞐮𜐳𝠬𜐸𞐮𞐳𞐬𝀶𜀮𝀴𜰬𜐸𝰮𝐹𞐬𝀶𜀮𜠵𞀬𜐸𝰮𝀱𝑺𡡅𡁇𜰲𝀮𞀷𜠬𜰳𝠮𝀷𝱣𜀮𞐱𝀬𜰮𜀴𞐬𜠮𜀷𜐬𝠮𝀱𝀬𜠮𝐷𝀬𝰮𝀷𝡣𜀮𝐰𜰬𜐮𜀶𜰬𜐮𝐶𜰬𜐮𞐳𝀬𜠮𜰵𝀬𜐮𞐳𝁣𜐮𞐰𞐬𜀬𝠮𝐴𜠭𞀮𝰳𜐬𝰮𜠸𞀭𜐳𛠷𜰹𨰰𛠵𜰭𜰮𝐷𞀬𜀮𜐸𞀭𝀮𜰹𝠭𜰮𝐱𜐭𞀮𜠲𜡣𛐷𛠵𞐹𛐷𛠸𝰭𜐸𛠴𝠴𛐱𜰮𜐳𜰭𜐸𛠴𝠴𛐸𛠹𜰸𨰰𛀰𛠴𝰵𛀱𛠸𜠱𛀴𛠲𝐸𛀴𛠰𝀷𛀸𛠴𜀶𠰳𜠱𛠳𞀹𛀳𜠷𛠵𜰵𛀳𜠳𛠹𝐷𛀳𜰳𛠴𜠴𛀳𜠴𛠸𝰲𛀳𜰶𛠴𝰷𮡆𡰳𜀵𛠵𞐹𛀳𜠲𛠰𝐹𨰭𝀮𞐭𜰮𞐱𞀭𝠮𜰱𞐭𝀮𝐶𝰭𝰮𞐳𛐳𛠶𜠹𨰭𜐮𜀷𞀬𜀮𝠲𞐭𜐮𝰲𞐬𜐮𝰲𝐭𜐮𝀴𝠬𜠮𝀳𝱣𝐮𝀸𝰬𜐳𛠸𝀬𝰮𝰴𝰬𜐹𛠸𜰸𛀷𛠷𝀷𛀲𜀮𝐵𝱣𜀬𜀮𝀸𝠬𜀮𝠸𞀬𜠮𝠸𜐬𜐮𝐳𝀬𝀮𞀷𞑣𜀮𞀴𜰬𜠮𜐹𝰬𜠮𜠰𝠬𜰮𞐹𝠬𜰮𜀲𝐬𜰮𞐹𝡣𜠮𜐳𝀬𜀬𝠮𝰲𞐭𞀮𝀲𜠬𝰮𜰵𛐱𜰮𝀶𝱃𜰱𝠮𝐰𜰬𜰳𜐮𝰸𝰬𜰱𝀮𞐱𝀬𜰲𞐮𝐰𝀬𜰰𝐮𝐹𞐬𜰲𜠮𜀵𞑺𡡇𜠶𝰮𞀰𜰬𜰲𜠮𜰸𞑬𛐲𛠹𜰸𛀰𛠸𜀳𨰭𜐮𝠱𝀬𜀮𝀴𜰭𜠮𞐸𜰬𜀮𞀹𛐳𛠰𝀱𛀰𛠹𞑣𛐰𛠰𝠬𜀮𜐰𜰭𜐮𜰳𝰬𜰮𜐶𝀭𜠮𞀴𜐬𝠮𞀰𝑣𛐱𛠵𜀲𛀳𛠶𝀲𛐵𛠰𜠸𛀱𜀮𝀳𞀭𝰮𞀳𝀬𜐵𛠱𜀵𨰭𜠮𞀰𞀬𝀮𝠶𝀭𝀮𞐴𝠬𞐮𜰶𝰭𝀮𝰵𝀬𜐰𛠴𝐱𨰰𛠱𞐲𛀱𛠰𞀶𛀱𛠴𞀴𛀲𛠶𛀲𛠸𝰴𛀳𛠳𝠳𨰳𛠴𝐳𛀱𛠹𜀲𛀵𛠰𜠷𛀱𛠷𝰱𛀸𛠸𜀷𛐰𛠷𜰶𨰵𛠴𞀵𛐳𛠶𝀶𛀸𛠰𝐲𛐱𜐮𜠶𝀬𞐮𜀸𜰭𜠶𛠹𝠵𣀲𝠷𛠸𜀳𛀳𜠲𛠳𞀹𮡆𡰲𞐲𛠰𞐸𛀳𝀹𛠴𝀳𨰵𛠴𜰴𛐱𜀮𞀷𝐬𝀮𝐸𜠭𜐴𛠱𜰳𛐶𛠱𜐷𛐲𜰮𝐰𞁣𛐶𛠳𞐴𛐵𛠶𜀱𛐷𛠷𝐸𛐶𛠳𝠷𛐹𛠵𜀸𛐵𛠳𝀹𨰭𜐮𜐲𜐬𜀮𝠵𝀭𜐮𞀲𛀱𛠷𝰲𛐱𛠵𝐲𛀲𛠴𞀳𨰰𛠸𝰱𛀲𛠲𞐱𛀷𛠳𞐷𛀲𜀮𞐸𝀬𞐮𜠱𞀬𜠶𛠳𞐶𠰲𞀶𛠴𝐴𛀳𝐶𛠳𝐲𛀲𞀸𛠶𝀶𛀳𝐶𛠳𝀶𛀲𞐲𛠰𞐸𛀳𝀹𛠴𝀳𮡆𡰳𝐸𛠴𜀱𛀳𜐳𛠴𜰹𨰰𛠱𜠳𛐱𛠷𝠬𜐮𜐳𞀭𝀮𜠶𝐬𜠮𜠵𞀭𝐮𝐶𜡬𜠮𜀳𝠭𜠮𜰶𫀭𝰮𜰲𝀭𝠮𝰶𝑬𛐷𛠳𜠳𛐶𛠷𝠲𫀭𝠮𜐷𝰬𝠮𝀴𝡨𛐲𞐮𝰹𜱶𛐸𛠸𜱨𜰷𛠶𜀶𫀭𝐮𞀳𝀭𝰮𝰲𜱣𛐳𛠲𜀹𛐴𛠲𝀸𛐶𛠲𜠭𝰮𝰲𜰭𝠮𝠸𞀭𝰮𝰲𜱣𛐰𛠴𝠷𛀰𛐲𛠶𜰸𛀰𛠹𞐴𛐴𛠸𜠲𛀲𛠲𜀵𨰭𝠮𜰹𝠬𜰮𜀵𜰭𜐳𛠴𝐳𛀲𛠰𝰴𛐲𜀮𜠶𝐬𜠮𜠰𝱶𛐹𛠹𜱨𜰷𛠶𝠹𫀭𞀮𞐳𝠭𜐱𛠳𜱬𛐳𛠴𜰴𛐴𛠱𝐸𫀭𝀮𝀸𞀬𜠮𜠲𝱣𛐳𛠳𜐳𛀱𛠶𝀵𛐶𛠶𜠴𛀲𛠲𜠷𛐱𜠮𝠵𛀲𛠲𜠷𪀭𞀮𜐶𜑶𛐹𛠹𜠹𪀲𜰮𞐳𞁨𜠳𛠹𝀱𫀭𜐰𛠲𝐷𛐸𛠹𜠵𫀭𜐰𛠲𝠭𞀮𞐲𝁬𛐵𛠰𞀷𛀳𛠴𜀷𫀭𝐮𜀸𝐬𜰮𝀰𞑨𛐲𞀮𞀸𝁨𛐲𞀮𞀸𝑬𛐶𛠷𜠴𛐳𛠳𜐹𨰭𜰮𝠹𝰭𜐮𞀲𝰭𝠮𞀵𜰭𜰮𜐸𜐭𝰮𜀱𛐳𛠰𜀹𨰭𜀮𜐵𞀬𜀮𜐷𜠬𜀮𜀹𜠬𝀮𜠷𜰬𜀮𝐵𝐬𞐮𜐱𜱣𜐮𜀸𛀱𜐮𜰬𜐮𜀵𞀬𝐱𛠵𝰷𛐰𛠰𜰹𛀶𝰮𜠲𞑣𛐰𛠴𝠷𛀶𛠶𝀷𛐰𛠷𝐬𜐲𛠱𝐷𛐰𛠶𜰱𛀱𜠮𜠴𞁣𜀮𜐱𞐬𜀮𜀸𞀬𝀮𜐸𛐰𛠳𜠬𞐮𜀲𝐭𜀮𞐰𝡬𞀮𞀱𜐭𜐮𜀶𜱬𜀮𜰱𛐳𛠴𝐹𫀰𛠳𜐭𜰮𝀵𝱨𜰲𛠹𜱨𜰲𛠹𜱬𛐰𛠰𜠷𛀱𜐮𜀳𜱣𛐰𛠰𜰵𛀱𝀮𝠵𞐭𜠮𜐵𜠬𜠲𛠲𞐳𛐷𛠹𜰴𛀲𞀮𝐸𞁣𛐵𛠶𝀱𛀶𛠱𝀳𛐱𜀮𜰳𞀬𝰮𜰶𝠭𜠸𛠱𜐹𛀷𛠳𝀲𨰭𝰮𝰴𜠭𜀮𜀱𛐱𝀮𜀷𝀬𜀮𝀰𝀭𜐴𛠰𝰴𛀰𛠹𜠴𨰰𛀱𛠴𞐴𛀲𛠲𜀷𛀲𛠹𜰴𛀶𛠵𞀶𛀴𛠲𞐳𨰷𛠸𜠶𛀲𛠴𜠸𛀱𝐮𞐶𝐬𞐮𝠳𞐬𜐷𛠹𞀬𜐵𛠹𜱣𜀮𜰹𞐬𜐮𜠵𜠬𞐮𝰹𝀭𜐮𞀰𜐬𜐵𛠹𝠳𛐵𛠱𞀸𨰸𛠸𞐹𛐴𛠸𞀵𛀱𝐮𝰰𞐭𜐱𛠸𝠹𛀱𞐮𜐶𝀭𜐹𛠶𝠲𨰲𛠹𜠳𛐶𛠵𞐲𛀶𛠱𝠶𛐲𜀮𝠸𝀬𝠮𜐶𝠭𜠶𛠷𞐷𠰳𝐷𛠶𝰳𛀳𜠴𛠴𞐸𛀳𝐸𛠳𜐶𛀳𜐴𛠶𝠴𛀳𝐸𛠴𜀱𛀳𜐳𛠴𜰹𮠠𣐲𝰵𛠷𝰷𛀲𝐱𛠳𝠱𫀰𛠳𜰭𜰮𜐲𞁨𜠱𛠲𝰷𭠸𛠸𜠸𫀭𜐰𛠴𜀲𛀰𛠳𜐴𠰲𝰵𛠶𝀳𛀲𝐷𛠷𜐹𛀲𝰵𛠱𜰹𛀲𝐷𛠴𝀹𛀲𝰵𛠷𝰷𛀲𝐱𛠳𝠱𮠠𣐲𞐷𛠸𞐳𛀲𞐸𛠴𜰹𪀭𜠲𛠲𞐱𭠭𞀮𞀳𪀲𜠮𜠹𜑖𜠹𞀮𝀳𞑺𘁍𜠹𝰮𜰸𝠬𜠷𞀮𜀲𜱬𛐲𜐮𜀷𝐭𜀮𜐴𞁣𛐰𛠹𝠸𛐲𛠹𝀷𛐰𛠶𞀭𝠮𜐳𜐭𜀮𝰰𞐭𞐮𜠳𪀲𜠮𝀰𞁌𜠹𝰮𜰸𝠬𜠷𞀮𜀲𜱺𡡅𡰳𝠵𛠱𜐶𤠳𛀵𝰮𜐸𝰬𜀮𜀶𜰬𝐷𛠱𞀷𫀳𛠲𜠷𣰲𢐵𢀹𛐸𛠵𝀶𨰲𛠳𝠷𣠸𛀴𛠰𜐸𛐵𛠶𜠸𛀸𛠵𝰸𛐷𛠳𜰬𜐰𛠱𜰹𨰭𜰮𝠳𜐬𜰮𜰲𝠭𜰮𜐰𝀬𜰮𞀴𝠭𞐮𞀸𛐹𛠶𝠸𫀭𝀮𜠸𞀭𞀮𝐵𜱨𜠱𛠹𜰵𤐸𦀴𢰱𤀵𫀭𜠮𞐲𛐴𛠱𜰷𨰭𜐮𝠰𝑕𝱓𜠬𜀮𜀸𜱬𛐰𛠰𝰹𛐱𝠮𜐵𫀲𜰮𜀲𜡊𦐴𛐴𛠶𞐴𫀭𝠮𜰳𜠭𝀮𝠹𝁶𝰸𛠴𜡨𛐶𛠷𞐱𪀭𝠮𝰹𜱬𜰮𞀸𝐬𝀮𜰳𜡃𜰶𜠮𜐱𜰬𜰱𝠮𜀸𝠬𜰶𜠮𞐸𞐬𜰱𝠮𝐴𜰬𜰶𝐮𜐱𝠬𜰱𝐮𝠶𝁺𘁍𜰸𜰮𝀰𝁗𞀬𜰲𛠶𝠷𨰱𛠷𝀶𛀲𛠸𜠬𜰮𜠷𝁔𜰸𜰮𜰸𜰬𜰵𝠮𝠲𝰬𜰸𜰮𝀰𝀬𜰱𝀮𝐸𜰬𜰸𜰮𝀰𝀬𜰱𝀮𝐸𜱺𡡅𙰬𛱄𛱧𛁄𚐬𛱅𛱧𛁅𚐬𛱆𛱧𛁆𚐬𛱇𛱧𛁇𚐬𛱈𛱧𛁈𚐬𛱉𛱧𛁉𚐬𛱊𛱧𛁊𚐬𛱋𛱧𛁋𚐬𛱎𛱧𛁎𚐬𛱏𛱧𛁏𚐬𛱐𛱧𛁐𚐬𛱑𛱧𛁑𚐬𛱒𛱧𛁒𚐬𛱓𛱧𛁓𚐬𛱔𛱧𛁔𚐬𛱕𛱧𛁕𚐬𛱗𛱧𛁗𚐬𛱘𛱧𛁘𚐬𛱙𛱧𛁙𚐠𚰧🀯𬱶𩰾𙰩𞰼𛱳𨱲𪑰𭀾').replace(/uD./g,''))) ``` ### Original HTML/JS [Demo](http://c99.nl/f/115183.html) Original HTML is ~~15039~~ 14182 ~~and pushes me over the size limit~~. The entire SVG has been reduced in complexity using parsing and substring searches replaced with the letters D and so on. ``` <script> function d(a){document.write(a)}; function r(a,b,c){return a.replace(b,c)}; D='<g>'; E='</g>'; F='"/>'; G='<path d="M'; H=',4.092,7.052,2.301c2.273-2.476,7.671-4.899,10.908-4.899c1.841,0,2.566-0.59,2.566-2.082c0-1.574-2.016-2.967-8.248-5.701c-13.227-5.807-23.164-13.982-23.164-19.059c0-1.607,8.525-6.173,15.95'; I='-4.514,5.503-6.133c-0.314-1.307,1.66,0.127,5.251,3.818c3.164,3.254,8.144,7.801,11.064,10.108c5.021,3.969,5.40'; J='-0.296l23.022-0.297l-5.762-8.254c-3.168-4.541-6.071-8.255-6.449-8.255s-2.347,2.371-4.377,5.271l-3.69'; K='-0.305v-15.445l21.001-0.299l21.001-0.299l-4.147-7.426c-6.226-11.145-5.641-10.877-10.19'; N='-0.756,4.306-1.53,4.306-1.727s-2.229-4.16-4.956-8.813l-4.958-8.462l-4.235,7.304c-2.32'; O=',4.437l3.226,4.436l7.71-6.021c4.24-3.313,10.413-7.842,13.716-10.063c4.644-3.121,5.89'; P='-4.654l-4.025,5.506h-23.713l0.156-16.187c0,0,9.811-0.366,21.283-0.366h20.85'; Q='c24.969,0,23.409,1.069,14.507-9.955l-4.778-5.918l-4.19,4.653l-4.18'; R=',315.664c1.356-0.563,2.697-1.021,2.978-1.021c0.038,0.376,0.06'; S='-3.035-2.771-3.035c-3.22,1.875-5.566,5.064-8.179,7.793l-23.60'; T=',5.615,3.396,6.215c0.18,0.891-15.211,8.006-15.609,7.213C'; U='-2.275-3.707-5.504-4.668-7.172c-0.961-1.67-2.20'; W=',314.583c0,0,8.866,27.05,12.34'; X=',4.654l-15.856-0.304l-15.85'; Y=',5.271l-27.793-0.132l-6.33'; d('<svg width="500" height="500">'+D); d(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r('DG408.997,122.382l3.629-2.032l-10.012-6.497l-10.009-6.497l-2.195,7.083c-2.958,9.552-8.487,20.773-14.003,28.416c-4.355,6.038-13.775,14.106-16.467,14.106c-1.68,0-1.755-0.338,1.861,8.345c1.729,4.151,3.555,8.729,4.06,10.174l0.918,2.628l3.079-2.823c1.695-1.553,2.253-3.035,8.304-4.512c6.57-2.126,17.534-4.232,19.088-3.667c0.664,0.242-2.23,5.356-6.649,11.744c-7.984,11.543-16.75,20.515-23.942,24.513l-4.021,2.23l2.822,5.478c1.553,3.012,3.536,6.505,4.409,7.765c1.581,2.29,1.583,2.29,5.064,0.121c4.438-2.765,10.479-4.206,26.281-6.271c6.966-0.912,14.321-1.902,16.349-2.202c3.173-0.472,3.769-0.204,4.293,1.928c0.602,3.25,0.421,6.658,1.686,9.72c1.433,2.916,2.298,2.712,6.408-1.512c6.831-7.014,5.967-13.847-3.337-26.405c-8.965-12.096-10.583-13.513-14.101-12.321l-2.938,0.995l4.938,9.333c2.719,5.134,4.939,9.727,4.939,10.207c-11.883,3.042-30.03,1.979-40.493-0.616c11.232-11.183,22.685-22.159,32.729-34.656c4.926-6.111,10.282-11.712,11.905-12.445c1.625-0.731,2.952-1.666,2.952-2.075c0-1.163-13.91-14.435-15.127-14.435c-0.598,0-1.084,0.441-1.084,0.98c0,0.54-1.685,5.007-3.74,9.931l-3.743,8.95h-15.509c-8.531,0-15.511-0.396-15.511-0.879C371.832,155.722,405.104,124.561,408.997,122.382zFG258.98,130.742c0.053,0.014,1.647-0.792,3.545-1.79c7.975-3.285-2.358-2.285,55.517-2.333l52.069-0.518l-10.669-10.107c-5.87-5.56-11.147-10.108-11.729-10.108s-5.587,2.333-11.124,5.184c-9.552,4.919-10.469,5.183-18.048,5.167l-7.983-0.018l3.958-2.316c2.174-1.272,4.808-3.489,5.847-4.924c5.623-7.761-5.982-19.346-28.117-28.067c-8.884-3.5-9.777-3.59-13.149-1.33l-2.516,1.685l8.925,8.95c4.908,4.921,10.896,11.744,13.305,15.16c2.41,3.415,5.583,7.258,7.053,8.539l2.671,2.327l-65.431,0.01L258.98,130.742zFG186.128R2,57.187,0.062,57.187l3.226O1I6H8-8.546c2.368N9,4.018-5.628,8.578-7.331,10.139c-3.63,3.326-3.103,3.846-9.879-9.668l-4.288-8.553h21.934Q9X5K2P6l-2.92-4.137c-1.606U8S1,0.083l-0.079-16.15l23.023J1Y3-4.694l-6.333-4.694v78.42h-6.791h-6.792l3.884,4.332C183.125,316.086,184.001,316.543,186.128,315.664z M204.417W7,32.667c1.747,2.82,3.275T204.395,356.627,204.417,314.583,204.417,314.583zFG261.965,181.771c1.221,9.539,1.402,12.767,1.438,25.451c0.021,7.555,0.445,13.736,0.945,13.736l17.965-4.775l46.482-0.927l0.329,2.951c0.243,2.176,0.775,2.827,2.026,2.48c17.15-4.759,18.48-5.351,17.973-8.02c-0.273-1.428-0.788-4.786-1.147-7.462l-0.65-4.867l5.256-3.307c4.265-2.687,4.999-3.544,3.904-4.574c-5.08-4.773-18.053-15.041-19.002-15.041c-0.636,0-3.405,1.167-6.154,2.591c-4.897,2.54-5.468,2.592-28.083,2.591c-21.454,0-30.73-0.863-40.001-3.72C261.818,178.44,261.602,178.93,261.965,181.771z M282.587,194.416l46.771-0.173l-0.059,10.129h-46.714L282.587,194.416L282.587,194.416zFG132.747,117.241c5.765,0,14.563-3.956,18.616-8.368c5.548-6.042,7.219-12.919,7.151-29.423l-0.058-14.067l290.407,0.713c-5.424,10.956-12.065,21.715-19.278,31.285c-0.598,0-2.317-0.685-3.823-1.522c-6.836-3.802-53.454-19.196-54.545-18.01c-0.255,0.278-0.558,1.815-0.671,3.417c-0.188,2.659,0.501,3.226,8.055,6.619c28.843,12.951,58.013,34.96,66.693,50.322c1.543,2.73,3.762,6.105,4.927,7.498c2.953,3.523,6.4,2.758,10.109-2.247c3.724-5.028,4.797-13.614,2.451-19.628c-2.584-6.627-9.453-13.933-16.926-18.004l-6.975-3.799l8.284-8.739c15.736-16.604,30.355-25.762,47.054-29.475l5.333-1.186L466.338,26.51l-19.287,25.631l-131.934-0.837c0-0.46,0.95-1.485,2.108-2.273c1.162-0.79,3.008-3.638,4.102-6.331c2.848-7.014,1.793-11.743-3.981-17.855c-5.167-5.468-21.688-14.674-36.105-20.121c-8.871-3.351-9.092-3.378-10.965-1.339c-1.873,2.04-1.717,2.346,7.752,15.212c9.431,12.81,16.824,26.532,16.824,31.215v2.329l-136.913-1.104c-0.07-0.606-0.209-1.476-0.309-1.931c-0.747-6.734-1.197-13.502-1.782-20.254l-8.098,0.669l-2.87,12.137c-4.672,19.751-12.426,37.031-21.287,47.445c-8.19,9.624-11.13,19.299-7.177,23.606C118.529,115.012,126.565,117.241,132.747,117.241zFG497.863,453.926c0,0-6.328,1.162-11.621,1.771c-53.488,6.135-95.518,8.235-164.648,8.235c-92.593,0-150.715-4.537-186.435-14.549c-21.072-5.908-37.036-18.377-43.876-34.272l-2.732-6.346l-0.556-207.73l8.155-6.395c4.486-3.517,8.03-6.792,7.876-7.278c-0.553-1.763-29.472-28.583-30.439-28.232c-0.547,0.199-4.038,5.058-7.757,10.798l-6.765,10.436l-28.088,0.552l-28.089,0.551l9.016,9.771l9.016,9.771l8.486-2.245c12.449-3.293,19.834-4.607,25.896-4.607h5.386v208.28L0,454.15l27.968,27.782c0.589-0.797,6.647-11.381,13.463-23.516c6.816-12.139,14.04-24.721,16.056-27.961c4.235-6.812,10.905-13.735,12.644-13.133c0.658,0.229,6.095,8.291,12.084,17.92c12.337,19.834,13.402,21.227,20.836,27.254c22.951,18.607,65.076,28.838,128.873,31.293c74.453,2.68,148.922,4.115,223.418,3.92l1.873-5.76c3.664-11.26,17.123-22.103,33.396-26.896l6.779-2v-4.248C497.389,456.469,497.863,453.926,497.863,453.926zFG67.377,99.175c3.615,13.117,7.038,20.628,10.361,22.734c4.389,2.782,9.84,0.074,15.801-7.847c6.25-8.306,9.067-16.414,9.077-26.118c0.018-20.292-12.427-36.144-44.859-57.137c-7.896-5.112-24.133-14.715-24.878-14.715c-1.627,1.909-3.001,4.063-4.373,6.208l5.627,7.655C50.934,52.805,59.531,70.706,67.377,99.175zFG173.771,362.742l0.52-190.884l3.063-2.758l3.062-2.759l-7.109-7.678l-7.108-7.678l-3.356,3.542c-3.192,3.369-3.737,3.542-11.244,3.542c-6.402,0-9.319-0.623-15.48-3.311c-4.175-1.82-8.006-3.31-8.513-3.31c-0.549,0-0.621,11.039-0.176,27.31c0.955,34.97,0.958,91.285,0.006,111.164c-1.267,26.447-4.287,49.291-9.586,72.48c-3.079,13.479-3.482,16.498-2.39,17.932c0.721,0.947,1.631,1.721,2.021,1.721c1.117,0,8.793-15.195,12.104-23.961c5.931-15.701,10.866-37.443,12.781-56.309l0.701-6.898h17.026l-1.326,55.17c-1.423,3.031-2.515,3.168-13.619,1.717c-6.279-0.819-6.333-0.807-6.333,1.927c0,1.928,2.073,5.016,6.923,10.313c4.599,5.021,7.539,9.328,8.759,12.826c1.563,4.484,2.151,5.162,3.969,4.582c5.182-1.656,9.604-6.027,12.419-12.273L173.771,362.742z M160.092,286.059h-17.225v-55.169h17.225V286.059z M160.092,222.062h-17.225V169.1h17.225V222.062zFG293.07,161.867l-28.633,0.519l9.645,13.688l4.053-1.601c9.032-3.139-3.802-2.639,40.807-2.178l36.75-0.577l-9.136-9.302l-9.138-9.302l-15.717,8.237L293.07,161.867zFG222.14,68.533l-13.546,14.79c-10.902,11.906-16.242,16.731-27.367,24.737c-13.609,9.792-34.075,21.463-47.984,27.362c-8.677,3.68-8.933,3.929-7.692,7.482l0.995,2.851l11.961-3.866c26.478-8.556,46.305-17.892,73.013-34.374c22.589-13.94,23.673-14.466,32.708-15.858l8.12-1.25l-15.104-10.938L222.14,68.533zFG346.897,139.838c-4.937-4.418-9.556-8.035-10.266-8.035c-0.711,0-4.132,1.274-7.604,2.83c-6.304,2.824-6.376,2.832-36.464,3.368l-30.149,0.54l9.534,13.669L280.5,149c20.153-0.787,75.367-1.13,75.367-1.13L346.897,139.838zFG191.97,200.99l-7.131,5.135l3.792,7.141c2.085,3.927,4.154,7.11,4.598,7.071s2.631-0.968,4.859-2.064c4.674-2.301,15.125-4.473,32.423-6.736c6.687-0.875,12.5-1.596,12.919-1.602c0.418-0.005,0.76,1.944,0.76,4.333s0.445,5.615,0.988,7.172c1.354,3.878,2.733,3.569,7.275-1.629c3.089-3.538,3.895-5.307,3.886-8.552c-0.012-5.345-4.213-13.069-12.353-22.718c-6.06-7.182-6.586-7.55-9.729-6.798l-3.324,0.795l2.109,3.488c2.306,3.813,8.108,15.761,8.108,16.697c0,0.321-9.46,0.571-21.024,0.557l-21.024-0.027l5.573-5.173c9.319-8.649,25.171-25.794,30.967-33.491c3.499-4.647,7.001-8.021,9.703-9.348l4.227-2.077l-7.502-7.476c-4.127-4.112-7.962-7.478-8.522-7.478c-0.56-0.001-2.04,2.853-3.289,6.343c-1.25,3.49-3.177,7.958-4.286,9.931l-2.016,3.586h-15.214c-8.367,0-15.214-0.389-15.214-0.863c0-1.57,32.485-31.646,36.547-33.836c2.19-1.181,3.977-2.423,3.971-2.758c-0.01-0.471-16.511-11.646-19.253-13.038c-0.314-0.159-1.139,2.018-1.831,4.838c-4.399,17.911-17.597,37.768-28.624,43.065c-2.208,1.061-3.893,2.242-3.744,2.625c0.147,0.384,2.041,4.976,4.206,10.205l3.936,9.507l3.157-2.587c1.735-1.424,1.981-2.978,7.862-4.304c5.551-2.023,17.526-4.417,19.151-3.827c1.393,0.506-8.597,15.994-15.084,23.384C201.226,193.434,195.893,198.165,191.97,200.99zFDG212.273,453.381c3.344,0.342,48.484,0.586,100.309,0.541c104.205-0.092,103.413-0.051,118.041-5.967c5.849-2.363,13.173-7.344,13.173-8.955c0-0.326-1.924-1.367-4.281-2.314c-6.762-2.721-13.946-8.301-16.041-12.454c-1.045-2.07-2.46-6.722-3.145-10.333l-1.247-6.569h-7.71l-0.052,8.836c-0.064,11.17-0.775,16.463-2.543,18.949c-0.769,1.08-3.727,3.758-7.037,3.852c-75.582,2.135-45.149,2.668-178.322,1.857l-3.958-2.023c-7.031-3.596-8.162-5.832-8.495-16.811l-0.294-9.677l7.403-9.295c-0.404-0.127-7.347-2.629-15.428-5.555l-14.692-5.318l-0.294,17.783c-0.404,24.496,0.977,30.943,7.974,37.199C199.686,450.748,204.608,452.6,212.273,453.381zFG154.256,404.033c-8.408,11.227-12.161,14.928-23.174,22.85c-9.769,7.023-12.531,9.717-12.531,12.219c0,2.013,2.844,4.125,7.092,5.271c5.889,1.586,15.512,0.643,20.592-2.021c11.565-6.061,17.982-18.053,19.518-36.479l0.688-8.248l-2.993-0.937C160.487,395.766,160.388,395.846,154.256,404.033zFG467.429,427.342c7.128,6.679,13.961,12.64,15.182,13.246c2.935,1.459,3.889,1.433,6.477-0.188c4.783-2.996,7.222-17.277,3.925-22.98c-2.907-5.024-19.268-12.119-49.51-21.471l-6.883-2.13l-1.896,2.789l-1.896,2.789l10.818,7.902C449.596,411.645,460.298,420.664,467.429,427.342zFG269.754,387.078c23.155,8.477,43.153,21.201,61.019,38.826c4.429,4.369,9.442,8.715,11.146,9.653c5.188,2.869,9.702,1.068,12.854-5.127c3.214-6.315,1.988-12.452-3.85-19.299c-7.554-8.856-35.523-19.508-81.013-30.853c-5.78-1.442-6.18-1.364-7.217,1.421C261.796,384.111,261.941,384.221,269.754,387.078zFEDG467.412,353.047c-2.155,3.582-4.95,3.83-15.26,1.361c-8.745-2.096-8.292-2.172-8.292,1.41c0.002,2.524,0.918,3.666,4.922,6.123c7.375,4.526,13.388,10.608,15.398,15.578l1.795,4.434l3.04-1.924c4.878-3.088,12.663-13.078,14.016-17.979c0.923-3.36,1.241-28.937,1.241-99.608c0-94.833,0.008-95.104,2.189-98.953c1.205-2.123,2.022-4.032,1.813-4.239c-1.136-1.142-19.828-13.102-20.033-12.818c0.024,38.464,2.318,76.997,1.136,115.494C469.258,344.197,469.128,350.195,467.412,353.047zFG460.258,187.415c-0.833-0.828-19.634-12.998-20.08-12.998c-0.276,0-0.206,1.396,0.158,3.104c0.88,4.141,0.673,134.569,0.673,134.569l-1.222,13.625l4.368-2.914c2.401-1.604,6.139-4.033,8.304-5.404c3.392-2.143,3.833-2.873,3.206-5.307c-2.539-38.09-0.279-76.467-1.546-114.606l3.234-4.867C459.136,189.939,460.443,187.599,460.258,187.415zFEDG324.872,336.477c0.914,3.049,2.071,6.414,2.574,7.476c0.503,1.063,1.563,1.934,2.354,1.934c1.909,0,6.542-8.731,7.288-13.739c0.53-3.578,0.188-4.396-3.511-8.222c-7.599-7.87-18.464-13.133-18.464-8.938c0,0.475,1.821,4.258,4.047,8.406C321.389,327.535,323.957,333.424,324.872,336.477zFG305.599,322.059c-4.9-3.918-6.319-4.567-7.93-3.629c-1.078,0.629-1.729,1.725-1.446,2.437c5.487,13.84,7.747,19.838,7.747,20.557c0,0.486,0.688,2.681,1.534,4.879c0.843,2.197,2.206,3.996,3.025,3.996c2.134,0,6.729-8.422,7.35-13.467C316.503,331.787,314.914,329.504,305.599,322.059zFG267.803,322.389l-2.938,0.803c-1.614,0.443-2.983,0.89-3.041,0.99c-0.06,0.103-1.337,3.164-2.841,6.805c-1.502,3.642-5.028,10.438-7.834,15.105c-2.808,4.664-4.946,9.367-4.754,10.451c0.192,1.086,1.484,2.6,2.874,3.363c3.453,1.902,5.027,1.771,8.807-0.736c5.485-3.646,8.052-11.264,9.083-26.965L267.803,322.389zFG292.098,349.443c5.434-10.875,4.582-14.133-6.117-23.508c-6.394-5.601-7.758-6.367-9.508-5.349c-1.121,0.654-1.82,1.772-1.552,2.483c0.871,2.291,7.397,20.984,9.218,26.396C286.454,356.352,288.646,356.346,292.098,349.443zFG358.401,313.439c0.123-1.76,1.138-4.265,2.258-5.562l2.036-2.36l-7.324-6.765l-7.323-6.762l-6.177,6.446h-29.793v-8.83h37.606l-5.834-7.723c-3.209-4.248-6.22-7.723-6.688-7.723c-0.467,0-2.638,0.994-4.822,2.205c-6.396,3.053-13.453,2.074-20.265,2.207v-9.93h37.669l-8.936-11.33l-3.434-4.158l-4.488,2.227c-3.313,1.645-6.624,2.227-12.65,2.227h-8.161v-9.929h23.938h23.941l-10.257-8.925l-10.26-8.924l-5.087,3.407l-5.085,3.409h-28.884h-28.885l-6.724-3.319c-3.697-1.827-6.853-3.181-7.01-3.009c-0.158,0.172,0.092,4.273,0.555,9.113c1.08,11.3,1.058,51.577-0.039,67.229c-0.467,6.647-0.75,12.157-0.631,12.248c0.119,0.088,4.18-0.32,9.025-0.906l8.811-1.063l0.31-3.459l0.31-3.457h32.93h32.93l-0.027,11.033c-0.035,14.659-2.152,22.293-7.934,28.588c-5.641,6.143-10.338,7.366-28.119,7.342c-7.742-0.01-14.074,0.404-14.074,0.924c0,1.494,2.207,2.934,6.586,4.293c7.826,2.428,15.965,9.639,17.98,15.93c0.399,1.252,9.794-1.801,15.963-5.188c8.899-4.885,15.709-11.869,19.164-19.662c2.923-6.592,6.166-20.684,6.166-26.797C357.673,324.498,358.316,314.664,358.401,313.439z M275.777,251.361l0.33-3.128h21.277v8.828l-10.402,0.314C275.643,257.719,275.139,257.449,275.777,251.361z M297.893,298.439h-22.291v-8.83h22.291V298.439z M297.386,278.023l-21.075-0.148c-0.968-2.947-0.68-6.131-0.709-9.23h22.408L297.386,278.023zFEG365.116R3,57.187,0.063,57.187l3.227O2I5H9-8.546c2.367N8,4.018-5.628,8.578-7.33,10.139c-3.631,3.326-3.104,3.846-9.88-9.668l-4.288-8.553h21.935Q8X4K1P5l-2.92-4.137c-1.605U7S2,0.083l-0.079-16.15l23.022JY4-4.694l-6.332-4.694v78.42h-6.791h-6.793l3.885,4.332C362.113,316.086,362.989,316.543,365.116,315.664z M383.404W8,32.667c1.746,2.82,3.274T383.383,356.627,383.404,314.583,383.404,314.583zFE',/D/g,D),/E/g,E),/F/g,F),/G/g,G),/H/g,H),/I/g,I),/J/g,J),/K/g,K),/N/g,N),/O/g,O),/P/g,P),/Q/g,Q),/R/g,R),/S/g,S),/T/g,T),/U/g,U),/W/g,W),/X/g,X),/Y/g,Y) +'</svg>');</script> ``` [Answer] # PHP - 8559 bytes ``` <?=bzdecompress(base64_decode('QlpoNDFBWSZTWdSo/LUAHHqfgHAH//eep8+gP+/f8GAhS2wAAL7K61KUEAAoAAAAbyi7iguBVSd5u8WPd4errOG807iquDhwDGzoHAIEHajpwV2wB13aHenBEjCUCEyaBNI9SZNTTNEM0m1MNTTaj0g1PE0FKKiNQA0AAAAaAA00ymik0/UFPUG1PSeSB6gAABoCU9IiEaRTRlBk0AaAAAAHMAAAAAAAAAACU0EyERSTSANAAAAABw5/tTsUOERE21057vtLkv5A8PTxbDA4XF1cVWJCiMfnwP5ZQNG7dCZ7bwZu77Bdbm7BpgalVTou2BRuh8QBG0V0WBsxoakTN7QxQfGbfTVUD0922556qfZ9akeiiIh+qJ9Ppu6IJJQ4udCcb5h/WrhV/2G5kz+fto3hOXOUo+4WXs50IoQaGcEvW5pe8jc7sZvSEHhs3UEtHd8d2anIwk0art2xa5C+lg0uszkiNs8bPFYRndLDboi1aWwdgvXJ7JgOZgKMwYEigQijl7WVlYNybKo2d2naBG1ovRQdR2x1duPmllQ0aPC115Rwws1AbOcTZOY3L0JWCr3KDaNxe2uznDK570ZKt1EssJI9gjwIigqRfDhMPEENogkt563xdt3VS+ojKloeSPWICneuLhqFLuQC3qo2OhgDqwxKWAuiiKUzpu4CG2HQhoarm3jyXdbgjqxdDLJ3W5K3AzW5h9l2KokmKIm7vVdm69Qs4yhNCmAMZdSOtBovDqqpBViyamVuK8V5asjQteoL2xisI0ka1rW3stZBlLKF3Vb4ddHicziTUmOaoDwa3RcpjEKg3wLsKYtvITbGUMyNXgtVNc7OgvorNLjgbPDBojlEK+e4FLrHrB0VFfmHZm5kdSBQU7EE0SNkOhl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PF0PNtzOwmduzhNvPVr1um95JSJq8/8XckU4UJDUqPy1')); ``` [Answer] ## Java - 9711 ~~9826~~ bytes ``` import java.io.*;import java.util.zip.*;class b{public static void main(String[]v)throws Exception{ByteArrayInputStream c=new ByteArrayInputStream(java.util.Base64.getDecoder().decode("UEsDBBQACAAIAPG9YUUAAAAAAAAAAAAAAAAAAAAA1Zttj1zHcYX/ymY/z8x2V78Lkgx4bRgB6MRAHAX5KI8YLeGJJIgy5fjX5zynZynuRDKSODaQDyRvz9y5t1+qTp06Vfz4Z3/898vdu9ffvn3z9Vef3OdTur97/dX56y/efPXlJ/d/+O7fjvP+Z59+/He/+MfH3/7rb3559/bdl3e/+eefv/r7x7v748PDv5THh4df/PYXd//02a/u8ik/PPzyH+7v7p++++6bjx4evv/++9P35fT1t18+/Orbz795enN++6AbH7hRP3rQw3I+ffHdF/effsyDP5hGvr9788Un9/o07u80xa/efqTrT37kyZFS4knX2/4bt3z0x8ubr37/YzfmtdaDv9Wtn9ynb/54f/cf13+/f/PFd0+f3Lfk0dPrN18+ffd++O7N6+9//jU/uUt3+ow/bOTnv7u8Pv7u8/Pvv/z26z98pQV99fr7uxf3aEYfvf3m8/PrT+6/+fb129ffvnut3fjy04+/+fy7pzv94tc1zdNa45AjTmXGpZx6rGOcUonLMadTynHsp7rGHqX1PIpTXu0wTmmWswarzcM6tRbHeapzHCKdxijHXPWbcgh9mPv5WE+ltUPX0+cxF93RDrojp37Memwf19H5mE99HpL+Ga0d06mUecin2fNhnkptZ30e66B7Wz4UvbXp8/1J6gfNM496SaeV5yG0nqlVpcGqZhT9tq+mJ7emeZ2ilaO+LTyhpKoZthznfmqDFYaeNk6t8HmUOOSl9U79oPdxTvq7HtIpaujeKIem1XXtT6/rINMbtZ6P47RmZdRqYZFasbam5XaMclo1DsEby0UvSJGZULkwz9DT6pjnPc/CObDS0rV7LTWttKal7R+d3WjTP9VrdVn2ZdNeML0c+ay7tePB3WxP1WZoQdqr6KeYWXOOkbXq1fuRfQ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uUnu252DVJ86bBT5eqUKLnZSpEpwzR23uNoobsb8gpelBSuOtR8Pe99f27E3vWO5gaBa8pToRki5m7bc7yezqnxN3e0Lx36dM+hoxJtW8xTAfKHy/FUwqfD35ctgu3akM+f/7lBjLVGmbF1nKMY2evBtet53o2RBHr+E8b+7yQI29eOaVI3UhmsqsaWgaBwwygI33seQPsomtRVt+nQY1agEORsdZdaYfW4a5hA0iS1XBJwruaP8GOrQzKAsPxuh9+q6uqW9zTtSc8u9jzdcT3osshOARBldrNt70FuZcdQjsgaWRahpz4PUCkVMdowOSrOoWFwk45zRw6ymxu/p6NrNPrGD9HMuzkTW1RMWmKVmL0jg9k99C7+oYs88isnrW34v1UwtkbWqHbt8QdP5T3UhJG9RHT15qejzzBfwWEPPrt+eb29TGqCqJhl66Our+Q6d8upaV7dbVjuxkbXY/8Ek36iEvtXN895z7N+QMJOhbf/RX3o5cM+9PJhH/r4a/Shx9+0D739/+1DXx/0oY+/Sh/6/Ik+9Bdt6PmDPvT6Qx/6/Mk29PaXt6HPP9OGXv86bej5/7ANvf3XNvT2P2xDH39RG3r8ZBt6/C3a0H+6C71+2IUeP9mFXtyF3q5d6NTaM42h1y50xou069qFfgOCwt8yi7XYP9uFPj/sQu8/dKHX/20XOm8t/Pe7axf6zSxux+/RnP+a++l/AlBLBwjlYHdd6RoAAIk8AABQSwECFAAUAAgACADxvWFF5WB3XekaAACJPAAAAAAAAAAAAAAAAAAAAAAAAAAAUEsFBgAAAAABAAEALgAAABcbAAAAAA==".getBytes()));ZipInputStream z=new ZipInputStream(c);byte[]a=new byte[15498];z.getNextEntry();for(int j=0;j<15498;j++){a[j]=(byte)z.read();}a[15497]=0;System.out.print(new String(a));}} ``` ``` I felt free to remove the comment in the original svg, removed some whitespaces and saved it 115 bytes because of being better to compress. ``` Tried to make it as short as possible. Seems like I need a better compression algorithm but I think it's good enough for my second post on StackExchange. Ungolfed source (for understanding the code): ``` import java.io.*; import java.util.zip.*; class b { public static void main(String[] v) throws Exception { ByteArrayInputStream c = new ByteArrayInputStream( java.util.Base64 .getDecoder() .decode("UEsDBBQACAAIAPG9YUUAAAAAAAAAAAAAAAAAAAAA1Zttj1zHcYX/ymY/z8x2V78Lkgx4bRgB6MRAHAX5KI8YLeGJJIgy5fjX5zynZynuRDKSODaQDyRvz9y5t1+qTp06Vfz4Z3/898vdu9ffvn3z9Vef3OdTur97/dX56y/efPXlJ/d/+O7fjvP+Z59+/He/+MfH3/7rb3559/bdl3e/+eefv/r7x7v748PDv5THh4df/PYXd//02a/u8ik/PPzyH+7v7p++++6bjx4evv/++9P35fT1t18+/Orbz795enN++6AbH7hRP3rQw3I+ffHdF/effsyDP5hGvr9788Un9/o07u80xa/efqTrT37kyZFS4knX2/4bt3z0x8ubr37/YzfmtdaDv9Wtn9ynb/54f/cf13+/f/PFd0+f3Lfk0dPrN18+ffd++O7N6+9//jU/uUt3+ow/bOTnv7u8Pv7u8/Pvv/z26z98pQV99fr7uxf3aEYfvf3m8/PrT+6/+fb129ffvnut3fjy04+/+fy7pzv94tc1zdNa45AjTmXGpZx6rGOcUonLMadTynHsp7rGHqX1PIpTXu0wTmmWswarzcM6tRbHeapzHCKdxijHXPWbcgh9mPv5WE+ltUPX0+cxF93RDrojp37Memwf19H5mE99HpL+Ga0d06mUecin2fNhnkptZ30e66B7Wz4UvbXp8/1J6gfNM496SaeV5yG0nqlVpcGqZhT9tq+mJ7emeZ2ilaO+LTyhpKoZthznfmqDFYaeNk6t8HmUOOSl9U79oPdxTvq7HtIpaujeKIem1XXtT6/rINMbtZ6P47RmZdRqYZFasbam5XaMclo1DsEby0UvSJGZULkwz9DT6pjnPc/CObDS0rV7LTWttKal7R+d3WjTP9VrdVn2ZdNeML0c+ay7tePB3WxP1WZoQdqr6KeYWXOOkbXq1fuRfQsOokTWNq2kQdeus3+R4ly0u+XIQ5jR6EvXkapmFKtoAismW5P4NpomULUubUrjCPvsMpMRmnMtTHTl7ulyUkPvlRmkyen4FGbJ2sGUq1az+sBmZh3a/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qfD35ctgu3akM+f/7lBjLVGmbF1nKMY2evBtet53o2RBHr+E8b+7yQI29eOaVI3UhmsqsaWgaBwwygI33seQPsomtRVt+nQY1agEORsdZdaYfW4a5hA0iS1XBJwruaP8GOrQzKAsPxuh9+q6uqW9zTtSc8u9jzdcT3osshOARBldrNt70FuZcdQjsgaWRahpz4PUCkVMdowOSrOoWFwk45zRw6ymxu/p6NrNPrGD9HMuzkTW1RMWmKVmL0jg9k99C7+oYs88isnrW34v1UwtkbWqHbt8QdP5T3UhJG9RHT15qejzzBfwWEPPrt+eb29TGqCqJhl66Our+Q6d8upaV7dbVjuxkbXY/8Ek36iEvtXN895z7N+QMJOhbf/RX3o5cM+9PJhH/r4a/Shx9+0D739/+1DXx/0oY+/Sh/6/Ik+9Bdt6PmDPvT6Qx/6/Mk29PaXt6HPP9OGXv86bej5/7ANvf3XNvT2P2xDH39RG3r8ZBt6/C3a0H+6C71+2IUeP9mFXtyF3q5d6NTaM42h1y50xou069qFfgOCwt8yi7XYP9uFPj/sQu8/dKHX/20XOm8t/Pe7axf6zSxux+/RnP+a++l/AlBLBwjlYHdd6RoAAIk8AABQSwECFAAUAAgACADxvWFF5WB3XekaAACJPAAAAAAAAAAAAAAAAAAAAAAAAAAAUEsFBgAAAAABAAEALgAAABcbAAAAAA==" .getBytes())); ZipInputStream z = new ZipInputStream(c); byte[] a = new byte[15498]; z.getNextEntry(); for (int j = 0; j < 15498; j++) { a[j] = (byte) z.read(); } a[15497] = 0; System.out.print(new String(a)); } } ``` [Answer] ## Python 2.7, 9279 bytes ``` import zlib,base64 print zlib.decompress(base64.b64decode('eJzdnOuPW9d1xb/nr2DnWwGSc94Pw07QTIIggNIGaOqiHx1a1QhlJUGSJdd/fddvHY6GpEfuI3ULNEAtHs7lveex99prr71vf/Hlr77/1+Pmw/O3716+fvXVTdyHm83zV4fX37589eKrm+/e//Nu3Pzql7/48q92u83vnr96/vab96/ffrH5m29f//n55vfH43fv3vurTaz7sE/bzd9//bvNb79/8/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HB3ZMKtvFHNGylqw59+mlFkcNlg8JxI0OaD+fVHl4AWWW86iacU6Za4GDKj9y0a6YyrKPg3H7BZspQhluPHWIvkyL0OE6pzseP/T4nnyj/PS59dRVCbUC8iwa7sEQe8SccMDsgla17QK7i5mqhhvzwatl6bY6SzOmNDXJxEk9stKQlJUKDu2EaAv0w4O0PaoJllmV7tJRmaBV5t9/iunxyJ9sCLJLpOV2Q03UuJ9/+ChSx3CgLSq4iGW6Wyj+bNeUxDoP3AnCV4bc+Og1P0dkYmt7q429nRSY/Ppm+NxQAVs+CiaXlYYBgrqhXu6lktm4CCx68C+PoRy56BTb0b/bKGy3bVJ3vcHQ2yTRotFdOfTGND+Sc6+Ufl8kR0+64hfWJ2v2+GGPLsZXi7xqfPYKH0mKBsKqcQtO43/nc44Kn+zX4+vTHHy4msH6bBxV0hPW8tHvXFmMZq4/ddLmsvku/IYKezDYLy337Esazq/s8wUofIbrROdH+otdl8vnrMvn8dZn+s74uk/5vXpep/59el5lnr8v0n/d1mfGZ12Uu3paJZ6/LlMfXZcZn35Y5K2/8xW/LjJ94W6b8zG/LxJ/jbZn647dl6n/xbZn+P/O2TPrs2zLpf/Vtmc+/LFPOX5ZJ//HLMtkvy9TTyzK0uES6zU8vyzCeJLmnl2WucFaBIo/sMsBPviwznnxZpj2+LFP+uy/L8PjMq82nl2WupnM9dgxx/PiS/xcKv/x3EiRdig==')) ``` ]
[Question] [ I haven't been on PP&CG for a while, so I thought I would post something! Your task is to find how "smooth" a *natural* number is. Your method is to: 1: Convert the number to binary 2: Find the number of changes / switches 3: Find the length of the string (in binary) 4: Divide length by changes So, an example. 5. Starting at step one, we wind up with 101 for binary. Step two is where we count the "switches". This is how many times a digit changes, so 100001 would count 2 switches. 101 counts 2, too. Step three has a length of three in binary. Step four gives us 3/2, or 1.5. Doing this for 10 is also simple: Step one results with 1010, two with three, three with four, and a final result has 1.33333333... repeating. If the inputs output infinity (examples: `1`, `3`, and `7`), you need to output something that tells you infinity, like \$\infty\$ or `Infinity`. Now, you might ask, "*what about scoring?*" or something like that: You are scored in characters, so feel free to use a lot of code golfing languages. (*I'm looking at you, Jelly*) If you round the output "smoothness factor" to 3 decimal places (4/3 is now 1.333, 5/3 is 1.667) your score is now x0.95, and being able to not only return a smoothness factor but also be able to compare two numbers (etc: putting in 5 and 10 returns > because 5's smoothness factor is greater than 10's) multiplies your value by x0.7. Command-line flags don't count for anything. Have fun! This challenge **ends** the 19th of March. Current placeholders: The functional language holder, with 45 chars, Nahuel Fouilleul, and the code golf language holder, with 7 chars, Luis Mendo. [Answer] # [MATL](https://github.com/lmendo/MATL), 7 characters ``` Btnwdz/ ``` [Try it online!](https://tio.run/##y00syfn/36kkrzylSv//f0MDAA "MATL – Try It Online") ### Explanation ``` B % Convert to binary t % Duplicate n % Number of elements w % Swap d % Consecutive differences z % Number of nonzeros / % Divide ``` [Answer] # [Japt](https://github.com/ETHproductions/japt), 8 bytes *NULL for infinity* ``` ¤Ê/¢ä¦ x ``` [Try it online!](https://ethproductions.github.io/japt/?v=1.4.6&code=pMovouSmIHg=&input=MTA=) [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 8 [bytes](https://github.com/DennisMitchell/jelly/Code-page), score 8 Maybe there is a terser way... edit: I don't think there is. ``` BL÷BITLƲ ``` Infinity is given as `inf`. **[Try it online!](https://tio.run/##y0rNyan8/9/J5/B2J88Qn2Ob/v//bwwA "Jelly – Try It Online")** ...other 8's are possible too, for example `BµITL÷@L` or `BL÷BnƝSƊ`. [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)/characters ``` bgIbγg</ ``` [Try it online](https://tio.run/##yy9OTMpM/f8/Kd0z6dzmdBv9//9NAQ) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/pPTKpHOb0230/@v8jzbVMTTQMdQx1jGPBQA). Or alternatively: ``` b©g®¥ÄO/ ``` [Try it online](https://tio.run/##yy9OTMpM/f8/6dDK9EPrDi093OKv//@/KQA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/pEMr0w@tO7T0cIu//n@d/9GmOoYGOoY6xjrmsQA). Outputs `0.0` for the `INF` cases. --- With both bonuses **score: 11.97 (18 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)/characters \* 0.95 \* 0.7)**: ``` εbgybγg</3.ò}DÆ.±) ``` Outputs `1` if the first input is larger than the second; `-1` if vice-versa; `0` if they are equal. NOTE: Because I output `0.0` for the `INF` cases, they are considered lower than non-infinity test cases. Let me know if this has to be fixed.. [Try it online](https://tio.run/##yy9OTMpM/f//3Nak9Mqkc5vTbfSN9Q5vqnU53KZ3aKPm///RpjqGBrEA). **Explanation:** ``` ε # Map both values of the (implicit) input-list: b # Get the binary-string of the current value g # And get the length of this string yb # Get the binary-string of the current value again γ # Split it into chunks of equal adjacent digits g< # Get the amount of chunks, and subtract 1 / # Divide both numbers 3.ò # Round the number to 3 decimal values }D # After the map: duplicate the resulting list Æ # Reduce the duplicated list by subtraction .± # And get the sign of that result ) # Then wrap it into a list with the mapped values # (and output the result implicitly) ``` [Answer] # JavaScript (ES6), ~~46 44~~ 40 bytes / characters Returns `Infinity` if there's no bit flip. ``` n=>(g=s=>n&&1+g(x=s-(n^(n>>=1))%2))``/~x ``` [Try it online!](https://tio.run/##ZclLCoAgEADQffcoZog@Ri7Ho4RSJkWMkRGuurq1jbbvreYyYTyW/azYTzbNlJgUOAqkuChE6SBSqIAHYKVIIOYdotbNHdPoOfjN1pt3MMNb2VfkT0T7o072iOkB "JavaScript (Node.js) – Try It Online") ### Commented ``` n => ( // n = input integer g = s => // g = recursive function taking the number s of bit switches n && // stop if n is equal to 0 1 + // otherwise, add 1 to the final returned value g( // and do a recursive call to g: x = // update s and save the result in x: s - // subtract 1 from s if ... (n ^ (n >>= 1)) // ... there is a bit switch; and shift n to the right % 2 // NB: an extra bit switch is counted on the last bit ) // end of recursive call )`` // initial call to g with s = [''], which is coerced to 0 // as soon as something is subtracted from it / ~x // divide the result of g by -(x + 1), which compensates for // the extra switch ``` [Answer] # Perl 5 (`-p -Mbignum`), 45 bytes ``` $_=sprintf"%b",$_;$_=y///c/(s/(.)(?!\1)//g-1) ``` [TIO](https://tio.run/##K0gtyjH9/18l3ra4oCgzryRNSTVJSUcl3hooUqmvr5@sr1Gsr6GnqWGvGGOoqa@frmuo@f@/KZehAZchlzGX@b/8gpLM/Lzi/7oFOf91fZMy0/NKcwE) [Answer] # [Kotlin](https://kotlinlang.org), ~~83~~ 82 bytes ``` {s->s.toString(2).run{length.toFloat()/(0..length-2).count{this[it]!=this[it+1]}}} ``` [Try it online!](https://tio.run/##LY4xC8IwEIX3/orrdkEaraNQR0Fwc5QOodY2GC/SXF1Cfnu8Vm86Hh/ve0/PzlL@GAePmboD4JlYQXWEk/OGockxVMeg2V95sjTgXulppuh6GniUeMVQbXGn9S@sBOn8TBx5tOFmuS2b/7ep25RSFhO8jCVUEAuQW/TcB9HB1Jv7xVKPqiylXtagWpm36NkRLjNxgZUqUq6/) [Answer] # [R](https://www.r-project.org/), 56 bytes ``` length(y<-(x=scan())%/%2^(0:log2(x))%%2)/sum(diff(y)!=0) ``` [Try it online!](https://tio.run/##K/r/Pyc1L70kQ6PSRlejwrY4OTFPQ1NTVV/VKE7DwConP91IowLIVzXS1C8uzdVIyUxL06jUVLQ10Pxv@h8A "R – Try It Online") [Answer] # [Charcoal](https://github.com/somebody1234/Charcoal), 24 characters ``` ≔⍘N²θ≔⁺№θ10№θ01η¿ηI∕Lθη∞ ``` [Try it online!](https://tio.run/##S85ILErOT8z5/9@xuDgzPU/DKbE4NbikKDMvXcMzr6C0xK80Nym1SENTR8EIiAs1rbmgCgNySos1nPNL80o0CnUUlAwNlIDyCL6BoZImUCADqCEzTUEjQ1MhAGhoiYZzYnGJhktmWWZKqoZPal56SYZGIVidJlBlak5xKlSd0qOOeUqa1v//m//XLcsBAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: ``` ≔⍘N²θ ``` Input the number and convert it to base 2 as a string. ``` ≔⁺№θ10№θ01η ``` Calculate the number of of switches by counting the occurrences of `10` or `01` in the string. ``` ¿ηI∕Lθη∞ ``` If the total is nonzero then output the smoothness otherwise print Infinity. [Answer] # 1. Python 3, 131 bytes (154 with file header) Hi. I know that my code is way longer than others, but I will try it ;) Indentation by tabs. Script takes sequence of numbers in aguments and prints "smoothness" for each argument on own line. If number of changes is 0, prints "inf". ``` $ ./script.py 12 4.0 $ ./script.py 12 5 6 4.0 1.5 3.0 $ ./script.py `seq 5` None 2.0 None 3.0 1.5 ``` file header ``` #!/usr/bin/env python3 ``` code ``` import sys for n in sys.argv[1:]: b=bin(int(n))[2:];c=0;l=b[0] for o in b: if o!=l:c+=1 l=o print(len(b)/c if c>0 else"inf") ``` ## Input single number from STDIN: 102+23 bytes (code + file header) ``` n=input();b=bin(int(n))[2:];c=0;l=b[0] for o in b: if o!=l:c+=1 l=o print(len(b)/c if c>0 else"inf") ``` [Answer] # [Ruby](https://www.ruby-lang.org/), 42 bytes ``` ->n{1.0*(w=(n^n/2).digits 2).size/~-w.sum} ``` [Try it online!](https://tio.run/##KypNqvyfZvtf1y6v2lDPQEuj3FYjLy5P30hTLyUzPbOkWAHIKs6sStWv0y3XKy7Nrf0fbapjaKBjqGOsYx6rl5tYUF1TUVOgkBZdEVv7HwA "Ruby – Try It Online") ### How? First step: bitwise XOR of x and x/2. The result will have a bit set to 1 for every switch in the input number plus 1, and so we just need to get the number of digits in base 2, and their sum. Then add some parentheses, and make it a float. [Answer] # Python 3, 105 chars ``` def s(n):b=bin(n)[2:];l=len(b);c=sum([0if b[i]==b[i+1]else 1for i in range(l-1)]);return l/c if c>0else-1 ``` Returns -1 in the case of an infinity. [Answer] # [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 60 bytes Port of [G B](https://codegolf.stackexchange.com/users/18535/g-b)'s Ruby [answer](https://codegolf.stackexchange.com/a/180999/64121). ``` lambda l:(c:=(b:=bin(l^l>>1)).count('1'))>1and(len(b)-2)/~-c ``` [Try it online!](https://tio.run/##DctLDsIgEADQ/ZyCXWcSq07rp5LASYwJ0GJJcNqQunDj1dG3f@tnmxfph7XUaO41u5cfncoagzbotfFJMD@ytUy0D8tbNmy4IbLsZMQ8CXpqOzp821DjUlRSSVRx8pyQd8ykQam1pH@LmIgqQwc9nOAMF7jCADfg4w8 "Python 3.8 (pre-release) – Try It Online") --- # [Python 2](https://docs.python.org/2/), 68 bytes Returns false if the value is infinite. ``` k=input() n=s=0 while k:l=k%2;n+=1.;k/=2;s+=l^k%2 print s>1and n/~-s ``` [Try it online!](https://tio.run/##LY1PC4JAFMTv71M8hKCQ0t3@K6@bXbt0DkwXlJV1ebtSXvrqm1KnGYbfzNjRN72RoeprhYRRFAVNrbGDX67AkKMUXk3bKdRZR3ohcxOT2OQ6IZm7mLrHlIHl1nh0F1GaGk3yWbswDcG/eedBZYDoeZwFUb1VhfMhzL5S1mNxuxbMPf@AJ6tSBwEStrCDPRzgCCc4g0i/ "Python 2 – Try It Online") [Answer] # [J-uby](https://github.com/cyoce/J-uby), 42 bytes ``` ~:digits&2|:/%[:+@|Q,:chunk+I|A|:+@|:pred] ``` [Attempt This Online!](https://ato.pxeger.com/run?1=m700K740qXLBIjfbpaUlaboWN7XqrFIy0zNLitWMaqz0VaOttB1qAnWskjNK87K1PWsca0ACVgVFqSmxEB07o011DA10DHWMdcxj9XITC6oLFNyi4w1jayHyCxZAaAA) [Answer] # [q](https://code.kx.com/home/), 30 bytes Outputs infinity `0w` for 1, 3, 7 etc. ``` {count[b]%-1+/differ b:2 vs x} ``` # k, 21 bytes ``` {(#x)%-1+/~~':x:2\:x} ``` ]
[Question] [ # Connecting Dots ## We define a type of question on the test, connecting the dots ### Question parameters There are two parameters. Suppose they are `5` and `4`. The second one **must be less than or equal to the first one**. Thus, the question will look like this: ``` * * * * * * * * * ``` ### Possible answers An answer is termed `logically possible` if and only if: * Each dot on the left corresponds to one and only one dot on the right * Each dot on the right corresponds to at least one dot on the left (there is no maximum) ### We describe an answer using a `matrix`, or `list of lists`. For instance, `[[0,0],[1,0],[2,1]]` will link the dot indexed 0 on the left to the dot indexed 0 on the right, et cetera. You may choose to use 0-indexed or 1-indexed. ### We define an answer's `complexity`... ...as the number of intersections there are. For instance, the complexity of the answer `[[0,2],[1,1],[2,0]]` to be `1` as they intersect at the same point (assuming they are **evenly spaced out**). # Purpose * Calculate the complexity of a given solution # Grading This is **`code golf`**. [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 17 bytes ``` #2!StirlingS2@##& ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78n6Zg@1/ZSDG4JLMoJzMvPdjIQVlZ7X9AUWZeiYK@g4JjUVFiZXSajkK1hY6CRa2OgkHsfwA "Wolfram Language (Mathematica) – Try It Online") This is [OEIS A019538](http://oeis.org/A019538). [Answer] # [C (gcc)](https://gcc.gnu.org/), 42 bytes ``` f(a,b){return a--?b*(f(a,b)+f(a,b-1)):!b;} ``` [Try it online!](https://tio.run/##hY5BDoIwEEXX7SkGDEkr1GhiYiKiF3EDBXSIFlNhBZwdW0HFjc7mp5N5fV@Kk5R9n7M4SHijs6rWCmIhDsmcDUv/GWLF@dZJwq6foZKXOs1gd69SLBfnPUVVwTVGxThtKLlp886ZC63LQ0ryUgOzFwVEsAxNOBFsTPo@pzCZN@et0Q2gsPBrd1TCF//nW4iDEEchWiExBSe/etgaFVrsd1HyocZ@OcOg4JbsaNc/AA "C (gcc) – Try It Online") This uses a recurrence relation. Let \$f(a,b)\$ be the number of answers for \$a\$ left dots and \$b\$ right dots. Consider the first left dot; it is joined to one right dot, with \$b\$ possibilities. * If that right dot is joined to at least one other left dot, then the remaining \$a-1\$ left dots cover the \$b\$ right dots at least once each, for \$f(a-1,b)\$ possibilities. * If that right dot is not joined to any other left dot, then the remaining \$a-1\$ left dots cover the \$b-1\$ other right dots at least once each, for \$f(a-1,b-1)\$ possibilities. Therefore, \$ f(a,b) = b \times (f(a-1,b) + f(a-1,b-1)) \$. The base case is \$ f(0,0) = 1\$ and \$ f(0,b) = 0\$ for \$ b > 0 \$. [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 10 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ``` LIãεÙg¹Q}O ``` Two loose inputs in reversed order. Port of [*@MatteoC.*'s Python answer](https://codegolf.stackexchange.com/a/247126/52210), so make sure to upvote him as well! [Try it online](https://tio.run/##yy9OTMpM/f/fx/Pw4nNbD89MP7QzsNb//39jLhMA) or [verify all test cases below 6](https://tio.run/##yy9OTMpM/W96bJLfoZUgMvTQuohHDbPslRQetU1SULIHcv/7HFp3ePG5rYdnpkcE1vr/1/kPAA). **Explanation:** ``` # E.g. inputs: b=2,a=3 L # Push a list in the range [1, first (implicit) input `b`] # → [1,2] Iã # Create all possible `a`-sized combinations from this list, using the # cartesian product # → [[1,1,1],[1,1,2],[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]] ε # Map over each inner list: Ù # Uniquify it # → [[1],[1,2],[1,2],[1,2],[2,1],[2,1],[2,1],[2]] g # Pop and push the length to get the amount of unique values # → [1,2,2,2,2,2,2,1] ¹Q # Check if its equal to the first input `b` # → [0,1,1,1,1,1,1,0] }O # After the map: check how many were truthy by taking the sum # → 6 # (which is output implicitly as result) ``` [Answer] # [Vyxal](https://github.com/Vyxal/Vyxal) `s`, 7 bytes ``` ɾ↔vUvL= ``` [Try it Online!](https://vyxal.pythonanywhere.com/#WyJzIiwiIiwiyb7ihpR2VXZMPSIsIiIsIjNcbjQiXQ==) or [Run all the test cases below 6](https://vyxal.pythonanywhere.com/#WyIiLCJAZjoyfCIsIjrJviTiiIfihpR2VXZMPeKIkSIsIjtcblxuNTrhuopzOsabw7dAZjs7WsabYCA9PiBgajvigYsiLCIiXQ==) ## How? ``` ɾ↔vUvL= ɾ # List in the range [1, (implicit) first input `b`] ↔ # Get all possible combinations of this list of size (implicit) second input `a` vU # For each item, uniquify vL # For each item, get the length = # Is each item equal to the (implicit) first input `b`? # `s` flag sums the top of the stack ``` Other 7-byters: ``` ɾ↔ƛUL;= ɾ↔ƛUL¹= ``` ### Flagless: # [Vyxal](https://github.com/Vyxal/Vyxal), 8 bytes ``` ɾ↔vUvL=∑ ``` [Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLJvuKGlHZVdkw94oiRIiwiIiwiM1xuNCJd) [Answer] # [Python](https://www.python.org), ~~97~~ ~~95~~ ~~88~~ 84 bytes *-2 bytes thanks to [@Number Basher](https://codegolf.stackexchange.com/users/111945/number-basher)* *-4 bytes thanks to [@Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen)* ``` from itertools import* f=lambda a,b:sum(b==len({*x})for x in product(*[range(b)]*a)) ``` [Attempt This Online!](https://ato.pxeger.com/run?1=NY6xDoIwFEV3vqLja1MHYTEk_IUbYWiFahPa1zweCcb4JS4s-k_-jSWRO9zpnJv7-qQ73zCu63tmdzh9z44wCM8DMeI4CR8SEqvCNaMJtjfCaFtPcwDbNOMQ4aGWp3RIYhE-ikTYzxcG1ZKJ1wGs7JSR8r993Ljsb2QLpa6khkqXucvcXV2InEQ-MjjI3C7u534) [Answer] # [Charcoal](https://github.com/somebody1234/Charcoal), 23 bytes ``` F⊕η⊞υ¬ιFNUMυ×λ⁺κ§υ⊖λI⊟υ ``` [Try it online!](https://tio.run/##Rcy9DgIhEATg/p6Cckmw0fIqczZXeKHwBRDWQOTnArvGt0dJTJxy5stYb6otJvb@KFXAmm3FhJnQgZdSaG4eWImtEAQp5@mndqaN0x0rfNHV7EtJyWQ36C0kbBCV0JEbPJU405odvsd2wf99lCPzpGvIBItpBLrswKPs/SSO/fCKHw "Charcoal – Try It Online") Link is to verbose version of code. Explanation: ``` F⊕η⊞υ¬ι ``` Create a list of one `1` and `k` `0`s corresponding to a 0-indexed first row of the table in OEIS linked by @alephalpha. ``` FN ``` Repeat `n` times: ``` UMυ×λ⁺κ§υ⊖λ ``` Update the row using the recurrence relation given in OEIS but also @m90's answer. ``` I⊟υ ``` Output the last value calculated. ]
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 7 years ago. [Improve this question](/posts/10777/edit) [I asked this question](https://softwareengineering.stackexchange.com/questions/187205/how-to-write-useful-java-programs-without-using-mutable-variables) on [programmers](https://softwareengineering.stackexchange.com/) 10 days back but wasn't able to get the answer that I wanted. Write program in java to print the squares of first 25 integers(1-25) without using any variables. I am not looking for any theory explaining concepts about java or functional programming. I just want to know if its possible in java, the way the author has described in the [original context.](http://pragprog.com/magazines/2013-01/functional-programming-basics) --------Edit-------------------- Actually making it mutable variable makes it quite easy. The original context was > > (take 25 (squares-of (integers))) > Notice that it has no variables. Indeed, it has nothing more than three functions and one constant. Try writing the squares of integers in Java without using a variable. Oh, there’s probably a way to do it, but it certainly isn’t natural, and it wouldn’t read as nicely as my program above. > > > So try writing same program without using any variables. [Answer] Obligatory cheat: ``` public class PrintTwentyFiveSquares { public static void main() { System.out.println("1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, 529, 576, 625"); } } ``` [Answer] Ugly hack in 216 characters, this does not even use method args: ``` class M{static void m(){System.out.println((Thread.currentThread().getStackTrace().length-2)*(Thread.currentThread().getStackTrace().length-2));if(Thread.currentThread().getStackTrace().length-2<25)m();}static {m();}} ``` Formatted, this looks like: ``` class M { static void m() { System.out.println((Thread.currentThread().getStackTrace().length-2)*(Thread.currentThread().getStackTrace().length-2)); if (Thread.currentThread().getStackTrace().length-2 < 25) m(); } public static void main(String[] a) { m(); } // We can comply fully with the question (no variables), // but then cannot avoid the "java.lang.NoSuchMethodError: main": static { m(); } } ``` For those who don't understand: It takes the stacks length squares it. This works because I'm recursively calling `m()`, always increasing the stack by 1. Maybe this could be written even shorter. [Answer] How about this? ``` public class Squares { public static void printSquares(final int n) { if (n > 1) { printSquares(n - 1); } System.out.println(n * n); } public static void main(final String... args) { printSquares(25); } } ``` Now that you completely changed the question, my solution depends on whether you consider function arguments to be variables or not. I'd say it still stands. I should add that the Closure solution depends on the pre-availability of several functions in the standard library. The same functions could be written in Java, leading to a nearly identical main program: ``` import java.util.AbstractList; import java.util.List; public class Squares2 { public static List<Integer> integers() { return new AbstractList<Integer>() { @Override public Integer get(final int index) { return index + 1; } @Override public int size() { return Integer.MAX_VALUE; } }; } public static List<Integer> squaresOf(final List<Integer> l) { return new AbstractList<Integer>() { @Override public Integer get(final int index) { return l.get(index) * l.get(index); } @Override public int size() { return l.size(); } }; } public static List<Integer> take(final int n, final List<Integer> l) { return l.subList(0, n); } public static void main(final String... args) { System.out.println(take(25, squaresOf(integers()))); } } ``` ]
[Question] [ Jack is a little businessman. He found out a way to earn money by buying electricity on days when it's cheap and selling it when it's much more expensive. He stores the electricity in a battery he made by himself. ### Challenge You are given `N` (if required), the number of days Jack knows the cost of electricity for, and `X`, the amount of money Jack has available to invest in electricity, and the value(buy/sell value) of the electricity for `N` days. Your job is to determine when Jack should buy and when he should sell electricity in order to earn as much money as possible and simply print the largest possible sum of money he could have afterwards. The value of the electricity is always a positive integer but depending on the amount of money Jack has, the amount of electricity and money he has may be floating point numbers. ### Examples (I/O need not be exactly as shown): 1. ``` 4 10 4 10 5 20 ``` Output: `100` - because he buys electricity on the 1st day and the sells it on the 2nd and buys it on the 3rd and sells it on the 4th day. 2. ``` 3 21 10 8 3 ``` Output: `21` - because it's better if he doesn't buy/sell any electricity. 3. ``` 3 10 8 10 14 ``` Output: `17.5` - because he buys electricity on the 1st day, but he sells it on the 3rd day. 4. ``` 5 10 4 2 10 5 20 ``` Output: `200` - much like example 1, but this time Jack waits for the price to drop to `2` before making a purchase. --- The program with the shortest amount of code wins! This is a code golf problem. Note:You can shorten the input, as long as it still makes sense. [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), ~~8~~ 7 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) -1 byte thanks to Mr. Xcoder (use the `Ɲ` quick which performs `2\`) ``` ÷@Ɲ»1P× ``` A dyadic link taking a list of the prices on the left and the initial capital on the right which returns the maximal capital. **[Try it online!](https://tio.run/##y0rNyan8///wdodjcw/tNgw4PP3///8mOgpGOgqGBjoKpkCWwX9DAwA "Jelly – Try It Online")** or see the [test-suite](https://tio.run/##y0rNyan8///wdodjcw/tNgw4PP3/4eX6j5rW/P8fHR1toqNgaKCjYKqjYGQQC2LH6nApREeDxCx0FIyBQkaGECELiEpDEyRlQN1GGAbEAgA "Jelly – Try It Online"). ### How? Jack can sell every day on which the preceding day had a lower price and buy on those days (even if it is one on which he sold). When he does so his capital increases by `priceToday ÷ priceYesterday`, such gains multiply his initial capital, while any time the price falls he may simply forego the loss and multiply his capital by `1` instead by not transacting. ``` ÷@Ɲ»1P× - Link: list, prices; number, initial capital e.g. [4,2,10,5,20], 10 Ɲ - pairwise overlapping reduce left (prices) by: ÷@ - division with swapped arguments [0.5,5,0.5,4] 1 - literal one 1 » - maximum (vectorises) [1,5,1,4] P - product 20 × - multiply by right (initial capital) 200 ``` [Answer] # [Haskell](https://www.haskell.org/), 41 bytes ``` l#n=foldr((*).max 1)n$zipWith(/)(tail l)l ``` [Try it online!](https://tio.run/##DcexCoAgFAXQX7mQg4aURo1@R0M0CBU9epmYQ/Tz1nbO7u9jZS6Fq@C2i5ckZa2a0z@wKoiX4kh5l62S2RODFZfTU4BDTBQyBKZeo9OwRmP4ZWZUf8oH "Haskell – Try It Online") [Answer] # [Coconut](http://coconut-lang.org/), ~~51~~ 45 bytes thanks to @totallyhuman for -5 bytes ``` d->m->reduce((*),map(max$(1)..(/),d[1:],d))*m ``` [Try it online!](https://tio.run/##RY5BCoMwFESvkoWL/@VrTZqCFJqLpFlIEqGLqKiBLHr3NLqwm4HHzDBjZztPcc/j651do0KjVu@i9QA1UhgWCEOqgGPbwg3Jaf405BDrkDXwjrSkog8SnUFiIDjpwj3dTzwC/RHg8mJJ4l8x7KtYWakgsUaxEZLmBosWDy9vWT/TfmL5usXg8w8 "Coconut – Try It Online") Uses [Jonathan Allan's algorithm](https://codegolf.stackexchange.com/a/155470/64121). Coconut extends Python with several functional programming constructs. ``` d->m-> lambda function taking two arguments, money and prices, in currying syntax reduce((*), product of... map( map max$(1)..(/), (x,y)->max(1, x/y) over d[1:],d consecutive pairs of prices ) )*m multiply with the initial money ``` [Answer] # [Husk](https://github.com/barbuz/Husk), 7 bytes ``` Π:mY1Ẋ/ ``` [Try it online!](https://tio.run/##yygtzv7//9wCq9xIw4e7uvT///8fbaJjpGNooGOqY2QQ@9/QAAA "Husk – Try It Online") ### How? ``` Π:mY1Ẋ/ – Full program. Ẋ – For each pair of adjacent elements from the input list... / – ... Divide the second by the first. m – For each quotient... Y1 – ... Get the maximum between it and 1. : – Append the second input. Π – Get the product of the resulting list. ``` [Answer] # Perl, 37 bytes Includes `+4` for `-ap` On STDIN first give a line with the list of prices, then a line with the starting capital `electricity.pl`: ``` #!/usr/bin/perl -ap $\=<>;s%\d+%$\*=$&>$'||$'/$&%eg}{ ``` You can then for example run it as: ``` (echo 4 2 10 5 20; echo 10) | electricity.pl; echo ``` [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes ``` Rü/εXM}P* ``` [Try it online!](https://tio.run/##MzBNTDJM/f8/6PAe/XNbI3xrA7T@/482NNCx0DE00THSMY/lMjQFAA "05AB1E – Try It Online") Uses the same method as in [Jonathan Allan's Jelly answer](https://codegolf.stackexchange.com/a/155470/47066) **Explanation** ``` R # reverse input list of buy/sell values ü/ # pairwise division εXM} # max of each element and 1 P # product * # multiply by initial capital ``` [Answer] # [Stax](https://github.com/tomtheisen/stax), ~~21~~ 20 bytes ``` àq'4¢<╪╦ÉdεÖ!≤♠┬☻∟In ``` [Run it](http://stax.tomtheisen.com/#c=c%7C%29s%5CDc%7B%7CMms%7Bhm%5C%7BE%3A_m%3A**&i=10%2C+%5B8%2C10%2C14%5D) This is the ascii representation of the same program: ``` c|)s\Dc{|Mms{hm\{E:_m:** ``` I'm sure there is room for golfing here, but I wanted to give Stax a spin. Here's the breakdown. ``` Input stack: initial funds, array of prices c Copy the array of prices |) Rotate the top copy one place right s Swap the two arrays on the main stack \ Zip the arrays to get consecutive price pairs D Drop the first pair (don't need [price N, price 1]) c Copy the result {|Mm Map max: Keep only the max of each pair (copy 1) s Swap copy 1 and copy 2 on the main stack {hm Map first: Keep only the first of each pair (copy 2) \ Zip copy 1 and copy 2 {E:_m Map explode, divide: Transform pairs with float division :* Array product: Multiply all resulting quotients * Multiply by other input (initial funds) ``` [Answer] # [Ruby](https://www.ruby-lang.org/), 57 bytes ``` ->a,x{x*a.each_cons(2).map{|t|t.max*1.0/t[0]}.reduce(:*)} ``` [Try it online!](https://tio.run/##ZY7RCsIgGIXvfYr/sg0ztQUjWC8iEuYcCeXG5mAx9@zm2k3U3eE75//P6cfbKzZV3F8UnuYpV8Qofb/q1g07npGn6ubgg09iyhmhBy@oXEhv6lGb3TnPlmhdN3qoQCAQosDAKIYTBk7lqiVe8cpKDMeEONtQuSVZ8RVL1/zvAZKfSVC3ELreajNgsM56qx4BAaTyARrx40hkXB3jGw "Ruby – Try It Online") A lambda taking an array of prices `a` and the starting capital `x`. The most interesting thing I found here is that it's faster to treat the pairs of prices as a tuple `t`, whereas my first instinct was `.map{|n,m|[m,n].max*1.0/m}`. ``` ->a,x{ x * # Multiply the starting capital by... a.each_cons(2).map{ |t| # For each consecutive pair of prices t.max*1.0 / t[0] # The larger of that pair, divided by the first }.reduce(:*) # All multiplied together } ``` ]
[Question] [ ### Challenge: To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points. ### Example: ``` (0,0), (3,3) -> (1.5,1.5) (-1,-1), (1,1) -> (0,0) (-7,3), (2,-2) -> (-2.5,0.5) (3, 1), (-5,9) -> (-1,5) ``` ### Rules: * The input and output can be a tuple, array, list, or any other type of sequence. * There must be two inputs, each representing a point. * The output has to support floating point numbers. Shortest solution in bytes wins. [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), ~~7~~ 2 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) -5 bytes (ha ha, yes I am an idiot) thanks to FryAmTheEggman! ``` +H ``` Takes two lists each of length d and returns one list of length d where d is the dimensions of the Cartesian space (question is posed for 2 dimensions, but should work for any d). **[Try it online!](https://tio.run/nexus/jelly#@6/t8f///2hdcx3j2P/RRjq6RrEA)** ### How? ``` +H - Main link: a, b (lists of coordinates) + - add (vectorises across the dimensions) H - halve (vectorises across the result) ``` [Answer] # Mathematica, 4 bytes ``` Mean ``` Works on lists of vectors: for example, `Mean[{{-7, 3}, {2, -2}}]` returns `{-5/2, 1/2}`. (If the input consists of floating-point numbers, so will the output.) [Answer] # [Python 3](https://docs.python.org/3/), ~~39~~ 35 bytes ``` lambda*x:[sum(a)/2for a in zip(*x)] ``` [Try it online!](https://tio.run/nexus/python3#S1OwVYj5n5OYm5SSqFVhFV1cmquRqKlvlJZfpJCokJmnUJVZoKFVoRn7v6AoM69EI02Di0tBIVrXXEfBOFZHIdpIR0HXKJaLS1PzPwA "Python 3 – TIO Nexus") [Answer] ## [Haskell](https://www.haskell.org/), ~~22~~ 19 bytes ``` zipWith$((/2).).(+) ``` Can be called with `(zipWith$((/2).).(+)) (p1::[a]) (p2::[a])` where `a` is any type deriving `Fractional`. Works in arbitrary dimensions. [Answer] # TI-BASIC, 8 bytes ``` .5(L₁+L₂ ``` Takes input on List 1 and List 2. Works for all dimensions. [Answer] ## [Julia](https://julialang.org/) 0.6, 13 bytes ``` (x->x/2)∘(+) ``` [Answer] # JavaScript , 30 bytes valid for any number of dimensions ``` a=>b=>a.map((c,i)=>(c+b[i])/2) ``` [Try it online!](https://tio.run/nexus/javascript-node#S7P9n2hrl2Rrl6iXm1igoZGsk6lpa6eRrJ0UnRmrqW@k@T85P684PydVLyc/XSNNI9pQxyRWUyPaSMcgVlOT6z8A) [Answer] # R, 22 bytes As an unnamed function that takes 2 vectors as parameters. Simply returns the mean of input vectors the same as a lot of answers. ``` function(a,b)((a+b)/2) ``` [Try it online!](https://tio.run/nexus/r#@6/BlVaal1ySmZ@nkaiTpKmhkaidpKlvpMmlqZGsYahjpKmTrGGqY6qp@f8/AA "R – TIO Nexus") And 16 bytes using the pryr library ``` pryr::f((a+b)/2) ``` [Answer] # Common Lisp, ~~70~~ ~~54~~ 49 bytes *Thanks to @Julian Wolf for helping to save a bunch of bytes!* ``` (defun f(a b)(mapcar(lambda(c d)(/(+ c d)2))a b)) ``` [Try it online!](https://tio.run/nexus/clisp#dYzBCoMwEETvfsUeZxCtSQ9@z2oMCFHE2u9Ps5JeCj3Mso99Oxlhie9dIlQmYtNj1hNJtykoZgnEA63Y4klTmHGc634JoiCtr0uGfrCw4rNgCcnm1@xcudn4usbujzvWnsreXv3t5g8) [Answer] # Math.JS, 14 bytes ``` f(a,b)=(a+b)/2 ``` Creates function `f` which takes 2 One Dimensional Matricies as input. As expected, this just adds the two, then halfs the result. [Try it!](http://a-ta.co/math/f(a%2Cb)%3D(a%2Bb)%2F2%0A%0Aprint(%0A%20%20%20%20f(%5B0%2C0%5D%2C%5B3%2C3%5D)%0A)) [Answer] ## [Python](https://www.python.org/) + [NumPy](http://www.numpy.org/), 18 bytes ``` lambda a,b:(a+b)/2 ``` Works in two dimensions for points inputted as imaginary numbers, or (since OP specifies that inputs must be taken as sequences) in arbitrary dimensions for points inputted as NumPy arrays. [Try it online!](https://tio.run/nexus/python3#VcxBCsMgEIXhfU4xyxk6tmoWhUBPYlyMFEGoRiRZ5PRWSjZ9y@/BH@EFa/9IDm8B4bCg3AI97JRy3doO5cj17HFrkCAVcA41a2KceSbP4FAZVmaAYXPBc1yMlpUl75cJxmpLZceIv9pdWpMTk9Oe@F@MJ6L@BQ "Python 3 – TIO Nexus") [Answer] # Python + NumPy, 17 bytes ``` lambda a:sum(a)/2 ``` A slightly less boring version of the other python answer. Takes args as 1 numpy array, containing both pairs. [Try it online!](https://tio.run/nexus/python3#Zc2xCsMwDATQPV@hUQK5jZ2hEOiXpB5UikFQO0ZNhny9GzK0lN508DguwRVu7Sn5/hCQ8bVmFDqHTnOdbYGy5rq1NBsoaIGpg08m7LknxoEHigw/4jw7v5tn/2@XfcAY2AWKX4nj0atpWTDhcXwSM9lQiai9AQ "Python 3 – TIO Nexus") [Answer] # Julia, 13 bytes ``` a->b->(a+b)/2 ``` Call with currying syntax, i.e. `(a->b->(a+b)/2)([1,2])([3,4])`. ]
[Question] [ It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, [visit the help center](/help/reopen-questions). Closed 11 years ago. There are two objects: ``` Object1, Object2 ``` You can easily swap them by: ``` Object3 = Object1 Object1 = Object2 Object2 = Object3 ``` However, you must solve this problem by using no temporary object and Object1 should be changed to Object 2. (and vice versa) [Answer] ## Python I'll say it first. ``` object1, object2 = object2, object1 ``` [Answer] ## Mathematica A standard feature: ``` a = 1; b = 2; Print[a, " ", b]; {a, b} = {b, a}; Print[a, " ", b]; ``` Output ``` (* 1 2 2 1 *) ``` [Answer] **PostScript** In PostScript, it's common to use the stack instead of named variables, so a simple ``` exch ``` would do the job. But if you have variables, you can do it like ``` /a 1 def /b 2 def /a b /b a def def ``` [Answer] If you have access to the memory address of these objects, you can swap them by xor-ing their addresses. ``` // return 0 for success, 1 for error int swap(void *object1, void *object2, int size) { for (int i = 0; i < size; i++) { char *x = (char *)(object1 + i); char *y = (char *)(object2 + i); if (x == y) return 1; *x ^= *y; *y ^= *x; *x ^= *y; } return 0; } ``` per dmckee suggestion for clarity [Answer] ## Perl ``` ($object1, $object2) = ($object2, $object1); ``` Using Perl's list assertions feels like cheating, but it's a pretty common feature. [Answer] # PHP Objects / arrays / resources: ``` list($a, $b) = [$b, $a]; ``` Integers / booleans / strings of equal length: ``` $a ^= $b ^= $a ^= $b; ``` [Answer] ## Forth ``` swap ``` As i have to include more than 30 characters, here's a link to a [Forth primer](http://galileo.phys.virginia.edu/classes/551.jvn.fall01/primer.htm) ]
[Question] [ ## Challenge Given an input `x`, create a directory (AKA folder) in the file system with the name `x`. Languages that are not able to create file system directories are excluded from this challenge. The directory may be created anywhere, as long as the location is writable to the user running the program. Assume that the program is run as a non-privileged user on a modern Linux (or Windows if needed) desktop system. ### Clarifications * Assume that the current directory is `$HOME`/`%USERPROFILE%`. * Assume that no file or directory exists with the name given. * Assume that the filename will only contain the characters `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`. * Assume that the filename will always be 8 characters long or shorter. ## Rules * The directory must actually be created. You can't just say "I made it in /dev/null". * Standard loopholes apply. * This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"). [Answer] # MATLAB/Octave, 6 bytes ``` @mkdir ``` Creates a function handle named `ans` to the built-in function `mkdir` which accepts the folder to be created as a string ``` ans('folder_to_create') ans('/absolute/path/to/folder/to/create') ``` [Answer] # [Julia 0.5](http://julialang.org/), 5 bytes ``` mkdir ``` [Try it online!](https://tio.run/##yyrNyUw0/Z@mYPs/Nzsls@i/UoWSQo2dQhpXUWpiClBAQxPETcksLshJrPwPAA "Julia 0.5 – Try It Online") [Answer] ## Java, 33 31 bytes -2 bytes thanks to @Phoenix - removing curly braces around lambda. ``` s->new java.io.File(s).mkdir(); ``` In the form of a `Consumer<String>` where `s` is the name of the folder to create. [Answer] # [Ruby](https://www.ruby-lang.org/), 11 + 1 = 12 bytes +1 for `-n` ``` Dir.mkdir$_ ``` [Try it online!](https://tio.run/##KypNqvz/3yWzSC83OyWzSCX@f0FpSbECSCA1r6QoM7VYQ11PXfN/Wn7@v/yCksz8vOL/unkA "Ruby – Try It Online") [Answer] # [Bash](https://www.gnu.org/software/bash/), 8 bytes ``` mkdir $1 ``` [Try it online!](https://tio.run/##S0oszvj/Pzc7JbNIQcXwf07x//9p@fkA "Bash – Try It Online") [Answer] # [Python](https://docs.python.org/3/), 18 bytes ``` import os os.mkdir ``` [Answer] ## Batch, 6 bytes ``` @md %* ``` ~~Try it online!~~ [Answer] # [Go](https://golang.org/), 46 bytes ``` import."os" func f(n string){Mkdir(n,ModeDir)} ``` [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 14 bytes ``` Run["md "<>#]& ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78r/E/qDQvWik3RUHJxk45Vu2/ZrRSYlKyUux/AA "Wolfram Language (Mathematica) – Try It Online") --- The [trivial approach](https://codegolf.stackexchange.com/a/123911/69850) is longer. Surprise! (demonstrates that Mathematica is very verbose) Works on Windows only, where `md` is the command to create a directory. See [this answer](https://codegolf.stackexchange.com/a/154632/69850) or [this answer](https://codegolf.stackexchange.com/a/123931/69850). --- Explanation: ``` Run["md "<>#]& Anonymous function. "md " String literal "md ". (with a trailing space to separate the command and the parameter (directory name) # The input. <> `StringJoin` together. Run[ ] Runs as a command. ``` [Answer] # Mathematica, 15 bytes ``` CreateDirectory ``` [Answer] # C#, 35 bytes ``` System.IO.Directory.CreateDirectory ``` Does what it says on the tin. [Answer] # Batch, 2 bytes ``` md ``` `md` means **m**ake **d**irectory. Here it is in action: ``` C:\tmp>set f=md C:\tmp>%f% foo C:\tmp>dir f*.* Volume in drive C is OS Volume Serial Number is 6CC3-3025 Directory of C:\tmp 02-Feb-18 09:56 <DIR> foo 0 File(s) 0 bytes 1 Dir(s) 378,122,883,072 bytes free ``` [Answer] # [APL (Dyalog Unicode)](https://www.dyalog.com/), 6 bytes Prefix function. ``` ⎕MKDIR ``` [Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24RHfVN9vV08g4A8BfW0/Hx1rkdtE4GCwR4K6jnFCro5BeoA "APL (Dyalog Unicode) – Try It Online") [Answer] # tcl, don't know how to count My count could be: * 13, if everything on `file mkdir $x` is accounted. * 12, if `file mkdir $`as how I have seen in some answers `x` is not taken into account * 11, because in tcl whenever you use the value of `x` , you type `$x`, so only `file mkdir` is taken into account * 10, if is `file mkdir` by removing the trailing space from previous. Source: ``` file mkdir $x ``` [demo](http://www.tutorialspoint.com/execute_tcl_online.php?PID=0Bw_CjBb95KQMRXZqNEpXWnpJUW8) — Please reserve it for question asker. Look at files tree at the left where there is only `root` and `main.tcl` . Click the `Execute` button, it will run a script command on the green area; In the top of the files tree there is a `Refresh` button symbolized by an icon, click it and see `folder1` and `folder2` appearing. ]
[Question] [ **This question already has answers here**: [Find the Factorial!](/questions/607/find-the-factorial) (216 answers) Closed 9 years ago. # Challenge The objective is simple, in the shortest amount of bytes, write a function or program that takes a number and prints its [double factorial](http://en.wikipedia.org/wiki/Double_factorial). The input must be taken from stdin or a function argument, and it must print the resulting double factorial to stdout. Inbuilts are disallowed [Answer] # Haskell 21 ``` p n=product[n,n-2..1] ``` [Answer] # CJam, ~~13~~ 12 bytes ``` ri,:)1~%1+:* ``` Expanded code: ``` ri "Read the input as a string and convert it to integer"; , "Create an array of 0 to input integers - 1"; :) "Increment each element in the array"; 1~ "Put 1 and do bitwise not to get -2"; % "Take every other integer starting from end"; 1+ "Add 1 to the array to account for result of 0 being 1"; :* "Reduce product to get double factorial"; ``` At the end of the code, anything on stack is automatically printed to STDOUT in CJam. [Try it online here](http://cjam.aditsu.net/) [Answer] # JavaScript, ES6, ~~38~~ 36 bytes Wow this is huge! ``` f=a=>alert((g=n=>n>1?n*g(n-2):1)(a)) ``` ``` <input id=D /><button onclick="f(+D.value)">Run</button> ``` Of course I am just counting JS code. HTML is just for stack snippet demo. Run it in latest Firefox browser. [Answer] # Matlab 16 ``` @(n)prod(n:-2:1) ``` It is pretty sraight forward. [Answer] ## r, 30 ``` f=function(n)prod(seq(n,1,-2)) ``` [Answer] # [Pyth](https://github.com/isaacg1/pyth): 11 character ``` u*GhH%2_UQ1 ``` `Q` is the input value. `UQ` creates the list `[0, 1, 2, ..., Q-1]`, `_` inverts it, and `%2` removes every other element `[Q-1, Q-3, Q-5, ..., (1 or 0)]`. `u*GhH...1` reduces the list by multiplying the list elements (increased by 1) to `1`. Try it here: [Pyth Compiler/Executor](https://pyth.herokuapp.com/) ]
[Question] [ **This question already has answers here**: [We're no strangers to code golf, you know the rules, and so do I](/questions/6043/were-no-strangers-to-code-golf-you-know-the-rules-and-so-do-i) (73 answers) Closed 5 years ago. Write a function or program that outputs the following lines `<input>` time: ``` Hello World. Dlrow Olleh. Hwlrod Eoll. Big Brown Fox. Xof Nworb Gib. Bbfgox Iro. ``` **EDIT**: It's "*B* rown *F* ox" not "brown fox". This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the program with the shortest bytecount wins! [Answer] ## vim - 82 strokes ``` oHello World. Dlrow Olleh. Hwlrod Eoll. Big brown fox. Xof Nworb Gib. Bbfgox Iro.<ESC> ``` Type the number of repeats you want before entering this. [Answer] **Python ~~110~~ 105 Characters** ``` exec"print'Hello World. Dlrow Olleh. Hwlrod Eoll.\\nBig brown fox. Xof Nworb Gib. Bbfgox Iro.';"*input() ``` [Answer] # Ruby - 84 chars ``` "Hello World. Dlrow Olleh. Hwlrod Eoll. Big brown fox. Xof Nworb Gib. Bbfgox Iro."*n ``` [Answer] ## JavaScript - 100 characters ``` while(n--)print('Hello World. Dlrow Olleh. Hwlrod Eoll.\nBig brown fox. Xof Nworb Gib. Bbfgox Iro.') ``` [Answer] # D: 127 Characters ``` auto f(int n){return join(repeat("Hello World. Dlrow Olleh. Hwlrod Eoll.\nBig brown fox. Xof Nworb Gib. Bbfgox Iro.",n),"\n");} ``` More Legibly: ``` auto f(int n) { return join(repeat("Hello World. Dlrow Olleh. Hwlrod Eoll.\nBig brown fox. Xof Nworb Gib. Bbfgox Iro.", n), "\n"); } ``` [Answer] # PowerShell: 95 ``` "Hello World. Dlrow Olleh. Hwlrod Eoll.`nBig Brown Fox. Xof Nworb Gib. Bbfgox Iro.`n"*(read-host) ``` Read-Host prompts the user for input, then the string is multiplied by that value and printed. This will have an extra newline at the end, but I don't see that as a constraint in the challenge. [Answer] # [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), ~~761~~ 724 bytes ``` [S S S N _Push_0][S N S _Duplicate_0][T N T T _Read_input_as_integer][T T T _Retrieve_heap_at_0][S N S _Duplicate][N S S N _Create_Label_LOOP][S N N _Discard_top][S S S T N _Push_1][T S S T _Subtract][S N S _Duplicate_input][N T T T N _Jump_to_Label_EXIT_if_negative][S S S N _Push_0][S S T T S T T S S T N _Push_-89_\n][S S T T T S T S T N _Push_-53_.][S S S T T S S N _Push_12_o][S S S T T T T N _Push_15_r][S S T T T S T S N _Push_-26_I][S S T T S S S S T T N _Push_-67_space][S S S T S T S T N _Push_21_x][S S S T T S S N _Push_12_o][S S S T S S N _Push_4_g][S S S T T N _Push_3_f][S S T T N _Push_1_b][S S T T S S S S T N _Push_-33_B][S T S S T T S N _Copy_6th_space][S S T T T S T S T N _Push_-53_.][S S T T N _Push_1_b][S S S T T S N _Push_6_i][S S T T T T S S N _Push_-28_G][S T S S T S S N _Copy_4th_space][S S T T N _Push_-1_b][S S S T T T T N _Push_15_r][S S S T T S S N _Push_12_o][S S S T S T S S N _Push_20_w][S S T T S T S T N _Push_-21_N][S T S S T S T N _Copy_5th_space][S S S T T N _Push_3_f][S S S T T S S N _Push_12_o][S S T T S T T N _Push_-11_X][S T S S T T N _Copy_3rd_space][S S T T T S T S T N _Push_-53_.][S S S T S T S T N _Push_21_x][S S S T T S S N _Push_12_o][S S T T T T S T N _Push_-29_F][S T S S T S S N _Copy_4th_space][S S S T S T T N _Push_11_n][S S S T S T S S N _Push_20_w][S S S T T S S N _Push_12_o][S S S T T T T N _Push_15_r][S S T T S S S S T N _Push_-33_B][S T S S T S T N _Copy_5th_space][S S S T S S N _Push_4_g][S S S T T S N _Push_6_i][S T S S T T N _Copy_3rd_B][S S T T S T T S S T N _Push_-89_\n][S S T T T S T S T N _Push_-53_.][S S S T S S T N _Push_9_l][S N S _Duplicate_9_l][S S S T T S S N _Push_12_o][S S T T T T T S N _Push_-30_E][S T S S T S S T N _Copy_9th_space][S S S T N _Push_1_d][S T S S T T N _Copy_3rd_o][S S S T T T T N _Push_15_r][S S S T S S T N _Push_9_l][S S S T S T S S N _Push_20_w][S S T T T S T T N _Push_-27_H][S T S S T T S N _Copy_6th_space][S S T T T S T S T N _Push_-53_.][S S S T S T N _Push_5_h][S S S T S N _Push_2_e][S S S T S S T N _Push_9_l][S N S _Duplicate_9_l][S S T T S T S S N _Push_-20_O][S T S S T T S N _Copy_6th_space][S S S T S T S S N _Push_20_w][S S S T T S S N _Push_12_o][S S S T T T T N _Push_15_r][S S S T S S T N _Push_9_l][S S T T T T T T N _Push_-31_D][S T S S T S T N _Copy_5th_space][S S T T T S T S T N _Push_-53_.][S S S T N _Push_1_d][S S S T S S T N _Push_9_l][S S S T T T T N _Push_15_r][S S S T T S S N _Push_12_o][S S T T T S S N _Push_-12_W][S T S S T T S N _Copy_6th_space][S S S T T S S N _Push_12_o][S S S T S S T N _Push_9_l][S N S _Duplicate_9_l][S S S T S N _Push_2_e][S S T T T S T T N _Push_-27_H][N S S S N_Create_Label_PRINTER ][S N S _Duplicate][N T S N_Jump_to_Label_LOOP_if_0 ][S S S T T S S S T T N_Push_99 ][T S S S _Add][T N S S _Print_as_character][N S N S N _Jump_to_Label_PRINTER] ``` Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only. `[..._some_action]` added as explanation only. [Try it online](https://tio.run/##dVJBDgIxCDwPr@APvsgYE72ZaOLzK0xLod11m1AWBoYh/T6en/v7db3dW1NVsQOBf/TdmPWYGf@zjBCoBoFH6ZpPj6F@IzMdzShzB3DUyDREi2cw6qMKUdqjrEX0iCS2/pgjR9eYoOCoaHBuqraJyYvCqyja9HQRRVE01akkOU@XyojoOgCm8A7KLrkAVawLKBL1oLFfKyNG7Sz5K1FzcKAqrSTLVNjWvxPl85jyiwoZD1YS7WEMGqZau/wA) (containing the raw spaces, tabs and new-lines). **Explanation in pseudo-code:** ``` integer i = input_as_integer Start LOOP i = i-1 if i is negative: EXIT Call function PRINT function PRINT Print "Hello World. Dlrow Olleh. Hwlrod Eoll.\n Big Brown Fox. Xof Nworb Gib. Bbfgox Iro.\n " Go to the next iteration of LOOP ``` **Some things I did to golf it:** * `SNS` (Duplicate) is used for repeated characters (`ll`) * 99 is subtracted from every ASCII-value, which we'll add in the PRINT function to reduce loads of bytes. In Whitespace an integer/character is formed by using `SS` (Stack Manipulation: Push Number) + `S` or `T` (Positive or Negative) + some `T` / `S` (Binary representation of the number where `T=1` and `S=0`) + `N`. So having lower binary values and adding the 99 in the `PRINT` function is shorter than using the large binary values directly. * Since creating the number for a space is 11 bytes (`SSTTSSSSTTN`), I copied the spaces from the last occurrences to the top of the stack instead. For example, after the first space is created in `\n.orI xogfbB`, I then use `STSSTTSN` (copy 6th to top) instead to copy the previous space. The largest distant between two spaces is 9, and since `STSSTSSTN` (copy 9th to top) is still 2 bytes shorter than `SSTTSSSSTTN` (create space) I've done this for all spaces to save bytes. * I did something similar as with the copying of spaces above for every character that has a distance of 3 or less. This applies to the `B` in `Big B` and the `o` in `od Eo` (Note: The distance between both `b` in `b. Bb` is also three, but creating the number for `b` (`SSTTN`) is actually shorter than copying the 3rd value to the top of the stack (`STSSTTN`).) [Answer] ## Game Maker Language, 107 ``` repeat argument0{return "Hello World. Dlrow Olleh. Hwlrod Eoll.#Big Brown Fox. Xof Nworb Gib. Bbfgox Iro."} ``` [Answer] # Java 8, 121 bytes ``` n->{for(;n-->0;System.out.println("Hello World. Dlrow Olleh. Hwlrod Eoll.\nBig Brown Fox. Xof Nworb Gib. Bbfgox Iro."));} ``` **Explanation:** [Try it online.](https://tio.run/##LY@9TsNAEIR7nmKU6lz4REN1IoXFT1JgihQgAcXZPptLNrvW@RIHRX52c5BIu8XMaLXfbO3R5tI73ja7uSY7DHixns83gOfoQmtrh/JPAkfxDWqVfHBmkjWlTTNEG32NEox7zJwvz60EZTjPl7dm8zNEt9dyiLoP6ZRYLVaOSPAmgRqNBwoy4pXIfWusxqQaPAqR/uTCdyhSyniSk8a7tChHCRWefaVRVG0nJ6yD6EWWmWk2F5z@UFHCuVL9Q@9TJbWJ6X/38WWzSx3Wtbq79pjmXw) ``` n->{ // Method with integer parameter and no return-type for(;n-->0; // Loop `n` times System.out.println("Hello World. Dlrow Olleh. Hwlrod Eoll.\n Big Brown Fox. Xof Nworb Gib. Bbfgox Iro."));} // And print this text + a trailing new-line that many times ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/201120/edit). Closed 3 years ago. [Improve this question](/posts/201120/edit) # Challenge Your task is to generate a string using this sequence: ``` 1,1,2,1,1,2,3,2,1,1,3,2,4,2,3,1,.... ``` Which is more understandable in this format: ``` 1 1 2 1 1 2 3 2 1 1 3 2 4 2 3 1 1 4 3 2 5 2 3 4 1 ``` The pattern increases the number of Digits in the string by two for each increment in the Value of N **For each integer value up to the total N, *aside from 1*** the string is centred on the current value of N and bookended by the previous values of N in decreasing order on the left, and increasing order on the right - with the exception of the value 1, which bookends the entire string. # Input Number of steps # Output The series separated by comma [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E), 7 bytes Port of the Jelly answer. ``` L¦ÁR1šû ``` [Try it online!](https://tio.run/##yy9OTMpM/f/f59Cyw41BhkcXHt79/7@hAQA "05AB1E – Try It Online") # Explanation ``` L 1 .. N ¦ Tail Á Shift right R Reverse 1š Prepend 1 û Palindromize ``` # [05AB1E](https://github.com/Adriandmen/05AB1E), 9 bytes If the whole format is necessary, here's one with 9 bytes. (Question: Does 05AB1E have any sort of implicit range?) ``` LεL¦ÁR1šû ``` [Try it online!](https://tio.run/##yy9OTMpM/f/f59xWn0PLDjcGGR5deHj3//@GBgA "05AB1E – Try It Online") [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), ~~10~~ 10 ?8 bytes ``` Ḋṙ-U1;ŒB ``` [Try it online!](https://tio.run/##ATEAzv9qZWxsef//4biK4bmZLVUxO8WSQv874oCcIC0@IOKAnTvDh@G5viQKMTDDh@KCrFn/ "Jelly – Try It Online") I’m assuming you want the \$n\$th row of the pyramid. If you actually want the full sequence for the \$n\$th step, then it would be [10 bytes](https://tio.run/##ATMAzP9qZWxsef//4biK4bmZLVUxO8WSQilG/zvigJwgLT4g4oCdO8OH4bm@JAoxMMOH4oKsWf8). A monadic link taking an integer and returning a list of integers. ## Explanation ``` Ḋ | List 1..(n-1) ṙ- | Rotate right 1 U | Reverse list 1; | Prepend 1 ŒB | Bounce (mirror ``` [Answer] # [Python 3.8 (pre-release)](https://docs.python.org/3.8/), ~~86~~ ~~81~~ ~~58~~ 53 bytes ``` lambda n:[[1],[1,*(l:=range(2,n))[::-1],n,*l,1]][n>1] ``` [Try it online!](https://tio.run/##JcoxDoMwDADAva/wGEfu4LIgS/QjJkOqNhApmChi4fWhEvNdPY91t2Gsradp7iVun28EE1UOpEzeFZlatOXnXmSIKvL8i5EvxCGovTn0tDfIkA3uyMSM8gCoLdvhfHIZsV8 "Python 3.8 (pre-release) – Try It Online") Hats off to @Noodle9 for saving me a *whooping* 23 bytes and thanks to @squid for saving me 5 bytes! [Answer] # [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 145 bytes ``` n=>{var s= "";for(int i=0;i++<n;){for(int j=1;++j<=i;)s+=(j>2?i-j+2:1)+",";s+=i;for(int j=i;j-->1;)s+=","+(j>1?i-j+1:j);s+=i<n?",":"";}return s;} ``` [Try it online!](https://tio.run/##RY4xC8MgEIX3/IrDSbkKNdAlp2br1L1zCUk5BwtquoT8diuBtm9873v3bsp6ylyva5wsx3KCXBLHp4fF1ej89n4kyA6EoOWVZCOA3ZkY0UZS29cLzhBisI5JZXQy@H5kHbAfjEJxEtRMpj/NFLT25oBbjK1gjoIZgjpgG8cWDG13T3NZU4RMe6Wu3YDfG4DIYB1cCFQHTffEZb5xnOUiWSmqHw "C# (Visual C# Interactive Compiler) – Try It Online") Function generating whole series. [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 11 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) (9 if we only require the \$n^{\text{th}}\$ row of the "understandable format" - remove `)F`) ``` ,2œṖRUFŒB)F ``` A monadic link accepting an integer, the number of steps, which yields a list of integers, the series up to and including that step. **[Try it online!](https://tio.run/##y0rNyan8/1/H6OjkhzunBYW6HZ3kpOn2//9/UwA "Jelly – Try It Online")** [Answer] # [Erlang (escript)](http://erlang.org/doc/man/escript.html), 182 bytes Unfortunately this became the longest solution over here... ``` q(I)->lists:join(" ",[integer_to_list(X)||X<-lists:seq(2,I-1)]). x(0)->"";x(I)->x(I-1)++"\n"++if I>1->"1 "++lists:reverse(q(I))++" "++integer_to_list(I)++" "++q(I)++" 1";1<2->"1"end. ``` [Try it online!](https://tio.run/##XY5BDoMgEEX3noKwglCMuFTjnhuYWGNMOxoaixVI68K7U6jtprOYzOT9@X/AzIOeONiLUQ/nE78SSXk9K@tscVuUJhjhU6u0gwlM75Y@ItLQfW8qfsgsrCQ/SS5oR9NkI1kwwLjcPk6hB8AYPmvMmBqRrEXAAoXtODfwBGOBxOQojOQ/T/7A@h0FLkWVRyMM@pr6@xBebTuKeJ2gUGopxpdRDshGREZp6t8 "Erlang (escript) – Try It Online") [Answer] # JavaScript (ES6), ~~68~~ 65 bytes Returns the whole sequence after \$n\$ iterations. ``` f=n=>--n?[...f(n),1,...(g=k=>k>1?[k,...g(k-1),k]:[n+1])(n),1]:[1] ``` [Try it online!](https://tio.run/##HcpNCoAgEEDh68yQCrNoE6gHERdRKTUyRkXXt5/d@@Bt4z2e07Hul5Y6L60lK9ZpLT4YYxIIKlJvQbZsHTvygT9nYE2oOA5BOor4jy8otqnKWctiSs2QoEdsDw "JavaScript (Node.js) – Try It Online") --- # JavaScript (ES6), ~~53~~ 46 bytes Returns the \$n\$th row of the pyramid. ``` n=>(g=k=>k>1?[k%n||1,...g(k-1),k%n||1]:[n])(n) ``` [Try it online!](https://tio.run/##JcqxCoMwEIDh3ae4pXCHMZDBxfbig4iDqAk2cle0uNQ@eyp0@uHjfw7HsI/b8npXotOcA2dhj5ET@@Rd26WbnKcz1tqIqXJk/tA3nfSEQjnohgIM7g4CD4b6alkSfAqAUWXXdbarRhQD4fqp@OYf "JavaScript (Node.js) – Try It Online") ]
[Question] [ *Create a program that calculates my reading speed!* # The challenge Write a program which takes some text as input and waits for a *start* signal from the user to display the input. When to user gives a second *end* signal, the program should output the *reading speed* of the user, which is defined as the number of words in the input divided by the time between both signals in minutes. The word count of the input text is determined by splitting the text at white space. ## Input * A block of text via any standard input means. * A *start* and *end* signal by the user, either a click or pressing a certain key of your choice. ## Output * The block of input text. * The *reading speed* of the user as defined above. ## Rules * The start and end signal may **not** be running and ending the program. * The text may wrap or the user may scroll. * The reading speed value may be returned in any of the standard methods in the meta post found [here](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods), though the text must be displayed beforehand to the user, e.g. by printing to `stdout`. * This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins. [Answer] # MATL, 24 bytes ``` O$Y.Y`OYDtDYbn60*O$Y.Z`/ ``` **Explanation** ``` O$Y. % Wait for the user's keypress Y` % Start the timer % Implicitly grab the input OYD % Converts control characters and creates a string tD % Duplicate the string and display Ybn % Split the string into words and count them 60* % Multiply by 60 to convert words per second to words per minute O$Y. % Wait for user to press a key Z` % Get the elapsed time in seconds / % Divide the number of words (times 60) by the time in seconds % Implicitly display the result ``` [Answer] # Octave, 59 bytes ``` pause;tic;disp(x=input(''));pause;numel(strsplit(x))*60/toc ``` **Explanation** ``` pause % Wait for a user's keypress tic % Start the timer disp(..) % Display paragraph pause; % Wait for user's keypress numel(strsplit(x)) % Determine number of words *60 % Multiply by 60 to convertwords per second to words per minute /toc % Divide by the total time that it took (in seconds) ``` [Answer] # Processing Js 77 bytes ``` var i="",b=second();println(i);i.split(" ");keyTyped=function(){println(i.length/(second()-b));}; ``` [Try it out](https://www.khanacademy.org/computer-programming/new-program/5790491865317376) ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/31520/edit). Closed 9 years ago. [Improve this question](/posts/31520/edit) Here is one more "Challenge"! Today i had a meeting with a friend, and mostly we are a little bit crazy.. He bets, that it is not possible to create a Fibonacci Sequence without using loops. No static output like: ``` return "1, 2, 3, 5, 8, 13, .."; ``` **GOAL / Requirements** * Use only 1 int var * Return the first 5 (or more) numbers * Name your function "fibonacci" * Call no other functions except "fibonacci" * No loops are allowed * Have fun ;) **Scoring** Popularity contest (Most upvotes minus downvotes) **End Date** June 17. 2014 **No special language required** [Answer] # Python ``` def fibonacci(n): if n > 1: return fibonacci(n-1) + [(1.618033988749895**n/2.23606797749979 + 0.2) // 1] else: return [1] ``` Call `fibonacci(n)` to generate a list up to the nth element of the Fibonacci series. Sample output of `fibonacci(20)`: ``` >>> fibonacci(20) [1, 1.0, 2.0, 3.0, 5.0, 8.0, 13.0, 21.0, 34.0, 55.0, 89.0, 144.0, 233.0, 377.0, 610.0, 987.0, 1597.0, 2584.0, 4181.0, 6765.0] ``` The correctness is limited by the precision of the double precision floating point. [Answer] **EXCEL / NUMBERS / $spreadsheetapp** I think I saw this somewhere here, but I can't remember. Nevertheless, credits go to unknown author. Just Fill in the first 2 fields, do a simple addition and then it's time to drag, baby! ![enter image description here](https://i.stack.imgur.com/orVGL.jpg) [Answer] # [Kona](https://github.com/kevinlawler/kona) ``` fibonacci:{((x-1)(|+\)\1 1)[;1]} ``` Execute in shell as `fibonacci 12` to get the first 12 Fibonacci numbers. **Explanation**: * `1 1` is a vector * `(|+\)\` generates a vector of vectors by summing the elements of the vector * `(x-1)` reduces 12 to 11 (due to 0 indexing) which is applied to the summation to repeat `x-1` times * `[;1]` returns/prints the second element of each vector in the larger vectors. If I neglected the `[;1]` portion, you can see what happens to the vector: ``` > fib 1 ,1 1 > fib 2 (1 1 2 1) > fib 3 (1 1 2 1 3 2) ``` And so on. [Answer] # JavaScript (ECMAScript 6) ``` fibonacci=n=>n<2?[0,1]:[...fibonacci(n-1),fibonacci(n-1)[n-1]+fibonacci(n-2)[n-2]] ``` or more efficiently ``` fibonacci=n=>n<2?[0,1]:(i=fibonacci(n-1),[...i,i[n-1]+i[n-2]]) ``` or even more efficently (but with a loop instead of recursion) ``` fibonacci=n=>[i[m]=m<2?+m:i[m-1]+i[m-2]for(m in i=[...Array(n)])] ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/175908/edit). Closed 5 years ago. [Improve this question](/posts/175908/edit) ## FreeChat Online It is 1985, and you are a humble Russian potato farmer. Sadly, your glorious homeland is going through a time of crisis and it needs **your** help! The KGB, with the "assistance" of your wife and children, has convinced you to build their up-and-coming government *FreeChat Online* service for high ranking soviet officials. Luckily, the Russian government has provided you with several items seized through routine surveillance of the US's technological innovations—a cutting edge Macintosh XL, and the prototype source code for LucasArts's *Habitat*, an advanced communication service with cutting edge graphics. Your task is simple: create a few modifications for the Russian government… Due to Communism's tendency to coalesce toward collectivistic cultures, the Russian government wants this chat to embody their perfect world—one without silly notions of self or individualism. Alas, Macintosh compatibility leads you astray. Due to problems in the prototype, every other sentence in the chat buffer is corrupted, except for the ending period. Lucky for you, the Russian people make classification easy for you. **CHALLENGE**: For a String `s` in the input, there are 1 or more sentences, separated by `". "`(period, TWO spaces) The 2nd, 4th, 6th, and so on sentences are corrupted. The last sentence may have nothing, `"."`, `". "`, or `". "` as its end. Here's some examples of an input: `"L'etat c'est moi (I am the state) - King Louis XIV"` |----------------one sentence, ended by nothing--------------| `"Hello World. GojdGojog. How are you. "` |--three sentences, one corrupted, ended by `". "`--| `"Hi. gfhyG. My favorite food is Baseball. jijhojh. Foobar. "` |---------------Five sentences, two corrupted, ended by `". "`-----------| You must process this string, replacing any capitalized word besides the first word of a sentence, words in parentheses *(no nested, but there can be multiple sets in a sentence)*, or corrupted sentences with the string `"The State"`. **Examples**: `"L'etat c'est moi (I am the state) - King Louis XIV"` --->`"L'etat c'est moi (I am the state) - The State The State The State"` `"Hello World. GojdGojog. How are you. "` --->`"Hello The State. GojdGojog. How are you. "` `"Hi. gfhyG. My favorite food is Baseball. jijhojh. Foobar. "` --->`"Hi. gfhyG. My favorite food is The State. jijhojh. Foobar. "` **Rules**: 1. [Standard Loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) are prohibited 2. ASCII Text Input 3. If the input doesn't match the specifications set above, do whatever you please with the output! 4. This is code-golf, so the shortest(valid)answer (in each language) wins! 5. Bonus points for a one-liner 😎 (Not really tho, just cool points) [Answer] # [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 77 bytes ``` (?<=^(([^.]*)\. +([^.]*)\. +)*[^ .][^.]*)(?<!\([^)]*)[A-Z][A-Za-z]* The State ``` [Try it online!](https://tio.run/##TYzBToNAEIbvPMXvwXTBsE@gMfYgNNaTRo0U4lQGWLLtJMtWgy@P03jxMDNf/vnyB47uSMulKT4Wc3t90xhTNbbO0p3F1T9Ms6qBrf8CFS92@kyVq7v8vT4vyn/qLHkeGE@RIi/LdsUK@FzxFHEQB7MBHRDVmM5GihwP7thjKyc34W3zkpTsveBVgm8tUMjY6kivXMo3KDBmOdmkdJr03TAXeh9ndPQlwUVGJ9JCu9Y08Z68txjdOMg4WNyL7CnYXw "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation: ``` (?<=^(([^.]*)\. +([^.]*)\. +)*[^ .][^.]*) ``` Only match in the middle of alternate sentences. ``` (?<!\([^)]*) ``` Don't match inside parentheses. ``` [A-Z][A-Za-z]* ``` Match words beginning with uppercase letters. ``` The State ``` Replace them as desired. [Answer] # Java 10, 164 bytes ``` s->{var S=s.split(". ",-1);for(int l=S.length,i=0;i<l;)System.out.print((i%2<1?S[i].replaceAll("(?!^)[A-Z]\\w*(?<!\\([^)]*)","The State"):S[i])+(++i<l?". ":""));} ``` [Try it online.](https://tio.run/##nVJdT9swFH3nV1wsTdi0scYeSbuqfRitBgwpFUy0RXISp3HmxJHtFlWov73chLBJHQ/THq4/7z3n3I9CbEVQpL8OiRbOwY1Q1csJgKq8tJlIJNw2V4CtUSkkNPJWVWtwLMTX/QkuzguvEriFCoZwcMHXl62wEA0dd7VWnhIOQPrBBQszYynigh5GXMtq7fO@Gn4O1UCHLNo5L0tuNp7XyOApVZ@@DC5G0UKtuJW1RiljrSmho9MnthgHj6vl8vmcjganyyVdPLHVOSN9Ms8lRChIEnbZhLIe7fWQYNSquCSEsXB/CBvd9SbWqLuT36ZXYvJdhosVCPaWuZcOs7g@k@gJyRneoDQK6AxECR4JGwjJIIDvTWmuzUY5@Dm7J22N3uOnUmsDD8bqFKVcmSJFM2s8T80zCCthZzb8KEbh9zrLd1e43@wgE1tjlZeQGZMCskyEk7HQmkOhitwUOYdvxsTC/j/QH6SPoeY5us8cCJjjHb3GVYpmsBC2dXnPKMZeQuONDz/wq4m7kzYXtevDtCxLPtECYjTc0WfSnY7omnJ3TP9yJn8NZtvZFuz37L71teIJdR3Z8fjpinZA@8Mr) **Explanation:** ``` s->{ // Method with String as both parameter and return-type var S=s.split(". ",-1); // Split the input by ". " to get the list of sentences // (the -1 is in case the input ends in a trailing ". ") for(int l=S.length, // Amount of sentences i=0;i<l;) // Loop `i` in the range [0, amount_of_sentences): System.out.print( // Print (without newline): (i%2<1? // If `i` is even: S[i] // Print the sentence, .replaceAll( // After we've replaced all "(?!^) // (except the very first) [A-Z]\\w* // capitalized words, (?<!\\([^)]*)" // that are not within parenthesis "The State") // With "The State" : // Else: S[i]) // Print the sentence as is +(++i<l? // And if it's not the last iteration: ". " // Append ". " : // Else: ""));} // Append nothing more ``` [Answer] # [Perl 6](https://github.com/nxadm/rakudo-pkg), 91 bytes ``` {S:g/\s<:Lu><-[.\s]>+<?{!grep {$/.prematch.comb($_)%2},'. ',/\(|\)/,/\.\s$/}>/ The State/} ``` [Try it online!](https://tio.run/##TU1NT4NAFLz7K8YGBWK7m3jwUBETTWwb6alGTcSYpSywZPE1u6AhyG/H1Xjw8DJvJvNxkEZfTE2P0wJXmIbdsuSpjZZJF0eLF5ba1/gsuh6OSyMPGDzODkY2ot1XbE9NFnhv4cn5OPcZ4M95GnylIXfoch4fY46HSmLXilbycbKiRxHMEl86Abe@tC0aUgg2EA1a57Q/zhAL3Kv3Egl1yuJ58zgLL4/@wmupNeGJjM7d5Irq3B2V7l/TJ4SR6Klz7H9EOV4WVb9yuHWS@CCjWomCKIdbuBFWZkJrhlrVFdUVwx1RJgz7rZm@AQ "Perl 6 – Try It Online") Regex based solution. ### Explanation: ``` S:g/ # Do a global substitution \s<:Lu><-[.\s]>+ # On all words starting with capital letters <?{ }> # Where: !grep { } # None of: ,'. ' # Sentence terminators ,/\(|\)/ # Parenthesises ,/\.\s$/ # Is first word of sentence? .comb($_)%2 # Have an odd amount of matches $/.prematch # From the string before / The State/ # And replace ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/52428/edit). Closed 8 years ago. [Improve this question](/posts/52428/edit) The challenge is to write a program which outputs all characters of the Unicode table from n to z range. For code "0000" is the first in order and you must skip all blank Unicode combinations. For example, let n = 134 and z = 300, you must save or print all unicode characters between 0134 and 0300. The output of the program does not HAVE to output them, for example using std::cout can be used but if you have an array with all the saved characters then that still qualifies.(You don't have to print them out) The shortest program in bytes wins. [Answer] # Pyth - 16 bytes Maps `C`har-of over the range, and detects unprintables by if the string `"\x"` is inside its repr because that is how python represents unprintables like `\x00`. ``` f!}"\\x"`TCMrQvw ``` [Try it here online](http://pyth.herokuapp.com/?code=f!%7D%22%5C%5Cx%22%60TCMrQvw&input=134%0A300&debug=1). ]
[Question] [ You need to find the sum of minimum values of two list (same size) of small numbers. In a C like language, that could be expressed as: `v = min(a[0],b[0]) + min(a[1],b[1])+ min(a[2],b[2]) ...` The range of values is 0..7 and the 2 list can have up to 7 values. If you like, all the values in each list can be stored as a single 32 bit number. My goal is avoiding branches in code, so the rules are * Single line expression, * No function calls or method calls (except for basic operations like sum, if your language mandate this), * No if statements, including things that compile to if statements such as ternary operators or "greater than" operators **Edit 1** To clarify, what I want is 'no branches in code'. So, no if, no calls (function of methods). Loops with fixed ranges (0..7) could be OK because can be unrolled. Sorry if was not crystal clear about this. All what your language can do inline is OK. So if a functional language has a strange syntax that resembles a function call but is inlined, that's OK. **Shortest code wins.** As a side note: this challenge is related to a quasi-real problem: a fast scoring function in mastermind game. [Answer] ## C/C++ with SSE intrinsics (11 instructions) Because everything's better with SIMD... ``` inline int foo(const int16_t *a, const int16_t *b) { __m128i va = _mm_loadu_si128((__m128i *)a); __m128i vb = _mm_loadu_si128((__m128i *)b); __m128i vmin = _mm_min_epi16(va, vb); vmin = _mm_add_epi32(_mm_unpacklo_epi16(vmin, vmin), _mm_unpackhi_epi16(vmin, vmin)); vmin = _mm_add_epi32(vmin, _mm_srli_si128(vmin, 4)); vmin = _mm_add_epi32(vmin, _mm_srli_si128(vmin, 8)); return _mm_cvtsi128_si32(vmin); } ``` No branches, loops or function calls. This might not be the shortest *source* code, but it compiles to just 11 SSE instructions, so I claim shortest *generated* code. [Answer] **vb.net** ``` v = a.Zip(b,Function(p,q) Math.Min(p,q)).Sum v = a.Zip(b,AddressOf Math.Min).Sum ``` Edit: A no function call version. Just a single expression. ``` Dim v = {a(0), a(0), b(0)}(1 + ((a(0) - b(0)) / ((a(0) - b(0)) * (a(0) - b(0)) ^ (1 / 2)))) + {a(1), a(1), b(1)}(1 + ((a(1) - b(1)) / ((a(1) - b(1)) * (a(1) - b(1)) ^ (1 / 2)))) + {a(2), a(2), b(2)}(1 + ((a(2) - b(2)) / ((a(2) - b(2)) * (a(2) - b(2)) ^ (1 / 2)))) + {a(3), a(3), b(3)}(1 + ((a(3) - b(3)) / ((a(3) - b(3)) * (a(3) - b(3)) ^ (1 / 2)))) + {a(4), a(4), b(4)}(1 + ((a(4) - b(4)) / ((a(4) - b(4)) * (a(4) - b(4)) ^ (1 / 2)))) + {a(5), a(5), b(5)}(1 + ((a(5) - b(5)) / ((a(5) - b(5)) * (a(5) - b(5)) ^ (1 / 2)))) + {a(6), a(6), b(6)}(1 + ((a(6) - b(6)) / ((a(6) - b(6)) * (a(6) - b(6)) ^ (1 / 2)))) + {a(7), a(7), b(7)}(1 + ((a(7) - b(7)) / ((a(7) - b(7)) * (a(7) - b(7)) ^ (1 / 2)))) ``` Note: Above fails in a(x)=b(x) as a(x)-b(x) = 0 which results in divide by zero . ``` ((a(0) - b(0)) / ((a(0) - b(0)) * (a(0) - b(0)) ^ (1 / 2))) delta = a(x)-b(x) abs = (delta * delta)^(1/2) ; Sqr(delta^2) sign = delta / abs ; This is where the 0/0 happens. index = sign + 1 ; Since sign in normalise to -1 to +1 ; when need offset it by +1 for 0-Indexed arrays. ``` Version using < in mathematical sense. (akin to @Heiko Oberdiek entry) ``` Dim v = {a(0),b(0)}((a(0)<b(0))+1)+{a(1),b(1)}((a(1)<b(1))+1)+{a(2),b(2)}((a(2)<b(2))+1)+{a(3),b(3)}((a(3)<b(3))+1)+ {a(4),b(4)}((a(4)<b(4))+1)+{a(5),b(5)}((a(5)<b(5))+1)+{a(6),b(6)}((a(6)<b(6))+1)+{a(7),b(7)}((a(7)<b(7))+1) ``` [Answer] # APL, 7 (should be invalid) ``` v←+/a⌊b ``` `a⌊b` is the minimum of each corresponding pair of items. `+/` adds everything together in the last dimension, which is the only dimension in this case. Thanks to Adam Speight who pointed out that these symbols are called "functions" in APL. So this answer should be invalid and not fixable... [Answer] # Perl, 52 bytes ``` $v+=(($A=$a[$_])<=($==$b[$_]))*$A+($A>$=)*$=for 0..7 ``` It is a single line expression without functions and if statements. In an updated question, loops are excluded because of the end condition. In this case the `for` operator unfolds an array. It is not clear, whether this is acceptable or not, thus it is something for the OP to decide. (Of course, `for` could be avoided by making the summation explicit, but such a solution would be too boring for me). The input numbers are expected in arrays `@a` and `@b`. The sum is stored in `$v`. (If it is used a second time, `$v` needs to be reset to zero.) The minimum summand for each value in the index array `0..7` is calculated and added to the result variable `$v`. As far as I have understood the question, the `for` operator is not excluded. The result of the comparison operators `<=` and `>` are not used inside an `if` condition, but in a numerical context. **Ungolfed with test:** ``` @a = (1,7,3,4,5,0,3); @b = (3,1,4,1,5,2,6); $v = 0; for $_ (0..7) { $A = $a[$_]; $B = $b[$_]; $v += ($A <= $B) * $A + ($A > $B) * $B } # The use of $= instead of $B in the golfed version saves one byte. print "Result: $v\n"; ``` **Result:** 14 [Answer] # C, ~~81~~ 68 Not the shortest, but I found this interesting, so here's mine. Thanks to @edc65 for the improvement, which is not only shorter, but also faster. ``` int s,i;for(s=i=0;i<7;s+=(((x[i]-y[i])>>31)&(x[i]-y[i]))+y[i],i++); ``` Just &, shift, multiplication and addition, no division. Replace 0x80000000 and 31 with the appropriate constants for non-4-bytes ints. Loop can be unrolled (and gcc with -O3 unrolls it for me.) Usage: ``` int main(void) { signed int x[7] = {1,2,3,4,5,6,7}; signed int y[7] = {9,0,5,7,1,2,7}; int s,i; for (s=0,i=0;i!=7;s+=(((x[i]-y[i])&0x80000000)>>31)*(x[i]-y[i])+y[i],i++); return s; } ``` produces ``` gcc min_bare.c && ./a.out ; echo $? 18 ``` Let's compare with the forked if version (b) ``` if x[i] > y[i] s+=y[i] else s+=x[i] end ``` and with (c) ``` s+= ((x[i] > y[i]) ? y[i] : x[i]); ``` Let's benchmark with (taking the arrays from stdin) ``` int main(void) { int l,i,j,s; scanf("%d",&l); signed int x[l], y[l]; for (i=0; i!=l; scanf("%d",&(x[i++]))); for (i=0; i!=l; scanf("%d",&(y[i++]))); for (j=0; j!=99999999;j++) { for (s=0,i=0;i!=l;i++) { // put code to test here } } printf("%d\n",s); return 0; } ``` The if version (b) takes ~4.3s, version (c) ~3.4s, the original ~~~5.3s~~ ~4.3s; all with -O3. So don't optimize prematurely ; ) [Answer] ## JavaScript - 84 ~~89~~ ~~97~~ ~~98~~ **The code:** ``` for(s=i=7;i--;s+=x*r/r|0+y*l/l|0){x=~-a[i];y=~-b[i];l=0xff&1<<(x-y);r=0xff&1<<(y-x)} ``` **49** if the comparison operators are allowed in numerical context: ``` for(s=i=7;i--;s+=(x=~-a[i])-(x-y)*(y<x))y=~-b[i]; ``` The input is in the `a` and `b` arrays. The result is stored in the `s` variable. **Ungolfed version:** ``` for(s = i = 7; i--; s += x*r/r|0 + y*l/l|0, --s) { // Get the last elements of the arrays x = a[i]; y = b[i]; // Calculate which is greater l = 0xff & 1 << (x - y); r = 0xff & 1 << (y - x) } ``` **Sample usage:** ``` > a=[1,4,3];b=[2,3,5]; [ 2, 3, 5 ] > for(s=i=7;i--;s+=x*r/r|0+y*l/l|0,--s){x=a[i];y=b[i];l=0xff&1<<(x-y);r=0xff&1<<(y-x)} 4 > s 7 ``` [Answer] # Perl, 42 ``` $s+=($a[$_],$b[$_])[$b[$_]<$a[$_]]for 0..7 ``` I expect scripting/C-like languages with sigil-free syntax will fare slightly better in terms of their code-golf scores. Loops over the indices and creates a list with the element from `@a` and `@b`. The index is determined by the result of the `<` comparison. Just for kicks, one could write the following to make the logic scale for any number of elements by selecting the upper limit for the index variable to be the larger of `$#a` or `$#b`: ``` $s+=($a[$_],$b[$_])[$b[$_]<$a[$_]]for 0..($#a,$#b)[@a<@b] ``` [Answer] ## J (9) ``` v=:+/a<.b ``` Someone is going to need to help me out on this one. Does this match the rules? ``` Single line expression ``` Check. ``` No function calls or method calls (except for basic operations like sum, if your language mandate this) ``` The things J is made of are called `verbs` (it is basically impossible to write any J without verbs), are those considered functions? ``` No if statements, including things that compile to if statements such as ternary operators or "greater than" operators ``` `<.` is basically equal to `min`, and `+/` is basically equal to `sum`. Are those considered to `compile to if statements`? [Answer] # Golfscript, 13 ``` 0\~zip{$0=+}/ ``` The arguments have to be passed to the program as a list of the two lists (e.g. `[ [0 1 2] [4 2 0] ]`). I'm really not sure if it matches the rules, though (you said you won't forbid basic list operations? - zip in this case). ### Explanation: * Golfscript pushes the arguments it get as a string into the stack before the program runs. * `0\` pushes 0 and switching top elements of the stack (will be used for the sum). * `~` executes the code in the string, which is just pushing the array down the stack. * `zip` transposes array's rows with columns (e.g. `[[0 1 2][4 2 0]] -> [[0 4][1 2][2 0]]`). * `{...}/` executes a block (`{...}`) over each element of the array. * `$0=+` sorts each array in the big array gets the first element and adds to the "sum". At the end of the program only the sum is left on stack and the stack values are printed. ]
[Question] [ **This question already has answers here**: [Converting a string to lower-case (without built-in to-lower functions!)](/questions/12760/converting-a-string-to-lower-case-without-built-in-to-lower-functions) (63 answers) Closed 6 years ago. Given a string that consists entirely of printable ASCII, convert all lowercase letters to their uppercase equivalent. Non-lowercase characters are left untouched. I am not going to outright ban builtin solutions, but if you are going to post a solution that uses the builtin, please also post one that doesn't in your answer. This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so shortest code wins, standard rules apply. ## Test cases ``` input => output Hello, World! => HELLO, WORLD! TEST => TEST 1gN0r3 50M3 cH4r4C73r5 => 1GN0R3 50M3 CH4R4C73R5 ``` GOOD LUCK GOLFERS! [Answer] # [Japt](https://github.com/ETHproductions/japt/), [05AB1E](http://github.com/Adriandmen/05AB1E) & [2sable](https://github.com/Adriandmen/2sable) (and probably others), 1 byte ``` u ``` **Try it:** [Japt](https://ethproductions.github.io/japt/?v=1.4.5&code=dQ==&input=IkhlbGxvLCBXb3JsZCEi)  |  [05AB1E](https://tio.run/##MzBNTDJM/f@/9P9/w3Q/gyJjBVMDX2OFZA@TIhNnc@MiUwA)  |  [2sable](https://tio.run/##MypOTMpJ/f@/9P9/w3Q/gyJjBVMDX2OFZA@TIhNnc@MiUwA) Thanks to [Mr. Xcoder](https://codegolf.stackexchange.com/users/59487/mr-xcoder) for pointing out the polyglots. --- ## Japt Without Built-in, 16 bytes ``` c_¨#a©Z§#z?Z-H:Z ``` [Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=Y1+oI2GpWqcjej9aLUg6Wg==&input=IkhlbGxvLCBXb3JsZCEi) [Answer] # Pyth, 3 bytes ``` rQ1 ``` Equivalent to `str.upper` in python. [Answer] # [Perl 5](https://www.perl.org/), 6 bytes **5 bytes code + 1 for `-p`.** ``` $_=uc ``` [Try it online!](https://tio.run/##K0gtyjH9/18l3rY0@f9/j9ScnHwdhfD8opwURa4Q1@AQLsN0P4MiYwVTA19jhWQPkyITZ3PjItN/@QUlmfl5xf91CwA "Perl 5 – Try It Online") [Answer] # JavaScript (ES6), 18 bytes ``` s=>s.toUpperCase() ``` [Answer] # Mathematica, 11 bytes ``` ToUpperCase ``` [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes ``` Œu ``` [Try it online!](https://tio.run/##y0rNyan8///opNL///8bpvsZFBkrmBr4Giske5gUmTibGxeZAgA "Jelly – Try It Online") [Answer] # [Python 3](https://docs.python.org/3/), 9 bytes ``` str.upper ``` **[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzv7ikSK@0oCC16H9BUWZeiUaahpJHak5Ovo5CeH5RToqikqbmfwA "Python 3 – Try It Online") or [Verify all test cases.](https://tio.run/##K6gsycjPM/6fZhvzv7ikSK@0oCC16H9BUWZeiUaahpJHak5Ovo5CeH5RToqikqYmF1wmxDU4BEXAMN3PoMhYwdTA11gh2cOkyMTZ3LjIFKjkPwA)** --- # [Python 3](https://docs.python.org/3/), 50 bytes Saved many bytes thanks to @FelipeNardiBatista. ``` lambda k:''.join(chr(ord(c)-32*(c>'_'))for c in k) ``` [Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHbSl1dLys/M08jOaNII78oRSNZU9fYSEsj2U49Xl1TMy2/SCFZITNPIVvzf0FRZl6JRpqGUqKjR2pOTr6OQnh@UU5KVZSikqYmF1w2xDU4BEXAMN3PoMhYwdTA11gh2cOkyMTZ3LjIFKjkPwA "Python 3 – Try It Online") ]
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 8 years ago. [Improve this question](/posts/48718/edit) Write a program that takes as close to 1 second Wall-time sharp to execute in your language. Anything goes except to have the processor sleep / pause / wait, by either internal or relying on external processes. It should be interesting to see that adding one character more somewhere will more easily bring you to the correct time (though obviously at the cost of a character). Think for example to have a for loop run 10000 instead of 1000 times which "costs" 1 character. **Execution time** will be measured online by ideone. I guess for an "official time", I'll run a benchmark of say 100 times. Next to a low amount of characters and close to 1.000 seconds, low variance should also earn you street creds. It might actually be fun to come up with an idea for how much "worth" a character gets in terms of getting closer to 5.00 seconds. Measures: 1. `abs(5 - execution_time)` (lower better) 2. Number of characters (lower better) 3. Variability (lower better) 4. Cleverness (higher better) 5. Fun (higher better) [Answer] # Linux shell - 0.999 seconds (19 characters) ``` $ ping -c 2 127.0.0.1 PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.057 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.049 ms --- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.049/0.053/0.057/0.004 ``` I got 1000ms on the dot a few times, but 999ms was more common. Perhaps relying on ping's inherent waits between packets to decrease network congestion may cross a line, but in my defense, I didn't write a sleep or busy-wait in my code... I just really wanted a N=2 sample size for my pings. You never know when your sneaky computer might respond to one message and not another! [Answer] # Perl: 1.0031 seconds, 16 characters (An unhandled signal terminates the process, so this code was measured from “outside” with `bash`'s `time`. Result includes the `perl` interpreter's startup time too. :() ``` alarm 1;1while 1 ``` # Perl: 1.000059 seconds, 42 characters (This code was surrounded with `Time::HiRes::gettimeofday()` calls for more accurate measurement.) ``` eval{$SIG{ALRM}=sub{die};alarm 1;1while 1} ``` (No, [`alarm`](http://perldoc.perl.org/functions/alarm.html) is not a `sleep`. Not works on ideone.) [Answer] # Perl - ~~1.0065~~ ~~1.0032~~ 1.0025 seconds ``` for ($i = 0;$i < 11489000;$i++) { "Hey, I can see my post from here!"; } ``` Tested using the command `time perl onesecond.pl`, and averaged. There is also another Perl answer, so it looks like I may have to step up my game... [Answer] # **The Hexadecimal Stacking Pseudo-Assembly Language** Probably the longest program you'll see here at 120. Ranges from (usually; there are some rare cases which are well outside this range for some reason) 0.93 to 1.03 seconds run time (I rigged up a simple timer to my copy of the java interpreter). Pushes 40,960 33s to a stack, prints them all as chars, then halts with status 418. ``` 20A000 400000 000000 200021 400100 410000 400200 200001 400000 410200 400000 220000 420000 400000 030000 010001 010000 000001 140100 0401A2 ``` ]
[Question] [ **This question already has answers here**: [Filter an array so that duplicate items are removed](/questions/201449/filter-an-array-so-that-duplicate-items-are-removed) (26 answers) Closed 2 years ago. ## Task: Remove all duplicates from one list of integers. A list is simply a sequence of connected values that allows the same values to be stored at different positions in this sequence. If an item was found to be the same value as another item in this list, keep the first occurence of the item and remove the second (third and so on...) occurence of the item. ## Input/Output You may write a function or full program that takes a list of integers as an input and returns a list without duplicates as an output. ## Rules: * This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") challenge, so shortest answer wins! [Answer] ## APL (1) ``` ∪ ``` `∪` takes a list and returns the unique elements in a list, i.e.: ``` ∪ 1 2 3 2 3 4 5 1 2 3 4 5 ``` if you need I/O it's 2: ``` ∪⎕ ``` [Answer] ## GolfScript (2 bytes) ``` .& ``` Takes input on stack, leaves output on stack. [Answer] # Red, 8 bytes ``` unique s ``` assuming list is in word 's [Answer] # Python 2: 12 bytes ``` print set(l) ``` No input spec, so I'm assuming the list is held in a variable called `l`. [Answer] # Python - 12 bytes ``` list(set(l)) ``` Assuming the list is given in the variable `l`. [Answer] # Ruby, 3 characters ``` a|a ``` Assumes the list is stored in variable `a`. Also works with `&` instead of `|`. If the original list has to be altered (instead of keeping the original the same and creating a new list with duplicates removed), then 4 characters: ``` a|=a ``` [Answer] ## Mathematica, 7 bytes or 3 characters Assumes input in variable `x` ``` Union@x ``` If we're counting in Mathematica characters, I can do 3 (the second input line): ![enter image description here](https://i.stack.imgur.com/9bGp9.png) ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/247341/edit). Closed 1 year ago. [Improve this question](/posts/247341/edit) In this challenge, you will create the shortest graphical program that displays exactly "**Hello, world!**" You will need **no input**. You might be asking yourself, "what does he mean by graphical?" Well, by graphical, I mean **not writing to stdout.** For example, look at my ES6 answer, which makes an alert box pop up rather than the traditional hello world where you do write to stdout: ``` alert('Hello, world!') ``` That doesn't write to stdout. Which is what I am challenging you to do today. ### Formatting This is an example post in markdown for the ES6 snippet I posted above: ``` # JavaScript (ES6), 22 bytes alert('Hello, world!') ``` View an [example](https://codegolf.stackexchange.com/a/247342/111787) post. [Answer] # Minecraft Command Blocks, 47 bytes ``` summon cow ~ ~ ~ {CustomName:'"Hello, world!"'} ``` Spawns a cow with the name `Hello, world!`[![cow with name](https://i.stack.imgur.com/hUNL9.png)](https://i.stack.imgur.com/hUNL9.png) [Answer] # JavaScript (ES6), 22 bytes ``` alert('Hello, world!') ``` This is an example for my question. [Answer] # PHP (8.1), 20 bytes ``` echo'Hello, world!'; ``` ]
[Question] [ Notice: This question originally had people write comments with a shorter program, rather than new answers. This has been changed so that people with shorter programs can get reputation too. Hopefully this doesn't become unmanageable... There have been a couple of [OEIS-related](https://codegolf.stackexchange.com/questions/188142/cops-the-hidden-oeis-substring) [questions](https://codegolf.stackexchange.com/questions/188147/reverse-your-code-reverse-the-oeis) recently, so here's another: Pick a sequence from the [Online Encyclopedia of Integer Sequences](https://oeis.org), and write a full program or function which computes the sequence in one of the following ways: * It prints every term in the sequence in order * It takes an index in the sequence as input, and returns/outputs the term at that index. You will be trying to pick the sequence with the longest possible shortest possible program/function to compute that sequence (see the example below if that's confusing). You must include which sequence you are using in your answer. Try to make your program/function as short as possible. **If anyone can find a shorter program which computes the same sequence, they should add a another answer with their shorter program**. If you do find a shorter program than someone else, you should refer to their answer in yours. For all answers, a [Try it Online](https://tio.run) link would be nice. If someone else has written a shorter program than yours, it would be nice if you put a link to it in your answer. Of course, none of the programs should access the internet or the OEIS in any way, and they should all theoretically work on arbitrarily large inputs (you can ignore things like the maximum size of an integer type). The sequence with the longest shortest program in bytes is the winner. ## For example, Let's say I pick the sequence [A000027](https://oeis.org/A000027), the positive integers, and I submit this answer: # Python, 49 bytes, [A000027](https://oeis.org/A000027) ``` x = "o" while True: print len(x) x += "o" ``` Obviously this is not a very short program for computing that sequence, so someone else (let's call them foo) might come along and add this answer: # Haskell, 2 bytes, [A000027](https://oeis.org/A000027): ``` id ``` (`id` is the identity function, so it will just return whatever you pass into it, and because the `n`th positive integer is just `n`, it will compute that sequence). Then, the person who posted the Python solution should edit their answer: # Python, 49 bytes, [A000027](https://oeis.org/A000027) Superseded by foo's answer (link). ``` x = "o" while True: print len(x) x += "o" ``` As long as no one else finds a shorter program, this sequence would get a score of `2` (because `id` is two bytes), and the sequence with the highest score wins. --- [Current best sequence](https://codegolf.stackexchange.com/a/188238/62859): [A014715](https://oeis.org/A014715), 252 bytes [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~270~~ 252 bytes [A014715](https://oeis.org/A014715) **252 bytes, by Expired Data** ``` RealDigits[NSolve[3x-6==Plus@@({6,-12,4,-7,7,-1,0,-5,2,4,12,-2,-7,-12,7,10,4,-3,-9,7,0,8,-14,3,-9,-2,3,10,2,6,-1,-10,3,-1,-7,7,-7,12,5,-8,-6,-10,8,8,7,3,-9,-1,-6,-6,2,3,10,2,-3,-5,-2,1,1,1,1,1,-1,-2,-2,1,2,1,0,-1}x^2~Range~71),x,#][[-1,-1,-1]]][[1,#]]& ``` [Try it online!](https://tio.run/##PY7dCsIwDIUfRhCFFJrup/Ni4IXXInpZKhTZ5mCboFUG4l69JtsYaSHny8lpW@fvRet8fXOhzMO5cM2hrmr/MsfLo/kUJupFmuen5v3a7zffFAQqiEFo0NSCBJEAA6JCMea5BpRsikDsSEjICMcwSnJFPFbAWXQkc5wTNQclIGghHWcZlZ43cYQpLAn8QMKJuBSb1IT40v/w11/VcHZdVQwat9DDyhojJitaSwIJ2XU4PevOm9KglNaG8Ac "Wolfram Language (Mathematica) – Try It Online") I've never golfed in mathematica before, but the sequence seemed like an obvious contender. The code is more or less a copy of the example on the OEIS page. The sequence is the decimal expansion of Conway's constant, which itself is the root of this polynomial: \$x^{71}-x^{69}-2x^{68}-x^{67}+2x^{66}+2x^{65}+x^{64}-x^{63}-x^{62}-x^{61}-x^{60}-x^{59}+2x^{58}+5x^{57}+3x^{56}-2x^{55}-10x^{54}-3x^{53}-2x^{52}+6x^{51}+6x^{50}+x^{49}+9x^{48}-3x^{47}-7x^{46}-8x^{45}-8x^{44}+10x^{43}+6x^{42}+8x^{41}-5x^{40}-12x^{39}+7x^{38}-7x^{37}+7x^{36}+x^{35}-3x^{34}+10x^{33}+x^{32}-6x^{31}-2x^{30}-10x^{29}-3x^{28}+2x^{27}+9x^{26}-3x^{25}+14x^{24}-8x^{23}-7x^{21}+9x^{20}+3x^{19}-4x^{18}-10x^{17}-7x^{16}+12x^{15}+7x^{14}+2x^{13}-12x^{12}-4x^{11}-2x^{10}+5x^{9}+x^{7}-7x^{6}+7x^{5}-4x^{4}+12x^{3}-6x^{2}+3x-6\$ [Answer] # Python 3, 3 bytes, [A055642](https://oeis.org/A055642) Finally, a ridiculously short answer that isn't just A000027 or some other stupidly simple sequence. ``` len ``` This is a function. Number should be inputted as a string of its digits. Undefined behavior for non-integers and other strings. [Answer] # [cQuents](https://github.com/stestoltz/cQuents), 1 byte, [A000027](https://oeis.org/A000027) ``` $ ``` [Try it online!](https://tio.run/##Sy4sTc0rKf7/X@X/fwA "cQuents – Try It Online") Just to have a baseline answer in case every other answer is cracked. [Answer] # [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 490,453 bytes [A002205](https://oeis.org/A002205) ``` FromDigits[ToCharacterCode[StringReplace["$H\.06,\.1dVngsIno\.12RT",":3:"->FromCharacterCode[13]]]-1,127] ``` Where \.FF is a single byte of that value. [Try it online!](https://tio.run/##VVTpVzkNFD5IxBwlsi8ZIYXGvg@N7CVMw8SMabI12ZmE0J/e6/fx/Xyf59x7nuWOaPajO6JZpk3/lefMmG3@ZeaT0QPTZ9hF82WS@qDndJvtzlOTTreJsgdIv9qdDul2twnyogbTKAD1YrVyUupPbMPjZbvxgCIRu0H/i6hljxvkWfZDENqWd@lpNR2jT56UExoUr/RYeM6PeCOp3kL1WzWF7d7lPa4krc3zxqqnYCFTSvOLp1briK0rScSfIKpRHNLf6e9B/McSjFoIcG1QQB1dyD64KKBM/eFV7iojGdPiuYnpN5LrcvLICfzYQvQJW82LcOAzRe9V/fPkjqM@LPU8u1K41KlvSwwu6nAdAZJtxroTOe/N3C0BEqBx/LW0vyQ4klXUCbdmGo6/IAnzYiiyLF4mbIkn5RrDs55FR/17mvIycFbu774V6W3O796LMNXUQQWPN5XPzEkyXLDg2E1NOW7xbIH9xcO0bYGgBicsGq2S@7E5a3C857k8hCBgcuAs@cyWHc45/ox7n3xsNDx6lvrHS8wSX9bedi4gPp5rq@vCh9BXqWXOhdaiTbLNTapeN70ccM1GgogFBjppHL3qYhJcjDas/SsCtF6KLcHrs8Ko4vPE8/ooz64PcdbIlwv4mFWDT5RgK0B8dd5jTOPu1PDCYvOzl4USty9zWF8W@UZayVcdGugSyZhABRRDBAglcpV76@KIjWA2VpUb@LUu9iaFirw2@E75W3mzA2@P2DjcjqfHVqpy0YzzjejjEz9WANCP2f17wHeFtcUdDUMQp5OOSHcwY8pQw8XKK9FE3DnbbtYumChNg3LUpxGu@HrUmzsDw7PqRB459igRJsO/i3v7RiAKEGALObDPvRrk9k5Vz06zFmgEx9vtgHXqOAyagr5HmMQaFUpwV4D5moYj9u6667wv7ffBzEyxMzoFrjNciO3/pfD28TKDMCKVTCUmiIChaulDOh0U9HA5J8lb8uzitKeAYgHuZvBOgDEfWq@VOnzfmp2uc8XWa7/klvHzfZWPSyW7hW34kherA6gJIkuB@bBk4eQhcRSmozNOfO95WzqmMqtJKv8UpWX@mvmalxaqenRst4KzALL5bu7gWHaOZ7v5G/KMuYVSFkE5tDALxQatIZLWc2tpIOG2PK/lcptUHcgrqxttk/KcYI6Of6s4HhIEOVstHASxlOAoASp2g/HL8bcna1NTGnIxM8LfJRUHQy8ZQyQcVavtERucDOmvTfrXnIElj7ZnRUTwBTrAgySgE/73Bv7ffreXJEmn2@H2BMk/8u8/ "Wolfram Language (Mathematica) – Try It Online") - Limited to 2000 digits, I don't think the dev would appriciate ~1.5M of data coming through. I took a while to search though the OEIS 'webcam', but I paused and looked at XKCD, where it mentioned the book "A Million Random Digits with 100,000 Normal Deviates". And what do you know, it's A002205. A pretty old entry too. According to dieharder, a program for finding if a sequence of numbers is random, the sequence is pretty random, so I doubt there's going to be an algorithm to generate a given number. This makes it more of a Kolmogorov-complexity problem. Since every number is between 0 and 9 inclusive, then there are Log2[10] bits of information in a digit, or `1,000,000 * Log2[10]/Log2[256] bytes` of information total, or just a tad under 415,242 bytes. My final solution was to take the entire 1,000,000 digit number in as a number (big-int in other languages), convert it to base 127, and then put it in the range 1-127. `1,000,000 * Log2[10]/Log2[127] = 475,330 bytes`. Character 13 is the Carriage Return, which is converted to a Line Feed on most systems, so it's replaced with the trigraph :3:, since all the digraphs are taken. Mathematica was surprisingly happy to convert a 1 million digit number to base 127. The answer can be optimized, since TIO allows the entire 127+ unicode space, but using this method the results would only reduce the score by 1%. Here is the encoder I used, where `str` is a string containing all the digits: ``` StringReplace[FromCharacterCode[IntegerDigits[FromDigits[str],127]+1],{"\\"->"\\\\","\""->"\\\"",FromCharacterCode[13]->":3:"}] ``` BZIP2 can compress the data down to 431,122 bytes, which is pretty close, but I felt just BZipping the data and calling it an answer was a bit cheap since it's not a 'language', as much as those answers have been fun on other questions. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/183600/edit). Closed 4 years ago. [Improve this question](/posts/183600/edit) ## Codegolf challenge - mapping values in a multidimensional array ``` [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ] ``` This **2D** array is sick of being so **false**, and wants to find the **truth** about life, once and **for** all. Your task is to write a map function to act as a highway to all the values in this array. An example implementation of this super function would be if the above array is defined as `arr` below: ``` arr.multimap(x => { return 1; } ``` Which would result in the array being: ``` [ [1, 1, 1], [1, 1, 1], [1, 1, 1] ] ``` This is a 2D number example, yours has to work in any dimension, and not be dimensionally-bias. --- ## The rules * Must work in any type of dimensional array (1D, 2D, 3D, etc..) * Least bytes, wins! * Must only have one callback function which accounts for any level of dimensional interaction * Meta-languages get fewer points * Can simply be a function which applies the logic to an array given * Can be any arbitrary initial value, as long as you can replace it on-command [Answer] # [JavaScript (Node.js)](https://nodejs.org), ~~35~~ ~~27~~ 17 bytes *-18 thanks to @Arnauld and @Shaggy* ``` f=a=>a?a.map(f):1 console.log(f([ [0, 0, 0], [0, [0, 0, 0], 0], [[0, 0, [0]], 0, 0] ])) ``` [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 1 byte ``` ‘ ``` [Try it online!](https://tio.run/##y0rNyan8//9Rw4z///9HcykoRBvoKIBQrA6UgxCACUJFog1iY6FSXLEA "Jelly – Try It Online") Replaces `n` with `n + 1`. Because Jelly things. Note that `[x]` displays as `x` in Jelly (single-element lists don't show as lists); the internal data is still a single-element list. You can make it show using Python's `str`: [Try it online!](https://tio.run/##y0rNyan8//9Rw4yjkx7unPH///9oLgWFaAMdBRCK1YFyEAIwQahItEFsLFSKKxYA "Jelly – Try It Online"). [Answer] # [Perl 6](https://github.com/nxadm/rakudo-pkg), 4 bytes ``` !<<* ``` [Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPtf0cZG6781F1dxYqVCmkZ0tIEOEMYCCSAzFkiASCCMjdW0hqkByoGlwDIgFToQJZrW/wE "Perl 6 – Try It Online") Replaces `0`s with `True`. *Extremely* short for a non-esolang. ``` * # From the input ! # Boolean not << # Each element recursively ``` [Answer] # [Python 2](https://docs.python.org/2/), ~~29~~ ~~26~~ 25 bytes *-3 bytes thanks to @JonathanAllan* *-1 byte thanks to @JoKing* ``` f=lambda a:a<1or map(f,a) ``` Replaces `0` with `True` [Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRIdEq0cYwv0ghN7FAI00nUfN/QVFmXolCUWpBkUaaRjSXgkK0gY4CCMXqQDkIAZggVCTaIDYWIgVkRwOZ0bGxsVyxmpr/AQ) [Answer] # [Japt](https://github.com/ETHproductions/japt), 6 bytes ``` ?¡ßX:1 ``` [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=P6HfWDox&input=W1swLDAsMF0sWzAsWzAsMCwwXSwwXSxbWzAsMCxbMF1dLDAsMF1dCi1R) ``` ¬Íª¡ßX ``` [Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=rM2qod9Y&input=W1swLDAsMF0sWzAsWzAsMCwwXSwwXSxbWzAsMCxbMF1dLDAsMF1dCi1R) [Answer] # JavaScript, 36 bytes ``` t=>JSON.stringify(t).replace(/0/g,1) ``` [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/E1s4r2N9Pr7ikKDMvPTOtUqNEU68otSAnMTlVQ99AP13HUPN/cn5ecX5Oql5OfrpGmkY0l4JCtIGOAgjF6kA5CAGYIFQk2iA2FirFFaup@R8A "JavaScript (Node.js) – Try It Online") ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/174488/edit). Closed 5 years ago. [Improve this question](/posts/174488/edit) Input: A valid 6 HEX digit color code wihout a # prefix Valid: > > * 000000 > * FF00FF > * ABC123 > > > Your job is to find to which one of these: ``` Red: FF0000 Green: 00FF00 Blue: 0000FF White: FFFFFF Black: 000000 ``` the input color is the closest too, in this case you try to only match it to black or white when the RGB is the same value for all 3 (the color is grey, or black or white ofc), if there is a "tie" you can pick whichever The output is one of the aforementioned color codes. Examples: ``` Input: FF0000, Output: FF0000 Input: F10000, Output: FF0000 Input: 22FF00, Output: 00FF00 Input: FFFF00, Output: FF0000 or 00FF00 Input: 111112, Output: 0000FF Input: 010101, Output: 000000 Input: A0A0A0, Output: FFFFFF ``` This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so fewest bytes will win! [Answer] # [Python 3](https://docs.python.org/3/), ~~163 162~~ 150 bytes *-1 byte thanks to Kevin Cruijssen* *-12 bytes by some small tricks (thanks to HyperNeutrino for the* `"0F"[bool]` *idea)* ``` def f(i):m=i[:2],i[2:4],i[4:];a,b,c=(e==max(m)for e in m);return"".join("0F"[e]*2for e in([i[:2]>"7E"]*3if a&b&c else([a,b,c]if a^b^c else[a,1^a,0]))) ``` [Try it online!](https://tio.run/##RZDRasMgFIbv@xQHLxotdhhbGFgs9GK@hJiRWMMciymJg@3pM09K2H8u/PiU49HHb/4Y02lZ7qGHnkamBh2tko5HK9UZl7Nyl5Z33GsatB7aHzqwfpwgQEwwsMsU8veUCHn5HGOiRBhigzvI7Qi1a78reX0j7nCKPbT7bu8hfM2B2rWxQ9l0zVMWVzctF44xtuQw53ffzmEGDbYyRpRUHCpTbyQl2tWZjYRAfjpkpBoj190aC@kmsCq3w2mzxxf936h2UPKYYso0ew4EjlcgvHxT9mW0Pw "Python 3 – Try It Online") I was able to find a solution without turning the three hex values to integers (mainly because 'A' comes later in the ASCII table than '9', and so '9'<'A' is true). I am not really happy with some parts, but this was the shortest I could find. Because this solution uses a different approach than the other python3 solution, I'm posting this as a seperate answer. [Answer] # JavaScript (ES6), 94 bytes ``` s=>'00FF000000FFFFFF'.substr(([r,g,b]=s.match(/../g),r+g==g+b?r<'8'?4:10:r>b?r>g&&2:b>g&&6),6) ``` [Try it online!](https://tio.run/##hY5RC4IwFIXf@xXig9twbVNCQprSi38ielDTVZiLzfr7q7mQUKJzHi7n8nHuvZbPUtfqch/WvTw1puVG8wwwVhRsVDEKEP2o9KAgPCgscHXkmtzKoT5DSggVCKtQcC7CKlc7sAX5Jo1YqrJ3zEQQxGllR4Jwgkwtey27hnRSwBb67o6PkEep58JqjkR/kTi2@w/inl@0FF@Ia/Gk@gFHVvHUZ6E5wiLrL2TZsmfW00kr8wI "JavaScript (Node.js) – Try It Online") ### How? We could convert a bitmask to upper case hexadecimal with leading zeros using: ``` .slice(1).toString(16).toUpperCase() ``` But that would cost 36 bytes, and building such a bitmask is not especially cheap either. It's significantly shorter to extract the relevant substring from `"00FF000000FFFFFF"`, using the following offsets: ``` pattern | offset | 00FF000000FFFFFF ---------+--------+------------------ 000000 | 4 | ^^^^^^ FFFFFF | 10 | ^^^^^^ FF0000 | 2 | ^^^^^^ 00FF00 | 0 | ^^^^^^ 0000FF | 6 | ^^^^^^ ``` [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~32~~ ~~31~~ 30 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ``` 3äHDËiнžy@Di'F}6∍ë¾5∍sZk·„FFsǝ ``` Not really happy with it, so will see if I can golf it further.. When two `RGB` parts are the largest and equal, it will use the first one (i.e. `11ABAB` will result in `00FF00`). When all three parts are equal it will output `000000` when it's the range `[00,7F]` and `FFFFFF` for the range `[80,FF]`. [Try it online](https://tio.run/##yy9OTMpM/f/f@PASD5fD3ZkX9h7dV@ngkqnuVmv2qKP38OpD@0yBdHFU9qHtjxrmubkVH5/7/7@FAQgCAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn3lf@PDSzxcDndnXth7dF@lg0umulut2aOO3sOrD@0zBdLFUdmHtj9qmOfmVnx87v9anf9ubgZAwGVgAGJwgdhubmAKyHMDAy4LMOByMwQLGhmBVYJkgJQhCBhxGRqBaCAPRHMZGIIgl6MBCAIFHZ0cnbjcDIDQkMvNCEwZWIIgF1iFI5e5GwhyWRiAIAA). **Explanation:** ``` 3ä # Split the (implicit) input into three parts H # Convert each part from Hexadecimal to a base-10 decimal D # Duplicate this list Ëi # If all three values are equal: н # Leave only the first item of the list žy@ # Check if it's larger than or equal to 128 ("80" in hex) D # Duplicate this truthy/falsey result i } # If the result is truthy: 'F '# Push "F" # (Implicit else:) # (Take the duplicated falsey 0) 6∍ # Lenghten it to size 6 ë # Else: ¾5∍ # Push 0, lenghtened to size 5: "00000" s # Swap so the duplicated list is at the top of the stack Z # Take the max (without popping) k # Take the index of this max in the list · # Double this index „FFsǝ # Replace the "0" in "00000" at this doubled index with "FF" # (And output the top of the stack implicitly as result) ``` [Answer] # [Python 3](https://docs.python.org/3/), ~~219~~ ~~112~~ 110 bytes ``` def f(s):h=max([0,1,2],key=lambda i:s[i*2:][:2]);return["00"*h+"FF"+"00"*(2-h),"F0"[s[:2]<"80"]*6][s==s[:2]*3] ``` [Try it online!](https://tio.run/##HYq7DoMgGIV3nsIwAaXJDyatpXXowhN0Iww2YiBVaxTT@vS2cL7hXHKmLfr3WO5767qiIwtVvh6aLzHABZeWv9xW983wbJsiqMUEJpU1Slp6nV1c59FgAMz8AWuNDzkTefSUYw3YLOl5wxVgy07WLHWdF1ba/eND74rHvDpVTHMYI@lIGKc1EkrprjX8hbTIJmXqSOtsIkkiEAl0hwSqIIHOl8QP "Python 3 – Try It Online") -107 bytes by not being bad; drew a bit of inspiration from @Heitera by avoiding input integer parsing entirely. -2 bytes thanks to @Heitera ]
[Question] [ Your challenge: Connect to the Online Encyclopedia of Integer Sequences [OEIS.org](http://oeis.org), access any random valid sequence, output it's ID, and ouput all of the members of the sequence provided by the OEIS entry. The *only* website you're allowed to connect to is OEIS.org. Hints: Sequences are found in URLs such as <http://oeis.org/A280629>, however a more easily parseable version is found at URLs such as <http://oeis.org/search?q=id:A280629&fmt=text>. Every present *and future* sequence matches the regex `"[A-Z]\d{6}"`. (The regex is there to describe what an ID looks like. There are a lot of invalid sequences that match it, too). The webcam (<http://oeis.org/webcam>) feature of OEIS generates random sequences, but you'll have to find a way to change the dropdown menu from 'best sequences' to 'all sequences' to use it. Example output: ``` A280629 1, 1, 7, 139, 6913, 508921, 57888967, 9313574419, 1984690709953, 547467006437041, 188946742298214727, 79783392959511537499, 40498043815904027702593, 24314800861291379306213161, 17047720745682515427867108487, 13802952030641885344209574247779, 12780883488499783875309105315925633, 13420910251496135926622603184056054881, 15863354775169518855398667975850797997447, 20966527201075972453953302254528386060431659 ``` Every existing sequence has to have a chance of being outputed, it does not have to be an equal chance. Your program should continue to function properly regardless of future sequences being added. Even though all IDs presently start with A, there will eventually be a sequence B000001 after all the A sequences run out. You can assume that there will be no more sequences after Z999999 is defined, but you do have to assume that it *will* eventually be defined. An invalid sequence, which your program should never output, is one that doesn't exist. You may treat sequences with no given members (such as [A280611](http://oeis.org/A280611) either as invalid or give just the sequence ID and nothing else or a falsy value, but you must be consistent. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), fewest bytes wins! [Answer] ## Perl, 93 bytes ``` $u=chr(65+rand 26).sprintf("%06d",rand 1e6),$_=`curl oeis.org/$u`while!/tt>(.*?)</;say"$u $1" ``` Run it with `-E` flag (and I suggest redirecting `STDERR`, as `curl` prints its progression on it): ``` perl -E '$u=chr(65+rand 26).sprintf("%06d",rand 1e6),$_=`curl oeis.org/$u`while!/tt>(.*?)</;say"$u $1"' 2> /dev/null ``` Explanations: -`$u=chr(65+rand 26).sprintf("%06d",rand 1e6)` generates a random name, -`$_=curl oeis.org/$u` tries to retrieve the sequence, -`/tt>(.*?)</` checks if a tag `<tt>` is present on the page (it's only present on valid pages). If so, it stores the sequence's elements in `$1`. And if not, the `while` keeps looping. -`say"$u\n$1"` outputs the sequence's name and its elements. [Answer] ## Python 3, 221,208 bytes ``` from requests import* from random import* import re r=randint g=lambda x:re.findall(r'(?<=tt>)[^<]*',get('https://oeis.org/'+x).text) a='' while not g(a):a=chr(r(65,90))+str(r(0,999999)) print(a+'\n'+g(a)[0]) ``` I'm sure there's a few tricks I missed (and requests is an external lib), but this was a fun first go at python code golf [Answer] # JavaScript, 104 bytes Because [someone commented](https://codegolf.stackexchange.com/questions/106068/output-a-random-oeis-sequence#comment257935_106068) that this isn't possible in JS! Must be run from the root directory of OEIS ([consensus](https://codegolf.meta.stackexchange.com/questions/13938/if-we-can-require-a-particular-domain-can-we-require-a-particular-path)). Returns a 2-element array, with the first element being the sequence number and the second the sequence itself. ``` f=async n=>(s=/tt>[^<]+/.exec(await(await fetch(n+=Math.random()*1e6|0)).text()))?[n,s[0].slice(3)]:f`A` ``` To test it, go to the [OEIS homepage](http://oeis.org/) (or any sequence's page), open your browser's console and copy & paste the code below: ``` f=async n=>(s=/tt>[^<]+/.exec(await(await fetch(n+=Math.random()*1e6|0)).text()))?[n,s[0].slice(3)]:f`A` await f() ``` ## 97 bytes This *should* work and could maybe be golfed a little further but I'm on my phone so can't test it properly. ``` f=async n=>(s=/(?<=tt>)[^<]+/.exec(await(await fetch(n+=Math.random()*1e6|0)).text()))?[n,s]:f`A` ``` ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/17270/edit). Closed 9 years ago. [Improve this question](/posts/17270/edit) Ray tracers are easy to write. At each pixel on the screen, you shoot a ray into the scene and see what it hits. For the most basic ray tracer, the ray acquires the color of the object it hit. If you're doing shading, then you don't color the pixel immediately, instead you try to trace a ray back to the *light source*. The shaded color is then the (color of the surface)\*(cosine of the angle (dot product) of ray-to-the-lightsource has with the surface normal). If the light source cannot be reached, then the object is in shadow. This challenge is to write the raytracer in any language you can. The winner is the most **succinct** code, while still remaining readable (see here for more [elegant definitions](https://softwareengineering.stackexchange.com/a/97914/13572)). **Requirements**: * Ray trace spheres * Shading * Shadows * At least 1 bounce interreflection. * You must display your result using pixels *or* write an image file. Don't draw into the console. **Bonus**: * Include ability to ray trace general polygons * Translucency **Superbonus**: * General BRDFs * Subsurface scattering (BSSRDF) **Bad examples**: * **Don't do this:** <http://www.teamten.com/lawrence/projects/shortest_ray_tracer/> * **And don't do this:** <http://www.kevinbeason.com/smallpt/> The first is not readable. The 2nd is just a really *compact* C++ program. *This is a hard project*, so you might want to bookmark it and come back later. I'll leave this open for about a month before awarding the checkmark. # Resources: * [http://www.cs.utah.edu/~shirley/irt/](http://www.cs.utah.edu/%7Eshirley/irt/) (more will be added later) [Answer] This needs a little more work to fulfill the requirements (shading, interreflection), but mostly works. It generates the pixels line-by-line in the callback procedure to the `image` operator. The readability comes at the expense of being very wasteful with memory, creating and discarding temporary arrays with abandon. # Postscript 90 lines Uses an external [matrix library](http://web.archive.org/web/20160404161539/https://code.google.com/p/xpost/downloads/detail?name=mat.ps&can=2&q=). ``` (mat.ps) run % load matrix library /div { dup 0 eq { pop 10000 }{ div } ifelse } bind def % make divide-by-zero safe /tan { dup sin exch cos div } def %[vector] scalar {op} . [vector'] %create a new vector and fill with the scalar, %call matrix library's vector-op /sop { exch % [] {} s [ exch % [] {} [ s 3 index length 1 sub{dup}repeat % [] {} [ s*n-1 ] exch % [] [] {} vop } def /normalize { dup mag {div} sop } def << % parameters /Cam [ 0 0 0 ] % camera location /Lookat [ 0 0 -1 ] % camera lookat point /Up [ 0 1 0 ] % up vector /fovx 45 % horizontal field of view /W 320 % image width /H 200 % image height /Sc [ 1 1 -5 ] % sphere center /Sr 2 % sphere radius >> begin << % dependent constants /Left Lookat Cam {sub} vop Up cross /buf W string /fovy H W div fovx mul /ang 0 /pos 3 >> {def} forall % add these values to existing dictionary % place the light in the scene according to the /ang parameter /setLight { /Light [ ang cos pos mul 3 ang sin pos mul ] def } def 0 10 360 { /ang exch def % for-loop sets /ang, calls image and showpage setLight % place the light 150 200 translate % position lower left corner of image on page /y 0 def % initial y-value W H 8 % put width height depth on stack for `image` call [ 1 0 0 1 0 0 ] % 1-to-1 matrix, so width*height points is the image size { % image procedure yields a string with one image row 0 1 W 1 sub { /x exch def % for-loop iterates over x-values Left x 2 mul W sub W div fovx tan mul {mul} sop % construct vector from eye through center of pixel Up y 2 mul H sub H div fovy tan mul {mul} sop Lookat {add} vop {add} vop Cam {sub} vop normalize /R exch def Cam Sc {sub} vop % use the quadratic formula to check for real intersection dup R dot 2 mul /B exch def dup dot Sr dup mul sub /C exch def B dup mul C 4 mul sub /disc exch def % discriminant, the part under the radical-sign % ray hits sphere? no:0 yes:calculate disc 0 lt { 0 }{ disc sqrt /sdisc exch def % complete the quadratic formula to yield t value B neg sdisc sub .5 mul /t exch def t 0 le { B neg sdisc add .5 mul /t exch def } if R t {mul} sop Cam {add} vop /ri exch def %intersection point ri Sc {sub} vop 1 Sr div {mul} sop %normalize /rn exch def %surface normal Light ri {sub} vop %normalize rn dot % normal .dot. light-ray 1 add .3 mul %.3 mul dup 0 lt {pop 0} if % clip value into 8-bit range dup 1 gt {pop 1} if 255 mul truncate cvi } ifelse % pixel_color = 0..255 buf x 3 2 roll put % put pixel value in string } for /y y 1 add def % increase y for next row buf % yield string buffer to image } %exec % image doesn't report internal errors, debug the procedure with `exec` image showpage } bind for ``` Can generate a numbered series of images using ghostscript. And ImageMagick's `convert` can compile them into an animated gif. ![enter image description here](https://i.stack.imgur.com/Pe9g3.gif) ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/15317/edit). Closed 8 years ago. [Improve this question](/posts/15317/edit) In case the title was confusing, I mean something like the following C code: ``` main(){}znva(){} ``` When rot13 encoded, the code becomes ``` znva(){}main(){} ``` and still runs. But that isn't a valid answer, because of these rules: * Your code must produce output. Code that doesn't produce output is disqualified. * The program can't be empty. That's disqualified too. * The program can't be the same or similar to the output. This means that you can't use Golfscript or PHP. In a valid answer, the program produces some output without being rot13'd, such as: ``` Hello, World! ``` And when the program is rot13'd, the output changes to the following: ``` Uryyb, Jbeyq! ``` which is the rot13 of `Hello, World!`. Have fun! [Answer] ## Ruby Cheaty answer: ``` $><<'Hello, world!' ``` Slightly less cheaty answer: ``` s='Hello, world!' $-I?puts(s):chgf(s) ``` Golf (15 chars) ``` $-I?p(:a):c(:a) ``` [Answer] ## Perl, ~~25~~ ~~14~~ 12 characters I believe this adheres to all of the requirements: ``` $_=a;fnl;say ``` Outputs `a`. After `rot13` the program looks like this: ``` $_=n;say;fnl ``` and outputs `n`. [Answer] ## Brainf\*\*k Since you never said the output had to actually be affected by rot13, this is totally a valid answer: ``` -. ``` Not sure why it was downvoted, although it is kind of a cheap answer. [Answer] ### PHP 6 ``` H<?//a ``` The program and its output differ by 83%, so not similar. `a` is not transformed into output, should satisfy all rules now. [Answer] # bash, 64 chars ``` _() { [[ "${1:0:1}" > U ]]&&rpub $@||echo $@; };_ Hello, Jbeyq. ``` ]
[Question] [ The task is simple: Create an if-statement from scratch in x86 assembly that runs in as few clock-cycles as possible. * Must be x86 assembly. * Can't use any of the *conditional* jump/branch instructions (e.g. `je`, `jne`, `jz`, `jg`, `jge`, `jl`, `jle`). * **Can** use `jmp` to jump to existing blocks of code. * **Can** use `cmp` if necessary. * Can't call any external libraries or functions. * Can't use `call`. * Free to use any of the other available instructions in the [Intel docs](http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf). * No C. * Any of the ~7 Intel Core architectures are acceptable (listed on [page 10](http://www.agner.org/optimize/instruction_tables.pdf)). Ideally Nehalem (Intel Core i7). * The `if` statement needs to check arbitrary conditions. Basically replicating the functionality of any one of the `je`, `jge`, etc. *conditional* jumps. The winning answer is one that uses the fewest clock cycles possible. That is, it can have the most operations per second. Approximate clock cycle summaries are here: <http://www.agner.org/optimize/instruction_tables.pdf>. Calculating clock cycles can happen after the answer is posted. [Answer] And then I realised that we can be faster, and use no additional registers: ``` cmp eax, ebx mov eax, offset false_case mov ebx, offset true_case cmove eax, ebx ;or cmovb, etc. jmp eax ``` [Answer] ``` xor ecx, ecx mov edx, 1 cmp eax, ebx cmove ecx, edx ;or cmovb, etc. jmp [false + ecx*4] false dd offset false_case true dd offset true_case ``` Accepts eax and ebx for the comparison. Replace the cmov with the corresponding check to perform. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/161669/edit). Closed 5 years ago. [Improve this question](/posts/161669/edit) Recreational languages win at code golf too much. This challenge is simple, when using higher level functions. **The task is as follows:** **Given any valid url, which is guaranteed to result in a valid HTML document** *(for example <https://en.wikipedia.org/wiki/Ruby_on_Rails>, which has 9 images)*, count the number of images displayed from the resultant webpage. Only images visible in the HTML code are counted, marked by the HTML `<img>` tag. Websites that can continually load images (Google Images) are not valid tests. [Answer] # JavaScript, 61 bytes As per [this consensus](https://codegolf.meta.stackexchange.com/a/13626/58974), the code needs to run under the same domain as the page being requested, to avoid CORS issues. Returns a Promise conatining the count. ``` u=>fetch(u).then(r=>r.text()).then(t=>t.split`<img`.length-1) ``` Thanks to [tsh](https://codegolf.stackexchange.com/users/44718/tsh) for pointing out some code I forgot to update before posting, saving 3 bytes. --- ## Try it ``` (f= u=>fetch(`https://crossorigin.me/`+u).then(r=>r.text()).then(t=>t.split`<img`.length-1) )(i.value=`https://codegolf.stackexchange.com/questions/161669/`).then(x=>o.innerText=x);b.addEventListener(`click`,_=>f(i.value).then(x=>o.innerText=x),0) ``` ``` <input id=i><button id=b>Count</button><pre id=o></pre> ``` [Answer] # CJam, 10 bytes ``` lg"<img"e= ``` Does not work online. Description: ``` l # read line g # open url and get html "<img" # this string e= # count arg2 in arg1 ``` [Answer] # [Python 3](https://www.python.org/) + [Selenium](https://www.seleniumhq.org) + [Firefox](https://www.mozilla.org/en-US/), 124 bytes ``` from selenium.webdriver import* d=Firefox() d.get(input()) c=len(d.find_elements_by_xpath('//img')) d.quit() print(c) ``` Notice that `https://en.wikipedia.org/wiki/Ruby_on_Rails` report 8 instead of 9. This is due to one of the `<img>` tag is contained by `<noscript>`, which is regarded as comment by a browser who enabled script. ~~Changing `webdriver.Firefox` to `webdriver.Ie` may save 5 bytes... But I just dislike IE.~~ **How to run:** * First install Python 3, and Firefox * install Selenium by `pip install selenium` * Download gecko driver and put it to your path * Run this script * A Firefox will be started, ignore it and input the url to stdin * The result will be shown on stdout [Answer] # Python 2 + BeautifulSoup, 103 bytes ``` import bs4 as B import urllib as U print len(B.BeautifulSoup(U.urlopen(input()).read()).findAll('img')) ``` Can't do a TIO as `BeautifulSoup` is not available there. This reports 9 for `https://en.wikipedia.org/wiki/Ruby_on_Rails`. **Note:** A warning is displayed before the number as a parser is not specified and `lxml`is taken as the default. Adding the `lxml` parser explicitly suppresses the warning but costs another 7 bytes. ``` import bs4 as B import urllib as U print len(B.BeautifulSoup(U.urlopen(input()).read(),'lxml').findAll('img')) ``` [Answer] # Bash, grep, and wc, ~~45~~ 28 bytes ``` curl $1|grep -o "<img"|wc -l ``` *-17 bytes thanks to tsh* Explanation: ``` curl $1 # download html from first parametre |grep -o "<img" # find all <img strings |wc -l # count lines ``` ]
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/69408/edit). Closed 8 years ago. [Improve this question](/posts/69408/edit) ## Task Write a program that will output another distinct program, and so on, while using as few distinct characters (and as few bytes) as possible. For example, program 1 should output program 2, and when program 2 is executed, it should output program 3. This can be nested as deeply as needed, but must be at least 3 distinct programs deep. --- ## Rules * Your program can take no input. * When the program is executed, the output should be the source of another, different program. This includes the STDERR stream. This can continue as many times as needed, but must occur at least three times. * The output source code may be in a separate language. --- ## Example ``` $ <program-1> <program-2> $ <program-2> <program-3> $ <program-3> <empty> ``` --- ## Scoring Each answer is scored by the following formula: ``` (length_in_bytes * number_of_distinct_characters) / number_of_distinct_programs ``` For example, if your answer was 10 bytes long, contained 5 distinct characters, and output 3 distinct programs, your score would be: ``` (10 * 5) / 3 ``` or `16.66`. Lowest score wins. --- Note: This challenge was inspired by the comments on [this StackOverflow question](https://stackoverflow.com/q/1049139/3496038). [Answer] # [Vitsy](https://github.com/VTCAKAVSMoACE/Vitsy), 8 bytes, 8 distinct character, ∞ programs (score 0) This is a simple proof in another stack-based language of Mego's comment. ``` 'Drd3*Z1 ' rd3*Z Standard quine formula D 1 Increase the number of ones every output (output 1 will have 11, 2: 111, 3: 1111, etc.) ``` [Answer] # Perl 5 - 34 bytes, 19 distinct characters, 10000000 programs (score 0.0000646) ``` $p="print q{$p}"for 1..1e7;print$p ``` The score can be lowered arbitrarily by increasing the constant `1e7`, at the expense of taking longer and producing larger programs. ]
[Question] [ **This question already has answers here**: [Build a numerical library without using any primitive data type](/questions/19955/build-a-numerical-library-without-using-any-primitive-data-type) (8 answers) Closed 9 years ago. You must write functions for addition, subtraction, multiplication, and division; however, you can never use any of your language's number types / primitives -- this means no ints, no floats, no Integers; no nothing. You cannot reference these types at all; not even implicitly, e.g. no pushing and popping numbers on a stack. Valid statically-typed pseudocode (does not solve the problem): ``` boolean result = true && false string helloWorld = "hello" + " world" Object[] things = [new Object(), "foo", true] ``` Invalid statically-typed pseudocode (does not solve the problem): ``` float num = 42F Object foo = "100".toInt() ``` To make things simpler, pointers are allowed. This is code-golf, so make it short and sweet. [Answer] # Haskell: 162 characters This is algebraic data types 101. ``` data N=E|Z|P N a x Z=x a x (P y)=a(P x)y s x Z=x s Z _=E s (P x)(P y)=s x y m _ Z=Z m Z _=Z m x (P y)=a x$m x y d _ Z=E d x (P Z)=x d Z _=Z d x y=a(P Z)$d(s x y)y ``` [Answer] # Javascript Example: 24.5-20.5+2\*1 = bd.e-bz.e+b\*a = 6 ``` f="bd.e-bz.e+b*a"; n=function(a){ if(a.match('^[+/*.-]$')) { return a; } if(a=="z") {a="`";} return a.charCodeAt()-"`".charCodeAt(); } o=[]; tx=f.split(""); tx.forEach(function(t,idx){ o.push(n(t)); }); o=o.join(""); eval(o); ``` [Answer] ## [REBEL](http://kendallfrey.com/projects/rebel.php) 3 + 9 + 23 + 29 = **64** --- Addition: ``` /;/ ``` Subtraction: ``` /0;0/;/;/ ``` Multiplication: ``` /0(0+;(0*))/$1:$2/0;|:/ ``` Division: ``` /(0+)(0*;\1$)/1$2/10|1;/1/1/0 ``` --- Input format: 2 strings of 0s, separated by a semicolon. The value is the length of the string. ``` 0000;00 ``` Output format: 1 string of 0s, with the same semantics. ``` 000000 ``` Since this works with natural numbers (positive integers), subtraction and division will not always yield the correct answer. Subtraction yields the absolute value of the result, and division rounds down. These are not complete programs, but they use the current state of the program as input. Similarly, they leave the program in the result state when they are done. Here is an example of how to use them (using division as an example): ``` 000000;00/(0+)(0*;\1$)/1$2/10|1;/1/1/0 ``` When this terminates, the current state will be `000`. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/186018/edit). Closed 4 years ago. [Improve this question](/posts/186018/edit) # Introduction In many programming languages, within syntax exceptions, it is often pointed out to the programmer exactly which character or line is the culprit. This challenge will be a bit of a modification of that - specifically, using an arrow to point out any specific character of an input string. # The challenge Your job is to: * Define a function that takes two parameters. * This function will print the string to `stdout` (or an acceptable alternative), along with pointing out the index of the string requested. * The index is zero-based, meaning index 0 is actually he first character of the string. * If a half index is passed in, you are to use a double arrow (`/\` instead of `^`) to point out the middle of the two characters. Don't quite get what I mean? Here's some test cases: `f("hello world", 3)`: ``` hello world ^ l ``` `f("Code Golf", 0)`: ``` Code Golf ^ C ``` `f("MY STRING!", 4.5)`: ``` MY STRING! /\ TR ``` You may use any language. No input from `stdin` - must be through a function. Do not use any of the [common loopholes](https://codegolf.meta.stackexchange.com/q/1061). And most importantly, have fun! # Leaderboard You can view the leaderboard for this post by expanding the widget/snippet below. In order for your post to be included in the rankings, you need a header (`# header text`) with the following info: * The name of the language (end it with a comma `,` or dash `-`), followed by... * The byte count, as the last number to appear in your header. For example, `JavaScript (ES6), 72 bytes` is valid, but `Fortran, 143 bytes (8-bit)` is invalid because the byte count is not the last number in the header (your answer will be recognized as 8 bytes - don't take advantage of this). ``` <iframe src="https://xmikee1.github.io/ppcg-leaderboard/?id=186018" width="100%" height="100%" style="border: none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,body{margin:0;padding:0;height:100%;overflow:hidden}</style> ``` [Answer] # [Python 2](https://docs.python.org/2/), ~~78~~ ~~77~~ ~~75~~ 74 bytes ``` def f(s,i):j=int(i);x='\n'+j*' ';print s+x+'/^\\'[i==j::2]+x+s[j:(i>j)-~j] ``` [Try it online!](https://tio.run/##K6gsycjPM/r/PyU1TSFNo1gnU9MqyzYzr0QjU9O6wlY9Jk9dO0tLXUHduqAIKKpQrF2hra4fFxOjHp1pa5tlZWUUCxQpjs6y0si0y9LUrcuK/Z@moZSRmpOTr1CeX5SToqSjYKzJBdbNBZRxzk9JVXDPz0kDihsgiftGKgSHBHn6uSsCJUz0TDX/AwA "Python 2 – Try It Online") -1 byte, thanks to Arnauld [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~25~~ ~~24~~ 23 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) ``` …^/\ć‚Y.ïè©XY.$®g£‚YúXš ``` Function taking `X` as string and `Y` as number, and returning a list of string-lines. [Try it online.](https://tio.run/##yy9OTMpM/a/0/1HDsjj9mCPtjxpmReodXn94xaGVEZF6KofWpR9aDBI7vCvi6ML/SqfbuJQyUnNy8hXK84tyUpRCFYzDFBQUDq1P0As7tFuHS8k5PyVVwT0/Jw0opaBggCrpG6kQHBLk6eeuCJI10TMNg0v@BwA) **Explanation:** ``` …^/\ # Push string "^/\" ć # Extract head; pop and push remainder "/\" and head "^" ‚ # Pair them together: ["/\","^"] Y.ï # Check if number `Y` is an integer (1 if truthy; 0 if falsey) è # Use that to index into the pair ("^" if integer; "/\" if decimal) © # Store it in the register (without popping) XY.$ # Remove the first `int(Y)` characters from string `X` ®g # Get the length of the string we saved in the register £ # Leave that many leading characters from the string ‚ # Pair it with the earlier "^" or "/\" Yú # Pad both with `int(Y)` amount of leading spaces Xš # Prepend string `X` to this list # (which is returned implicitly as result) ``` The function definition is: ``` "…^/\ć‚Y.ïè©XY.$®g£‚YúXš"ˆ ``` Which can then be called like this: ``` "MY STRING!"U 4.5V ¯`.V», ``` [Answer] # [C (gcc)](https://gcc.gnu.org/), ~~165~~ ~~125~~ ~~101~~ ~~99~~ ~~90~~ 85 bytes -40 Bytes @Kevin Cruijssen -24 Bytes @Arnauld -2 Bytes -9 Bytes @attinat -5 Bytes @ceilingcat ``` t,u;a(char*s,float i){t=i;u=i>t;printf("%s\n%*s\n%*.*s",s,t+u,L" ^尯"+u,t+u,++u,s+t);} ``` [Try it online!](https://tio.run/##bYtBCsIwEEX3niIGCkmbiqCuQt24KIK6UDeCCCFt2kDalCali9Iz6aW8hjEK7hyY4X/eGx4XnDtnSUcZ4iVrQ0OE0swCiQebSNolcm1p08raCgQDc62D8HtmoYHEEBt1ZAfB7fm4Qx8/NfJrIovp6PwXqJisER4mwA9DsMyV0qDXrcogAQtMm84aBCGmP2OjsxykWgnP53/4/gJO5@P2kE69sJytPBndiwvFCuNiVbm4fwM "C (gcc) – Try It Online") [Answer] # [Pepe](https://github.com/Soaku/Pepe), 229 bytes This took very long to make. Probably my longest Pepe code yet. Everything could be so much easier if not the third output line. I didn't write in Pepe for a long while so I'm proud of it. *Note: This is not a valid answer because the specs require it to be a function – but there are no functions in Pepe, officially.* ``` REEeReeeReeERREeeRREeEEerREEreeeEeEEEEreeEeEEEeeREeREEEerREEreeEeEEEEeREerEeeEeeeeerrEEeeeErereeeREEEERREEEEEEeReEReeErereeeRREEEEEEEREEEeRrErrEEREEEEReREEEeREEEEereerreErEereeREEEEReEereRrEeEEeRrEEEEEEErEEEerrEEREEEEReReEerEeree ``` [Try it online!](https://soaku.github.io/Pepe/#THJ-P--1@FV2XkD!p@FXoD!8g@_a$G!r-E5BJ$G-E7!p-_@E!r.!p-h*@AC*!rL$--0-E6!o@E!r.LC*) Non-minified code, with comments, if you can understand it... ``` # The line REEe # Take input Reee # Output it ReeE # End line # Index RREee # Take the number [n] RREeEEe # Floor in a copy # Function [n] rREE reeeEeEEEE reeEeEEEee # Output /\ REe # End # Move pointer to last item REEEe # Function floor[n], overrides [n] if it's an integer rREE reeEeEEEEe # Output ^ REe # Line 2 – spaces rEeeEeeeee # A space rrEEeeeE # Repeat it [n] times re # Remove one reee # Output # Line 2 – pointer REEEE # Go to first item RREEEEEEe # Copy to other stack ReE # Call it ReeE # End the line # Line 3 – spaces re # Remove the item reee # Output # Line 3 – letters RREEEEEEE # Move the index to other stack REEEe # Move R pointer to the end RrE # Prepend 0 rrEE # Label 0 REEEE # Go to the first item Re # Pop it REEEe # Go to the last item REEEEe # Decrement ree # Recurse while unequal rreE # Equal, end # This is a flag I've added because I thought that I should add something in its place # I never thought it will be useful. But apparently it is. For recursion. rEe ree # Call if unequal REEEE # Move to first item ReEe # Output it re # Pop the 0 RrEeEEe # Floor the first item in a copy RrEEEEEEE # Move the item to the other stack rEEEe # Move to the end rrEE # Label floor[n] REEEE # Move to first item of R Re # Remove it ReEe # Output the next one rEe # End ree # Enter it if [n] is not an integer ``` [Answer] # [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~100~~ 98 bytes ``` a=>b=>a+(b>(i=(int)b)?"/\\":"^").PadLeft((v=b>i?2:1)+i)+'\n'+a.Substring(i,v).PadLeft(v+i);int i,v ``` [Try it online!](https://tio.run/##bc3NisIwFAXgvU8Rs/GG1uqMulETF4IiqIg/iFCEpE31QkigjfXxO7UuZqG7w@HjnKToJgVWi4dNpoXP0d7CJmfGSR@@GyHI4rSdE04qyYXiQgagBCAHtJ4pNqO9OKZjeqUs2sl0rTMPUHIlcPY7/mEBsqAT204go8NDvScBw/IflzWZ1FukbqtJ65yj12u0Gl63QO/aGEeeLjdpbCmDAWOfaHMhh@N@tV22GzOMRtk3NnepJktnskb1a1L9AQ "C# (Visual C# Interactive Compiler) – Try It Online") [Answer] # Java 11, 103 bytes ``` (s,n)->{int i=(int)n;var t="\n"+" ".repeat(i);return s+t+(n>i?"/\\":"^")+t+s.substring(i,n>i?i+2:i+1);} ``` [Try it online.](https://tio.run/##hU89T8MwEN3zKw5PtpKa76VRysBQMTQDZUENSG7igItrR/YlCFX57cGpvCKW@3rv7t07iEEsDs3XVGvhPWyEMqcEQBmUrhW1hHJuAbbolPmAmsbCZ622AqFlecDHJASPAlUNJRgoYKI@M2yxOoVLoAoaEjP5IBxgQSpDUgKEO9lJgVSx3EnsnQGfYkrNSj2Qy6oiS/JOWJh47vu9P@tSlc2wSm@WKr1m@Tjls3TX73WQjh8MVjVwDE7is7s3ECza@PEoj9z2yLsAoTbU8JqST6m1hW/rdEMyuG3Z2dbf/EfbSFhb3Qb21b/szStsX56fyvVFoN/x@7gwJuP0Cw) [Answer] # [Jelly](https://github.com/DennisMitchell/jelly), 22 bytes ``` ⁾/\”^%?1,ịṭ€Ḟ’⁶xƲ{;@W} ``` [Try it online!](https://tio.run/##AUMAvP9qZWxsef//4oG@L1zigJ1eJT8xLOG7i@G5reKCrOG4nuKAmeKBtnjGsns7QFd9/8OnWf//Ny41/0hlbGxvIHdvcmxk "Jelly – Try It Online") A dyadic link which takes the position as its left argument and the string as its right. It returns a list of Jelly strings (presumed to be an ‘acceptable alternative’) representing the output. The TIO link outputs these to stdout separated by newlines. This is currently using 1-indexing since that is the norm for Jelly. If 0-indexing is a must, here’s an alternative dyadic link: # [Jelly](https://github.com/DennisMitchell/jelly), 23 bytes ``` ⁾/\”^%?1,‘ị¥ṭ€Ḟ⁶xƊ{;@W} ``` [Try it online!](https://tio.run/##AUUAuv9qZWxsef//4oG@L1zigJ1eJT8xLOKAmOG7i8Kl4bmt4oKs4bie4oG2eMaKeztAV33/w6dZ//83LjX/SGVsbG8gd29ybGQ "Jelly – Try It Online") [Answer] # [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 72 bytes Very similar to @TFeld's answer, but makes use of Python 3.8's handy `:=` lambda assignment operator. ``` f=lambda s,i:s+(x:='\n'+' '*(j:=int(i)))+'/^\\'[i==j::2]+x+s[j:(i>j)-~j] ``` [Try it online!](https://tio.run/##dcpBCsIwEADAu6@IvWzWRAWLIAvx7B@aCpVazBKTkBSsF78e8QGeZ9J7fsTQnlKudTJ@eN7GQRTtqCi5kAEbQIGAjWQyLszSIaKC/dVa6JwxTHTo1aJKxyTdmXH74b6m/KuTbC5376MWr5j9uG60aBFX/3F3RKxf "Python 3.8 (pre-release) – Try It Online") [Answer] # JavaScript (ES8), ~~65~~ 63 bytes Takes input as `(string)(position)`. ``` s=>n=>s+(x=` `.padEnd(n+1))+(n%1?'/\\'+x+s[~~n++]:'^'+x)+s[~~n] ``` [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1i7P1q5YW6PCNoErQa8gMcU1L0UjT9tQU1NbI0/V0F5dPyZGXbtCuzi6ri5PWzvWSj0OyNWE8GP/J@fnFefnpOrl5KdrpGkoZaTm5OQrlOcX5aQoaWoYaypoK6jH5KlrcqGpcwZar5Cen5MGVGWAU5VvpEJwSJCnn7siUJmJnqmm5n8A "JavaScript (Node.js) – Try It Online") --- # JavaScript (ES8), 39 bytes *This version is based on the challenge description, without the 3rd line. The original version above includes it, like suggested by the test cases. Awaiting OP clarification.* Takes input as `(string)(position)`. ``` s=>n=>s+` `.padEnd(n+1)+(n%1?'/\\':'^') ``` [Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1i7P1q5YO4ErQa8gMcU1L0UjT9tQU1sjT9XQXl0/JkbdSj1OXfN/cn5ecX5Oql5OfrpGmoZSRmpOTr5CeX5RToqSpoaxpoK2gnpMnromF5o6Z6A1Cun5OWlAVQY4VflGKgSHBHn6uSsClZnomWpq/gcA "JavaScript (Node.js) – Try It Online") [Answer] # [Stax](https://github.com/tomtheisen/stax), 21 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax) ``` ë└¥1ç4┴îdΩ8½öyε∙µ$%T▐ ``` [Run and debug it](https://staxlang.xyz/#p=89c09d318734c18c64ea38ab9479eef9e6242554de&i=%22hello+world%22,+3.0%0A%22Code+Golf%22,+0.0%0A%22MY+STRING%21%22,+4.5&a=1&m=2) ]
[Question] [ **This question already has answers here**: [Find the nth decimal of pi](/questions/84444/find-the-nth-decimal-of-pi) (17 answers) Closed 5 years ago. # Introduction In the not so distant future with the AI revolution, we will need a way to solve their captchas to prove we're not humans. This challenge was inspired by [CommitStrip](http://www.commitstrip.com/en/2015/07/06/meanwhile-in-a-parallel-universe/). # Challenge One such captcha is the challenge of calculating the sum of all odd digits of Pi from digit 1 to digit n, including the first digit, being 3. ### Output * The **calculated sum** of all odd digits in the range 1 to n. # Rules * All the digits of pi must be calculated by your program at runtime, how you implement that is up to you. * Hard-coded constants of pi are not allowed. * This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest bytes win. # Example If n = 6, we must find the sum of the odd digits in `[3, 1, 4, 1, 5, 9]` meaning an output of `19` # Other Since this questions keeps getting marked as a duplicate of [this](https://codegolf.stackexchange.com/questions/84444/find-the-nth-decimal-of-pi), allow me to explain how this is different. This question asks for the sum of a range of numbers, not finding the nth decimal. [Answer] # [Python3](https://docs.python.org/3.6/), 346 bytes Based on a recursive implementation of the [Chudnovsky algorithm](https://en.wikipedia.org/wiki/Chudnovsky_algorithm), one of the fastest algorithms to estimate pi. For each iteration, roughly 14 digits are estimated (take a look [here](https://www.craig-wood.com/nick/articles/pi-chudnovsky/) for further details). ``` def f(n):import decimal as d;d.getcontext().prec=n+10;q=lambda n,k=6,m=1,l=13591409,x=1,i=1:(d.Decimal(((k**3-16*k)*m//i**3)*(l+545140134))/(x*-262537412640768000)+q(n,k+12,(k**3-16*k)*m//i**3,l+545140134,x*-262537412640768000,i+1)if i<n else 13591409);return sum([ord(i)%2 and int(i)for i in str(426880*d.Decimal(10005).sqrt()/q(n//14+1))[:n+1]]) ``` Ungolfed version ``` def f(n): import decimal as d d.getcontext().prec = n + 10 q=lambda n, k=6, m=1, l=13591409, x=1, i=1:\ (d.Decimal(((k ** 3 - 16 * k) * m // i**3) * (l + 545140134)) / (x * -262537412640768000) + q(n, k+12, (k ** 3 - 16 * k) * m // i**3, l + 545140134, x * -262537412640768000, i+1)if i < n else 13591409) return sum([ord(i) % 2 and int(i)for i in str(426880 * d.Decimal(10005).sqrt() / q(n // 14+1))[:n + 1]]) ``` Function `q` computes the value of `S`(see the reference), than it is used to divide the term `426880 * d.Decimal(10005).sqrt()` and get the value of the approximation of pi. The precision is controlled by setting the value of `d.getcontext().prec`. A a little bit longer (372 bytes), more golfed but all-in-one version: ``` f=lambda n,k=6,m=1,l=13591409,x=1,i=0:not i and(exec('global d;import decimal as d;d.getcontext().prec=%d+10'%n)or sum([ord(i)%2 and int(i)for i in str(426880*d.Decimal(10005).sqrt()/f(n//14+1,k,m,l,x,1))[:n+1]]))or i<n and d.Decimal(((k**3-16*k)*m//i**3)*(l+545140134))/(x*-262537412640768000)+f(n,k+12,(k**3-16*k)*m//i**3,l+545140134,x*-262537412640768000,i+1)or 13591409 ``` Thanks to [O.O.Balance](https://codegolf.stackexchange.com/users/79343/o-o-balance) to push me to go deeper into this challenge: it was very fun and interesting. ## Old answer, based on `math.pi` (74 bytes) ``` import math;f=lambda n:sum([ord(i)%2and int(i)for i in"%.*G"%(n,math.pi)]) ``` [Try it online!](https://repl.it/repls/MintyReasonableLoaderprogram) N.B.: `math.pi` is ["The mathematical constant π = 3.141592…, to available precision."](https://docs.python.org/3.6/library/math.html), but the digits for the challenge are computed on the fly through the rounding and truncating operations. So, technically this is not a violation of the rules: *"all the digits of pi must be calculated by your program at runtime."* [Answer] ## Mathematica, 53 bytes ``` Total@DeleteCases[(RealDigits@N[Pi,#])[[1]],_?EvenQ]& ``` Mathematica noob, please excuse me. [Answer] # Ruby, 78 bytes ``` f=->n{"#{eval'x=2*10**n+p*x/=2+p+p-=1;'*x=p=4*n}"[0,n].bytes.sum{|c|c%2*c%16}} ``` Computes only to necessary precision. [Try it online!](https://tio.run/##DcPRCoMgFADQX5FGBFdzKlsvw/2I@FBST@simcNQv93twDnicrW26fGNubvl9Tt/hqQVSAGA1EO6a0U99aOWrwGS9voBWDsjGFq@XOcaeIh7Lq64XoHr5VRrM5KRiRElGHn@SyEs32efCxYfz0A2g7a2Hw "Ruby – Try It Online") [Answer] # [Husk](https://github.com/barbuz/Husk), 7 bytes As you can see [here](https://tio.run/##S0oszvj/Xz@/oEQ/o7Q4W98DSCjolioonVucpmr0qG3ikQ3nG5QUzBTs9FNSy/TzSnNyFIzs1Ay5uJITSxT08ktL9DKK//8HAA)1 the following program, does indeed compute all the digits itself: ``` Σf%2↑İπ ``` [Try it online!](https://tio.run/##yygtzv7//9ziNFWjR20Tj2w43/D//38zAA "Husk – Try It Online") ### Explanation ``` Σf%2↑İπ -- implicit input N, eg: 8 İπ -- compute all digits of pi: [3,1,4,1,5,9,2,6,5,3,... ↑ -- take N: [3,1,4,1,5,9,2,6] f%2 -- filter out even ones: [3,1,1,5,9] Σ -- sum: 19 ``` 1: This is a link to the Haskell code which is generated by Husk, in case you're lost (it's quite long) just search for `func_intseq 'π'`.. [Answer] # Java 10, 275 bytes ``` import java.math.*; n->{int j,t,i=0,s=3;for(;i<n-1;++i){var a=BigInteger.TEN.pow(10010).multiply(new BigInteger("2"));var p=a;for(j=1;a.signum()>0;p=p.add(a))a=a.multiply(new BigInteger(j+"")).divide(new BigInteger((2*j+++1)+""));s+=((t=(p+"").charAt(i+1)-48)%2)*t;}return s;} ``` Uses the approach from [this](https://codegolf.stackexchange.com/a/97365) answer by [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen) to calculate the digits. Try it online [here](https://tio.run/##dZHBitswEIbvfoohUJDiRGunPbRotdBCDzlsG9jeSg@zseLItWUhjb0Nwc@eSk5KS2HnMNKMfn2MfjU44rqpfl5M53pP0MRadEhHsZTZ3R2UH0D/Io/wfCId4NB7oKOGqzpzw3Nr9rBvMQR4RGPhnEEMY0n7A@417G6dWxccS9lyOXenOd8ogZDiMvamgi6y2BN5Y@vvPwB9Hfg/oB04Awoudv1wTrhmRSujilVQb2WckElzb9elzHPDzyN6QPXJ1Ns4U629@Pb5i3D9CyuLoiy46IaWjGtPzOoX@Ctji82Cc5luO4UztVGlRBFMbYeO8YdCOuUEVhVDzlHhq6QmX0SUqMxoKv3/IdssmzzPSz6LZMgVY6SYS6XYH9F/JGbi8frde/5mw5ckJ69p8BaCnC5/DAGZZVe3YLeNzlz3YsR20F8P7DH95257M32Op1Mg3Yl@IOGillrLZkF6aLI0@VvIuNxHomi1renIOERXIdmavQZxRrh54Mi6iqZsuvwG). [Answer] # Python 3, 119 bytes ``` y=sum([int(i)for i in str(sum([4/j if j%4%3 else-4/j for j in range(10**8)if j%2]))[0:n+1].replace('.','')if int(i)%2]) ``` My first code-golf submit, so please be gentle .\_. This computes pi on the fly using the Gregory-Leibniz series. X may prove insufficient for big n, but be aware of the RAMifications of choosing a large x. ## Explanation: ### Computation of Pi: i.e. `sum( [4/i if i%4==1 else -4/i for i in range(x) if i%2==1] )` with x as large as sensible, also `i%4==1` is one byte larger than `i%4%3`, so that's nice... ### Casting **a lot** and eventual sum: I'm sure there are better possibilities than all this, but I cast the float to string, take the first n\*1 chars (including the dec point), replace the point, then cast each char in my string to int for the modulo check at the very end of the code, and take the sum of all i that are odd to assign them to y. ### Room for improvement: I'm sure there's lots, but I am the least happy with the series to compute pi, and also with the multiple int() casts ad the need to replace the dec point... *HELP* [Answer] # SmallTalk – 299 bytes Relies on the identity `tan⁻¹(x) = x − x³/3 + x⁵/5 − x⁷/7 ...`, and that `π = 16⋅tan⁻¹(1/5) − 4⋅tan⁻¹(1/239)`, so no “cheats”. ``` |l a b c d e f g h p t s|l:=stdin nextLine asInteger. a:=1/5. b:=1/239. c:=a. d:=b. e:=a. f:=b. g:=3. h:=-1. s:=0. l timesRepeat:[c:=c*a*a. d:=d*b*b. e:=h*c/g+e. f:=h*d/g+f. g:=g+2. h:=0-h]. p:=4*e-f*4. l timesRepeat:[t:=p floor. p:=(p-t)*10. t odd ifTrue:[s:=s+t]]. Transcript show:s printString;cr ``` Save as `pi.st`. You provide the number of digits from the console when you run it, or through the `<<<` operator. ``` $ gst -q pi.st <<< 6 19 ``` ]
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/67729/edit). Closed 8 years ago. [Improve this question](/posts/67729/edit) **Objective** Write the shortest program possible that adds semicolons to the end of all lines of code in a file **unless**: * it already has a semicolon at the end * the line is blank. Must be a complete program. **Bonuses** Write the program so it won't produce any compiler errors when running the program on a C Header File. [Answer] # Retina, 12 bytes ``` m`[^;¶]$ $0; ``` [Try it online!](http://retina.tryitonline.net/#code=bWBbXjvCtl0kCiQwOw&input=Zm9vOwpiYXIKCmJheg) ### How it works ``` m` Activate multi-line mode. [^;¶] Match any character but a semicolon or a linefeed... $ followed by the end of the line. $0 Replace the match with itself... ; followed by a semicolon. ``` [Answer] # Perl, ~~19~~ ~~15~~ 14 bytes ``` s/[^;]$/$&;/ ``` [Try this fiddle online](http://ideone.com/fork/B36z25) or [this test suite.](http://ideone.com/fork/cKO4aX) Must be run with the `-pl` flags; this is accounted for in the score. Thanks to @manatwork for -4 bytes. [Answer] ## JavaScript ES6, 69 bytes ``` alert(prompt().split`\\n`.map(x=>x.match(/;$|^$/g)?x:x+';').join`\n`) ``` In the input, separate the newlines by `\n`, e.g. `some;\ncode\nthere` ]
[Question] [ **This question already has answers here**: [Code-Golf: Permutations](/questions/5056/code-golf-permutations) (30 answers) Closed 8 years ago. This is code golf. Fewest bytes wins, only standard libraries, etc. Write code, in any language, to output all possible same-length permutations of all items of an array / list / object in the input format and any order, grouped in whatever way you like. The items can be of ANY type, as allowed by the programming language. Example input and output (inputting array, outputting array of arrays). Inputs: ``` [1, 2, 3] ``` and outputs: ``` [ [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1] ] ``` [Code-Golf: Permutations](https://codegolf.stackexchange.com/questions/5056/code-golf-permutations) reposts not allowed! [Answer] # Pyth, 3 bytes ``` .pQ ``` :D [Live demo.](https://pyth.herokuapp.com/?code=.pQ&input=%5B1%2C+2%2C+3%5D&debug=1) ]
[Question] [ **Introduction** Hello! This is my second post, and I decided to do one which is more language specific, since my [last](https://codegolf.stackexchange.com/questions/36621/shortest-code-to-randomly-place-points-and-connect-them/) one was very much orientated towards mathematical languages, and thus did not leave room for languages like JavaScript or HTML. If there is anyway to make this more clear, or to tidy up a wording problem, please do not hesitate to leave a comment below this post. **The Task** You have to create a [JavaScript](http://en.wikipedia.org/wiki/JavaScript) program which, when pasted into chrome's [omnibar](https://support.google.com/chrome/answer/95440?hl=en-GB) will open up the wonderful [Google](https://google.com) page. **The Catch** You may not use any characters within the google URL ("ceghlmopstw") or those characters in any other base. Also, you may not use any other links, redirect links or IP addressed. **Extra Information** * You can put JavaScript code in the omnibar by doing "JavaScript://Code" * You cannot copy and paste javascript code into the omnibar. The code below will actually strip the "javascript:" part, the result of which is to simply search for "alert("Hello World!"). To get around this, I suggest typing your code in an IDE, such as Notepad++ without the "JavaScript:" and then add it in the omnibar when you go to test it. javascript:alert("Hello World!") * As this is code golf, the shortest entry wins! **Bonuses** * Each bonus will take away a certain amount of points from the **total** amount of characters, bonuses that are percentages will stack, so if one received a 20% bonus and a 25% bonus, they would in essence receive a 45% bonus. * **25%** - Changeable - You can change the website URL without doing complicated maths, or having to change the entire code! * **50 chars** - NoScript - Don't use any JavaScript! I have no idea how your going to achieve this! * **25 chars** - Exceptional - Don't use the ".:/" characters in your code. Removed from the main task as "JavaScript:" requires a colon. * **15 chars** - Multi-lingual - Make a solution that makes use of 3 or more languages! **TL;DR** You must code something to put in the chrome omnibar, that then redirects you to <https://www.google.com> without using the characters "ceghlmopstw" **Leader Board** ``` soktinpk - 24 - Exceptional - First post to complete it in a way I had expected! Someone - -40 - NoScript - Used a redirect link however. Points for finding one without those characters, all of the ones I just found did! Von llya - -37 - NoScript - Used an IP address! ``` [Answer] # Javascript - 49 chars + (Exceptional bonus) = 24 There's a catch for this one; you have to have it open on this page. Also it will break as more links come to it. It requires jQuery. ``` javascript:$("a")[35][(r=(""+{})[5])+(""+!1)[2]+"i"+r+"k"]() ``` Commented version ``` $("a")[35] // Gets the 35th link (to google) [ (r=(''+{})[5]) // ''+{} is "[object Object]" get 5th char "c", assign it to variable r +(''+!1)[2] // grabs "l" +"i"+r+"k" // "ick" which makes "click" function ]() // Execute ``` As more links get published, you have to update the `35` to accomodate. (Again, it only runs on this page). Tested on Chrome 35.0.1916.153 [Answer] # No JavaScript ``` x.vu/zffW4Z ``` It took quite some searching to find an URL shortener that (a) was still around, and (b) avoided the prohibited characters. ]
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/33245/edit). Closed 9 years ago. [Improve this question](/posts/33245/edit) People sometimes make spelling eorrors. A lto. Your challenge is to write a program that can take a string with certain spelling errors, such as the switching of I and E, and correct those mistakes. This has to be able to make changes to any combination of characters in any string, and fix the spelling errors. This is a [popularity-contest](/questions/tagged/popularity-contest "show questions tagged 'popularity-contest'"), the winner will be chosen in three days. If I need to clarify any additional details, please do say, and I will add it to my challenge. Good luck! # Rules * You may read correctly-spelled words from a file. * You will read the string from standard input. * You need only correct basic spelling errors. * It's ok if your program makes a *few* errors. [Answer] for a real "good" correction, we need to know the set of words which are "reasonable". In a program editor, this depends on the word before the cursor. This may be either a class or variable name, or the name of the function to be called (some syntax awareness required here). In a general text editor, this would be a list of words from a dictionary. In the following code, I assume that the list of "good" words is found in "candidates", in Smalltalk this would be one of: ``` Smalltalk allClasses collect:[:cls | cls name] ``` for class names, or ``` Smalltalk allClasses collectAll:[:cls | cls methodDictionary keys] as:Set ``` for the names of all methods. Of course, in a real world corrector, this would take into account the current scope to restrict the set of possible candidates. The code then selects the best candidate by its editing distance, which is the distance between two strings based on the weighted number of insert, delete and replace operations required to change one string onto another. All Smalltalks provide a "spellAgainst:" method in their String class, which is based on levenshtein or a similar algorithm. ``` "the following is of course very Smalltalk dialect specific, as the GUI frameworks are slightly different. It assumes there is an editor object, which represents the code edit window." candidates := <one of the above>. wordToFix := editor wordBeforeCursor. best := candidates detectMax:[:each | each spellAgainst: wordToFix]. editor selectWordBeforeCursor. editor replaceSelectionBy:best. ``` PS: one of the coolest features of Smalltalk is that the IDE is part of your program and vice versa (they are the same), so you can actually add the above code fragment to your editor's keyPress method and have it work immediately! [Answer] # Python This uses Levenshtein distance, but doesn't account for non-alpha characters and case. Corrects single misspelled words. Enter a string on stdin, output on stdout, and have a newline separated list of words in a file called words.txt in the same directory. ## Code ``` # Open list of correcly-spelled words. wordFile = open("words.txt") threshold = 8 listOfWords = input().split() index = 0 def lev(a, b): if min(len(a), len(b)) == 0: return max(len(a), len(b)) else: return min(lev(a[:-1], b) + 1, lev(a, b[:-1]) + 1, lev(a[:-1], b[:-1]) + int(not a[-1] == b[-1])) for x in listOfWords: replacement = (x, threshold + 1) for word in wordFile: x = x.lower() word = word[:-1].lower() if x == word: replacement = (x, 0) break # Some words may actually be spelled correctly! d = lev(x, word) if (d < threshold) and (replacement[1] > d): replacement = (word, d) listOfWords[index] = replacement[0] index += 1 wordFile.seek(0) print(*listOfWords) ``` # Bugfix All words are corrected now. ]
[Question] [ **This question already has answers here**: [Write a mathematical function whose result is "hello world" [closed]](/questions/17511/write-a-mathematical-function-whose-result-is-hello-world) (16 answers) Closed 10 years ago. The challenge is to come up with a mathematical way to generate each character of the exact string: > > Hello, world! > > > (Capital letter, comma, exclamation mark.) But you can't use any strings, arrays, or equivalents, to contain the data of the text. You must derive the characters by mathematical means. So just a list or array of characters or ASCII codes or numbers trivially offset or inverted or shifted does not count. Nor does downloading it from an external resource or taking user input. Nor does starting with a large number which is just each ASCII codes shifted and ORed together, etc. You can use any programming language, any mathematical functions, math libraries, etc. The characters can of course be strings as you generate them. **Think of something like generating the digits of π.** The winner shall be the one with the most cleverness and/or elegance. The relevant weightings of cleverness and elegance are up to your peers, for the winner shall be decided by voting. (Finding a loophole in my poor problem statement shall not be regarded as clever d-:) I think you can get the jist so don't cheat and if I should make it clearer or close some loopholes then please comment. [Answer] ## HQ9+ ``` H ``` If you need more mathematics, `H+++++++++++++++++++++++++++++++++++++++++` should suffice. [Answer] # Javascript ``` String.fromCharCode(72)+(681180).toString(36)+String.fromCharCode(44)+String.fromCharCode(32)+(54903217).toString(36)+String.fromCharCode(33) ``` It uses a few ASCII codes, but not for most of the text. [Answer] ## Brainfuck ``` -[------->+<]>-.-[->+++++<]>++.+++++++..+++.[->+++++<]>+.------------.--[->++++<]>-.--------.+++.------.--------.-[--->+<]>. ``` ]
[Question] [ Write the shortest iterative function to find gcd of two numbers (assume 32 bit numbers). **Rules:** * Arithmetic, Comparison and Logical Operators are not allowed **(except equality comparison (`a==b`) operator)**. * Function should work for both positive and negative numbers * No inbuilt functions allowed. * All bitwise operators allowed. [Answer] ## Python - 196 bytes ``` def A(a,b): while b:a,b=a&~b|~a&b,(a&b)<<1 return a def G(a,b,i=0): if a>>31:a=A(~a,1) if b>>31:b=A(~b,1) while~a&b|a&~b:c,d=~a&1,~b&1;i=A(i,c&d);a,b=[b,a>>c,A(a,b),b>>d][c|d::2] return a<<i ``` Sample usage: ``` from random import randint for i in range(10): a = randint(-2147483647,2147483647) b = randint(-2147483647,2147483647) print 'gcd(%d, %d) = %d'%(a, b, G(a,b)) ``` Sample output: ``` gcd(-36916085, -1872111029) = 1 gcd(1355889652, 1816917540) = 188 gcd(-366482295, 1612196424) = 9 gcd(836632083, -1156302534) = 3 gcd(1223074731, -1299765354) = 123 gcd(-1154829176, 522085100) = 4 gcd(-1673024403, 1589241938) = 1 gcd(-1871498822, -1089342630) = 2 gcd(1653429392, 2095617430) = 2 gcd(1525670601, -1985869899) = 39 ``` --- ### Implementation Notes * `A` -> a function which adds two integers. * `a&~b|~a&b` -> `a^b` * `if a>>31` -> `if a<0` * `a=A(~a,1)` -> `a=-a` (taken together, `if a>>31:a=A(~a,1)` -> `a=abs(a)`) * `~a&1` -> `a%2==0` a.k.a. `a` is even. The function `G` begins by removing powers of 2 from both `a` and `b` (and shifting the result if both are even). When both `a` and `b` are odd, it continues on with `a=b, b=(a+b)/2`. This works because `gcd(a, b) = gcd(a, a+b)`, and `a+b` is necessarily even. This would terminate noticeably sooner using a comparison and a subtraction (subtracting the smaller value from the larger), but neither are available. ]
[Question] [ So I got kinda bored and was wondering if it was possible to make this code shorter without modifying anything except a file named coin.py... ``` from random import*;c=['heads','tails'];print('u win'if choice(c)==input(' / '.join(c)+': ')else'u lose') ``` The program asks the user for either "heads" or "tails", if the result from `random.choice(c)` matches the user's input, print "you win" to the console. Otherwise print "you lose" to the console. Example: ``` heads / tails: tails u win heads / tails: tails u lose ``` (no loop needed btw, just run once) Maintaining all its functionality & having the EXACT same output Have fun, stack exchage :) Update: Security practices don't matter for this question [Answer] Few improvements off the top of my head: 1. (Shaves two characters) You don't need a `list`, a `tuple` will do, so: ``` c=['heads','tails'] ``` can shorten to (parentheses around `tuple`s are optional when it has at least one item and it's unambiguous): ``` c='heads','tails' ``` 2. (Shaves four characters) You can interleave the two output strings into a single one, and do a slice skipping by 2, with the start point based on your condition, shaving: ``` print('u win'if choice(c)==input(' / '.join(c)+': ')else'u lose') ``` down to: ``` print('uu lwoisne'[choice(c)==input(' / '.join(c)+': ')::2]) # Or if you prefer, no change in length: print('u','lwoisne'[choice(c)==input(' / '.join(c)+': ')::2]) ``` 3. (Shaves five characters) Use `printf`-style formatting to construct your string, now that `c` is a `tuple`, this is cheap: ``` print('uu lwoisne'[choice(c)==input(' / '.join(c)+': ')::2]) ``` to: ``` print('uu lwoisne'[choice(c)==input('%s / %s: '%c)::2]) ``` ]
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/187608/edit). Closed 4 years ago. [Improve this question](/posts/187608/edit) **Create your smallest web server in your preferred language!** Requirements Must respond to atleast 1 type of request (get,post,patch,delete), with a specified string. Smallest implementation wins! \*String can be empty You may use any library you want My personal record for this was 56B in node ``` require('express')().use((r,w)=>w.send('')).listen(8080) ``` [Answer] # [APL (Dyalog Unicode)](https://www.dyalog.com/) with [MiServer](http://miserver.dyalog.com/), 8 bytes ``` Start'.' ``` Starts a website on port 8080 serving the current directory. This is what an interactive session transcript can look like: ``` )xload miserver .\miserver.dws saved Thu Apr 4 23:27:46 2019 Start'.' Virtual alias "PlugIns" overrides site path of same name. MiServer for "." started on http://10.101.1.172:8080 Running in Debug mode (configured by setting <Production> in /Config/Server.xml) ``` [Answer] # [Python 3](https://docs.python.org/3/) with -m http.server, 11 bytes No code. Just run python. [Try it online!](https://tio.run/##K6gsycjPM/4PBP/yC0oy8/OK/@vmKmSUlBToFacWlaUWAQA "Python 3 – Try It Online") ]
[Question] [ # Challenge Return the full contents of your program, but inverted. How do your invert something? Well, **Letters**: Take the position of the letter in the alphabet, subtract from 26, and use the letter at that position and flip the case of the letter. E.g `A` becomes `z`, and `p` becomes `J`. **Digits**: Subtract from 9. E.g `6` becomes `3` and `5` becomes `4` **Brackets**: The brackets `(){}[]<>` become their corresponding closing/opening bracket. E.g `[` becomes `]` and `>` becomes `<` **Other** * `&` and `|` swap. * ' ' [space] and '\n' [newline] swap. * `£` and `$` swap, as do `€` and `¥` * `¢` and `%` swap * `_` and `-` swap * `"` and `'` swap * `?` and `!` swap * `:` and `;` swap * `/` and `\` swap * `@` and `#` swap * `~` and ``` swap * `,` and `.` swap * `©` and `®` swap All other characters become their Unicode inverse (subtract from 137,374). However, if the result is specified above, **you must replace it again with the replacement provided**. You only need to run a maximum of two replacements on each character, so no infinite loops. # Rules * Standard loopholes are disallowed ### Good luck! [Answer] # [Perl 6](https://github.com/nxadm/rakudo-pkg), 142 bytes ``` <my@a='a'..'z',@("<(|;~'@./𡡡£-".comb);my@b=@('Z'...'A'),@(Q'>)&:`"#,\=$_'.comb);"<$_>~~.EVAL".trans(pair((|@a,|@b),(|@b,|@a))).say>~~.EVAL ``` [Try it online!](https://tio.run/##K0gtyjH7/98mt9Ih0VY9UV1PT71KXcdBQ8lGo8a6Tt1BT//DwoULDy3WVdJLzs9N0rQGKkyyddBQjwIq1VN3VNcEKg5Ut9NUs0pQUtaJsVWJV4eqVLJRiberq9NzDXP0UdIrKUrMK9YoSMws0tCocUjUqXFI0tQBspKArERNTU294sRKmOr//wE "Perl 6 – Try It Online") Avoids using most of the annoying to represent characters. I think this could be shorter [Answer] # [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 147 [bytes](https://tio.run/##yy9OTMpM/f/fQMnF2OTw8sN7z209PEHv8PpMy3MbD68@POHwwsDMo/syXSqzTY2AIisOr1aPDcw8tOvQssOrQRqMLQ8vP7Q6NOJRwzwdvbBIryPtLkcXHF6aGXG46VHDwkgwCTSn/VHDIqPgQzuBFNCU5bFedLUuIdbr/38A) ``` 0"D34çýεÐ.ïi9αëÐáQižiDyk52αèë']Qiº¦ë34ç39ç«UX„,.VYJćDŠåiX‡Y‡ëÇ•2S¹•αçJ]J"D34çýεÐ.ïi9αëÐáQižiDyk52αèë']Qiº¦ë34ç39ç«UX„,.VYJćDŠåiX‡Y‡ëÇ•2S¹•αçJ]J ``` Outputs: ``` 9'x65𡞷𡞡𡓩𡟎,𡞯S0𡓭𡞳𡟎𡞽kS𡜠SxCQ47𡓭𡞶𡞳"[kS𡟤𡟸𡞳65𡞷60𡞷𡟳gd🢀.,fcr𡞗x𡜾𡞹Sd𡟜🡽c𡟜🡽𡞳𡟗🡼7i𡟥🡼𡓭𡞷r[r'x65𡞷𡞡𡓩𡟎,𡞯S0𡓭𡞳𡟎𡞽kS𡜠SxCQ47𡓭𡞶𡞳"[kS𡟤𡟸𡞳65𡞷60𡞷𡟳gd🢀.,fcr𡞗x𡜾𡞹Sd𡟜🡽c𡟜🡽𡞳𡟗🡼7i𡟥🡼𡓭𡞷r[r ``` [Try it online.](https://tio.run/##yy9OTMpM/f/fQMnF2OTw8sN7z209PEHv8PpMy3MbD68@POHwwsDMo/syXSqzTY2AIisOr1aPDcw8tOvQssOrQRqMLQ8vP7Q6NOJRwzwdvbBIryPtLkcXHF6aGXG46VHDwkgwCTSn/VHDIqPgQzuBFNCU5V6xXvS27/9/AA) If this can be done in 4 bytes without creating a new language doing this specific task I'd love to see it.. >.> Also, based on the characters to invert I almost have the feeling it's deliberately targeting 05AB1E.. xD Probably not the case, but almost all those characters are pretty frequently used builtins in 05AB1E.. ## Explanation: **[quine](/questions/tagged/quine "show questions tagged 'quine'")-part:** The shortest [quine](/questions/tagged/quine "show questions tagged 'quine'") for 05AB1E is this one: `0"D34çý"D34çý` (**14 bytes**) [provided by *@OliverNi*](https://codegolf.stackexchange.com/a/97899/52210). My answer uses a modified version of that quine by adding at the `...` here: `0"D34çý..."D34çý...`. A short explanation of this quine: ``` 0 # Push a 0 to the stack (can be any digit) "D34çý" # Push the string "D34çý" to the stack D # Duplicate this string 34ç # Push 34 converted to an ASCII character to the stack: '"' ý # Join everything on the stack (the 0 and both strings) by '"' # (output the result implicitly) ``` **Challenge part:** ``` ε # Map each character in the string to: Ð.ïi # If it's an integer: 9α # Get it's absolute difference with 9 ëÐáQi # Else-if it's a regular letter ([A-Za-z]): žiD # Push "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" twice yk # Get the index of the current character 52α # Get the absolute difference with 52 è # And index it into the string again ë']Qi '# Else-if it's a "]": º # Mirror it to "][" ¦ # And remove the first character so just "[" remains 34ç # Push '"' 39ç # Push "'" « # Merge them together: `"'` UX # Save it in variable `X` „,. # Push ",." VY # Save it in variable `Y` J # Join the character, `"'` and ",." together ć # Extract the head (the character) DŠ # Duplicate and triple-swap, so the stack becomes char, `"',.`, char ë åi # Else-if the character is in this string: X # Push variable `X` and its reverse ‡ # Transliterate the character Y # Push variable `Y` and its reverse ‡ # Transliterate the character ë # Else: Ç # Convert the character to its unicode value •2S¹• # Push compressed integer 137374 α # Take the absolute difference between the two ç # Convert it to a character again J # Join (workaround because very high unicode characters are wrapped # in a list for some reason) ] # Close all if-else statements and map J # Join every mapped character together to a single string # (and output the result implicitly) ``` [See this 05AB1E tip of mine (section *How to compress large integers?*](https://codegolf.stackexchange.com/a/166851/52210) to understand why `•2S¹•` is `137374`. ]
[Question] [ **This question already has answers here**: [Build a polyglot for Hello World](/questions/10695/build-a-polyglot-for-hello-world) (9 answers) Closed 7 years ago. Often I need a simple Hello World! program to show some basic concepts of a programming language on my travels. As I usually travel only with light luggage I can't to carry a Hello World! program for each language. So a program that generates Hello World! programs in as many languages as possible would be a great help. # Task Write a program or function that accepts a language as an input and outputs or returns the source code for program or function that accepts no input and outputs (not returns) *Hello World!*. # Input The input defines in which language the Hello World! program should be generated. The input can be a number, a string, or whatever is the easiest for you. The input must only be used to select the language. You are not allowed to use the input as part of the output. Please specify the valid inputs in your answer. # Output The output can the return value, or be written to a file or STDOUT (or equivalent). It must full program of function in the language defined by the input. The resulting program/function must write Hello World! to STDOUT (or equivalent for the language). The output doesn't need to be exactly "Hello World!". Everything reasonably recognizable as *Hello World!* is acceptable. Eg. *"HeLLo w0rlD1"* would be an acceptable output. Also the resulting *Hello World!* string can be different for different languages. See bonus points section for more details. # Scoring The program should work for as many languages as possible, and be as short as possible. Therefore the score is calculated by number of bytes / (number of supported languages - 1). Eg. an answer with 15 bytes and 3 supported languages would have a score of 7.5. As usual with code-golf challenges lower scores are better. # Bonus points * You can subtract 10 percent from your score if the resulting *Hello World!* output for all supported languages is the same. * You can subtract and additional 10 percent from your score if the output for all supported languages is exactly *Hello World!* [Answer] # PHP, 13 bytes, 9 languages, Score: 1.625\*0.9^2 = 1.31625 ``` Hello, World! ``` **Explanation:** `Hello, World!` outputs `Hello, World!`. This can be used as input, and produce the same output in at least 9 languages. Here's a list of languages this works for: 1. [Chaîne](https://codegolf.stackexchange.com/a/62568/31516) 2. [///](https://codegolf.stackexchange.com/a/55536/31516) 3. Lines 4. [if(j)invert()if(l)change()if(q)input()if(t)output(x);](https://codegolf.stackexchange.com/a/62574/31516) 5. [Carrot](https://codegolf.stackexchange.com/a/62566/31516) 6. [MicroSoft Windows HTA](https://codegolf.stackexchange.com/a/57070/31516) 7. [PHP](https://codegolf.stackexchange.com/a/55441/31516) 8. [pl](https://codegolf.stackexchange.com/a/67246/31516) 9. [Dogless](https://codegolf.stackexchange.com/a/59108/31516) 10. [Swap](https://codegolf.stackexchange.com/a/59101/31516) --- This would give a fairly low score too, in Octave: ``` disp('print("Hello, World!")') ``` It prints `print("Hello, World!")` and should work in Perl, R, Ruby, Julia, Python 2, Python 3, Qbasic, Zsh/ksh, Cheddar among others. Thanks to Dada for noticing I had capital instead of lower case `P`. ]