问:
Deciphering XKCD colors
Randall Munroe (author of XKCD) held a survey to give names to colors. The main outcome is a list of names for the 954 most common RGB monitor colors.

For ease of programming, here is the list in plain text: http://xkcd.com/color/rgb.txt. Beware, the first line is not data, but contains the license.

Write a program or function that takes a valid color name from above list as input and outputs the associated RGB color code. Your program does not have to handle invalid inputs in any defined manner.

Standard loopholes apply. Additionally, your answer must not use pre-defined (built-in or external) color code <-> color name maps. (This includes the linked list.) Shortest code in bytes wins. If you read from a file, the file's byte count must be included.

Examples:

```<code>dark peach -> #de7e5d
robin's egg blue -> #98eff9
pink/purple -> #ef1de7
</code>```

答:
Groovy, <s>153 + 10,697 = 10,850</s> 253 + 9870 = 10,123 bytes

I decided I wanted a solution which involved only one file, so (at the obvious cost of space) I encoded a GZIPped CSV version of the data to Unicode characters 0x0020-0x007E (which I guess would be a base 95 encoding?).  The code is 253 characters, the content of the String is 10123 characters.

```<code>import java.util.zip.*
t=0
'''^/3"O:<]NULAydP{|dgMn0T4;4&Y!~0=(BsILP$#KxAoQ<C6Z-.Psh/}k3&uOEa[S}R+u4=X*K`?X&zTKSQT>xdA-_XEy2/e{N$Ue:DSF- *Df1E3x)i=cq;FFq]|p,!sbQpE5F}$qr]zu'jK&A^\\Vd9"sKPgF_^uv>q)6#/"b1#gR"yvZ#<p9{T+__!fl\\\\=7P{zO0('G R+5QKuX}( ,r$V]" ;G)\\3Yooo}<)%HrxnFWLtG1Dwe!N Nz*u;Ti`TI}ly@T.zA!Lx{w#e0[:Y@feo,=^M|D7qwZLHz2Hss&:z!%W2s|1S%TK]MaH]$KzQGR=*uue5O{d~J{%hU+[0_2z&|iiw )\\aq?(5:~l_u%6U^,&V&N$1YoYUX]E%}T`MN=/#KA?@['=]c|l?=!S9v,S|1]2do8cx>Q`WA]+ nMK_YDa~TdM+Ot4v[Ty\\){}zl0FG2cF**j'tN<g@>^ s='jDcXj|j],2P:p>3_V4$ybMXP?|7D4+W{Mmtsbs#S\\eZH!BUj.1_{@k/YPKe"D2yJ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npt2/&:SEAYc'ycCiG'McJ"wna)i25\\D9YKl>vD;4QrVW\\LAN{ePJw]uhy>C;xR1?'?NN4?PU`f-.'7UbULY|%|'%!'''.eachWithIndex{c,i->t+=95g**i*(((byte)c)-32g)}
b=[]
while(t){b<<(byte)(t%256-128)
t=t.intdiv(256)}
println new GZIPInputStream(new ByteArrayInputStream((byte[])b)).readLines().collectEntries{(List)it.split(',')}[args[0]]
</code>```

For readability, here's the same thing with the encoded text excluded:

```<code>import java.util.zip.*
t=0
'''^/3...'%!'''.eachWithIndex{c,i->t+=95g**i*(((byte)c)-32g)}
b=[]
while(t){b<<(byte)(t%256-128)
t=t.intdiv(256)}
println new GZIPInputStream(new ByteArrayInputStream((byte[])b)).readLines().collectEntries{(List)it.split(',')}[args[0]]
</code>```

My original solution was a simpler Base 64 encoding using the built-in encoder

```<code>import java.util.zip.*
print new GZIPInputStream(new ByteArrayInputStream(Base64.decoder.decode('[encoded data, 10692 characters]'))).readLines().collectEntries{(List)it.split(',')}[args[0]]
</code>```

For readability, here's the same thing with the text excluded:

```<code>new GZIPInputStream(new ByteArrayInputStream(Base64.decoder.decode(''))).readLines().collectEntries{(List)it.split(',')}[args[0]]
</code>```

Title: Deciphering XKCD colors

Body:
Groovy, <s>153 + 10,697 = 10,850</s> 253 + 9870 = 10,123 bytes

I decided I wanted a solution which involved only one file, so (at the obvious cost of space) I encoded a GZIPped CSV version of the data to Unicode characters 0x0020-0x007E (which I guess would be a base 95 encoding?).  The code is 253 characters, the content of the String is 10123 characters.

import java.util.zip.*
t=0
'''^/3"O:<]NULAydP{|dgMn0T4;4&Y!~0=(BsILP$#KxAoQ<C6Z-.Psh/}k3&uOEa[S}R+u4=X*K`?X&zTKSQT>xdA-_XEy2/e{N$Ue:DSF- *Df1E3x)i=cq;FFq]|p,!sbQpE5F}$qr]zu'jK&A^\\Vd9"sKPgF_^uv>q)6#/"b1#gR"yvZ#<p9{T+__!fl\\\\=7P{zO0('G R+5QKuX}( ,r$V]" ;G)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^)0jo@#oM2g^-w`Vc%1a%zL8KL$$}<|uRv)~hxWra/.QUa(l6YXI(PR=-|BS 0dN Ls\\G":*.FQ 7o,rp~s\\>s)#3G$Q~FjZHE"Xz40;Yh?5alWWX|.(3jRR|9u+I2ufN@. ,44}bzyis*.YC'r{n72VEA>kgf?~RZEdq#{jFy?(Xn>S*2;$c?@b\\nGVNzJ=^PS[i#L@>l:^qtkEv"&_3pgU^<oVF]>&GvJ|Yg!{Trhp^{_&nabRM!:Z(a}AWWz>|hn,v(fe#)3jJ_Zq|-?QLY`#uCSHA{$!$am0gel%< bM<GRi^0^s@Y`npt2/&:SEAYc'ycCiG'McJ"wna)i25\\D9YKl>vD;4QrVW\\LAN{ePJw]uhy>C;xR1?'?NN4?PU`f-.'7UbULY|%|'%!'''.eachWithIndex{c,i->t+=95g**i*(((byte)c)-32g)}
b=[]
while(t){b<<(byte)(t%256-128)
t=t.intdiv(256)}
println new GZIPInputStream(new ByteArrayInputStream((byte[])b)).readLines().collectEntries{(List)it.split(',')}[args[0]]

For readability, here's the same thing with the encoded text excluded:

import java.util.zip.*
t=0
'''^/3...'%!'''.eachWithIndex{c,i->t+=95g**i*(((byte)c)-32g)}
b=[]
while(t){b<<(byte)(t%256-128)
t=t.intdiv(256)}
println new GZIPInputStream(new ByteArrayInputStream((byte[])b)).readLines().collectEntries{(List)it.split(',')}[args[0]]

My original solution was a simpler Base 64 encoding using the built-in encoder

import java.util.zip.*
print new GZIPInputStream(new ByteArrayInputStream(Base64.decoder.decode('[encoded data, 10692 characters]'))).readLines().collectEntries{(List)it.split(',')}[args[0]]

For readability, here's the same thing with the text excluded:

new GZIPInputStream(new ByteArrayInputStream(Base64.decoder.decode(''))).readLines().collectEntries{(List)it.split(',')}[args[0]]


问:
How does math work in Anastasiya's world?

Background:

Standard operation math like basic addition and multiplication in the real world work like these:

```<code>12 + 123 = 135
</code>```

and

```<code>12 * 123 = 1476
</code>```

That's not interesting and boring! Many schools are already interpreting this as practice, practice, practice of formal algorithms. That implies a pretty rigid and boring mathematical diet and is not what is intended in this challenge. Get ready to play some fun on our beloved site.

Consider the process of adding two positive integer numbers, then adding again all the digits of its result. Repeating with the addition until only a single digit is obtained. For example:

The result of 12 + 123 is 135.

Adding all the digits of 135 we obtain 1 + 3 + 5 = 9.

The number of steps required to obtain a single digit value 9 in this repeated addition is 2.

As with the previous process of the addition, the multiplication of two positive integer numbers follows the same process. Multiply all the digits of its result and then repeating this process until only a single digit remains. Take the above example:

The result of 12 * 123 is 1476.

Multiply all the digits of 1476 we obtain 1 * 4 * 7 * 6 = 168.

Multiply again all the digits of 168 we obtain 1 * 6 * 8 = 48.

Multiply again all the digits of 48 we obtain 4 * 8 = 32.

Multiply once again all the digits of 32 we obtain 3 * 2 = 6.

The number of steps required to obtain a single digit value 6 this repeated multiplication is 5.

For this challenge's sake and avoiding any misuse of math notations, I introduce these two dummy notations: (+) and (*), but you may use any notation you like, which work like the followings:

The operation of repeated addition process to obtain a single value is 12 (+) 123 = 9.

The operation of repeated multiplication process to obtain a single value is 12 (*) 123  = 6.

Challenge:

The challenge is to write either a program or a function which can perform both of operations as explained in the background section: (+) and (*).

Input:

The inputs of the program or the function are two positive integers and one operation either (+) and (*). The format of the input is an arbitrary choice of the programmer. You may format the input, for example, a (+) b or F(a, (+), b) or any format you wish.

Output:

The output of the program or the function must contain the result of operation and the number of steps required with freestyle format as you wish.

Test Cases (ignore the input and output format):

```<code>    81 (+) 31       -->   (4 ; 2)
    351 (+) 14568   -->   (6 ; 3)
    21 (*) 111      -->   (8 ; 3)
    136 (*) 2356    -->   (0 ; 2)
</code>```

General rules:

This is code-golf, so the shortest answer in bytes wins the challenge.

Don't let esolangs discourage you from posting an answer with regular languages. Enjoy this challenge by providing an answer as short as possible with your programming language. If you post a clever answer and a clear explanation, your answer will be appreciated (hence the upvotes) regardless of the programming language you use.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/ method with the proper parameters, full programs, etc. The choice is yours.

If possible, your program can properly handle large numbers. If not, that will just be fine.

Let the game begin!!

答:
Python 2, 60 bytes

f=lambda s,c=0:s[1:]and f(min(s).join(`eval(s)`),c+1)or(s,c)
```

Input is a string like 81+31, output is a tuple of a singleton string and a counter (e.g., ('4', 2).

Test it on Ideone.

ContentLicense: CC BY-SA 3.0

Body:
Python 2, 60 bytes

f=lambda s,c=0:s[1:]and f(min(s).join(`eval(s)`),c+1)or(s,c)

Input is a string like 81+31, output is a tuple of a singleton string and a counter (e.g., ('4', 2).

Test it on Ideone.


问:
Together Everyone Achieves More
(related: one, two, three)

An acrostic is a style of poem/writing where the beginning character of each line, when read vertically, also produces a word or message. For example,

```<code>Together
Everyone
Achieves
More
</code>```

also spells out the word TEAM when the first column is read vertically.

Acrostics are a subset of mesostics, where the vertical word can be anywhere in the horizontal words. For example, the TEAM one above could also be written as a mesostic as follows

```<code>   togeTher
everyonE
       Achieves
       More
</code>```

along with several other variations.

The challenge here will be to produce an acrostic or mesostic from a given list of input words.

Input

A list of words in any any suitable format.

The list will only contain words made from lowercase [a-z].

The list is guaranteed to form an acrostic or a mesostic (no need to handle bogus input).

One of the words in the input will form the vertical word, while the rest make the horizontal words - part of the challenge here is to find the appropriate vertical word, so it cannot be taken separately.

Output

The ASCII-art acrostic or mesostic formed from the input words, written to STDOUT or returned, in any reasonable format.

The corresponding vertical word must be capitalized (as in the examples).

Leading spaces to get the vertical word to line up appropriately are required. Trailing spaces, and leading/trailing newlines are optional. Extra leading spaces are fine as well, so long as the words align correctly.

If both an acrostic and mesostic are possible, output only the acrostic.

If more than one acrostic/mesostic is possible, your code can output any or all of them.

Rules

Either a full program or a function are acceptable.

Standard loopholes are forbidden.

This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

```<code>['together', 'team', 'everyone', 'achieves', 'more']
Together
Everyone
Achieves
More

['aaa', 'aaa', 'aaa', 'aaa']
Aaa
Aaa
Aaa
# One output, or multiple (of the same) output is allowed

['aaa', 'aaa', 'aab', 'baa']
Aaa
Aaa
Baa
# This is the only allowed output, since others would be mesostic, which are lower priority

['live', 'every', 'love', 'very', 'ohio']
Live
Ohio
Very
Every
# Note that 'live' couldn't be the vertical word since then it would be a mesostic, which is lower priority output

['cow', 'of', 'fox']
cOw
 Fox
# A shorter mesostic test case

['late', 'ballroom', 'anvil', 'to', 'head']
anviL
   bAllroom
    To
   hEad
</code>```

答:
Perl6, <s>287</s> <s>277</s> 269 bytes

```<code>my @w=$*IN.words;my ($q,$r)=gather for ^@w {my @v=@w.rotate($_);my \d=@v.shift;for @v.permutations {my @o=flat($_ Z d.comb).map:{$^a.index: $^b};take $_,@o if @o>>.defined.all}}.sort(*[1].sum)[0];for @$q Z @$r ->(\a,\b){say " "x($r.max -b)~a.substr(0,b)~a.substr(b).tc}
</code>```

Title: Together Everyone Achieves More

Body:
Perl6, <s>287</s> <s>277</s> 269 bytes

my @w=$*IN.words;my ($q,$r)=gather for ^@w {my @v=@w.rotate($_);my \d=@v.shift;for @v.permutations {my @o=flat($_ Z d.comb).map:{$^a.index: $^b};take $_,@o if @o>>.defined.all}}.sort(*[1].sum)[0];for @$q Z @$r ->(\a,\b){say " "x($r.max -b)~a.substr(0,b)~a.substr(b).tc}


问:
Exploded view of a string
Don't you love those exploded-view diagrams  in which a machine or object is taken apart into its smallest pieces?

Let's do that to a string!

The challenge

Write a program or function that

inputs a string containing only printable ASCII characters;

dissects the string into groups of non-space equal characters (the "pieces" of the string);

outputs those groups in any convenient format, with some separator between groups.

For example, given the string

```<code>Ah, abracadabra!
</code>```

the output would be the following groups:

```
!
,
A
aaaaa
bb
c
d
h
rr
```

Each group in the output contains equal characters, with spaces removed. A newline has been used as separator between groups. More about allowed formats below.

Rules

The input should be a string or an array of chars. It will only contain printable ASCII chars (the inclusive range from space to tilde). If your language does not support that, you can take the input in the form of numbers representing ASCII codes.

You can assume that the input contains at least one non-space character.

The output should consist of characters (even if the input is by means of ASCII codes). There has to be an unambiguous separator between groups, different than any non-space character that may appear in the input.

If the output is via function return, it may also be an array or strings, or an array of arrays of chars, or similar structure. In that case the structure provides the necessary separation.

A separator between characters of each group is optional. If there is one, the same rule applies: it can't be a non-space character that may appear in the input. Also, it can't be the same separator as used between groups.

Other than that, the format is flexible. Here are some examples:

The groups may be strings separated by newlines, as shown above.

The groups may be separated by any non-ASCII character, such as  ¬. The output for the above input would be the string:

```<code>!¬,¬A¬aaaaa¬bb¬c¬d¬h¬rr
</code>```

The groups may be separated by n>1 spaces (even if n is variable), with chars between each group separated by a single space:

```<code>!  ,    A   a a a a a    b b  c       d   h  r r
</code>```

The output may also be an array or list of strings returned by a function:

```<code>['!', 'A', 'aaaaa', 'bb', 'c', 'd', 'h', 'rr']
</code>```

Or an array of char arrays:

```<code>[['!'], ['A'], ['a', 'a', 'a', 'a', 'a'], ['b', 'b'], ['c'], ['d'], ['h'], ['r', 'r']]
</code>```

Examples of formats that are not allowed, according to the rules:

A comma can't be used as separator (!,,,A,a,a,a,a,a,b,b,c,d,h,r,r), because the input may contain commas.

It's not accepted to drop the separator between groups (!,Aaaaaabbcdhrr) or to use the same separator between groups and within groups (! , A a a a a a b b c d h r r).

The groups may appear in any order in the output. For example: alphabetical order (as in the examples above), order of first appearance in the string, ... The order need not be consistent or even deterministic.

Note that the input cannot contain newline characters, and A and a are different characters (grouping is case-sentitive).

Shortest code in bytes wins.

Test cases

In each test case, first line is input, and the remaining lines are the output, with each group in a different line.

Test case 1:

```
Ah, abracadabra!
!
,
A
aaaaa
bb
c
d
h
rr
```

Test case 2:

```
\o/\o/\o/
///
\\\
ooo
```

Test case 3:

```
A man, a plan, a canal: Panama!
!
,,
:
A
P
aaaaaaaaa
c
ll
mm
nnnn
p
```

Test case 4:

```
"Show me how you do that trick, the one that makes me scream" she said
""
,
S
aaaaa
cc
dd
eeeeeee
hhhhhh
ii
kk
mmmm
n
ooooo
rr
ssss
tttttt
u
ww
y
```

答:
Mathematica, 36 bytes

Built-in functions Gather and Characters do most of the work here.

```<code>Gather@Select[Characters@#,#!=" "&]&
</code>```

Title: Exploded view of a string

Body:
Mathematica, 36 bytes

Built-in functions Gather and Characters do most of the work here.

Gather@Select[Characters@#,#!=" "&]&


答:
><>, 49 bytes

```<code>i:0(?v
84}0~/&{!*
v!?: <}/?=&:&:<
>&1+&}aol1-?!;^
</code>```

Very spaciously wasteful in the output, but i assume is still allowed given the lenience of the rules

Explanation:

```<code>i:0(?v           Collects text from input
84}0~/&{!*       adds 32 (first ascii starting at space) to register and 0 to stack
v!?: <}/?=&:&:<  checks all characters to the current register, if equal:
       o         prints the character and continues looping
>&1+&}aol1-?!;^  when all characters are checked, adds 1 to register, prints a newline,
                 checks the stack length to halt the program if 0, and starts looping again
</code>```

fit some things in pretty tight, even using jumps to get around some functions so i could run the pointer vertically.

Basically this puts each ASCII character on its own newline, and if none of that character exists, the line will be blank

Try it online

Edit: i was wrong there was an error in the code what would cause it to never complete if there was a space in the input

Title: Exploded view of a string

Body:
Don't you love those exploded-view diagrams  in which a machine or object is taken apart into its smallest pieces?

Let's do that to a string!

The challenge

Write a program or function that

inputs a string containing only printable ASCII characters;

dissects the string into groups of non-space equal characters (the "pieces" of the string);

outputs those groups in any convenient format, with some separator between groups.

For example, given the string

```<code>Ah, abracadabra!
</code>```

the output would be the following groups:

```
!
,
A
aaaaa
bb
c
d
h
rr
```

Each group in the output contains equal characters, with spaces removed. A newline has been used as separator between groups. More about allowed formats below.

Rules

The input should be a string or an array of chars. It will only contain printable ASCII chars (the inclusive range from space to tilde). If your language does not support that, you can take the input in the form of numbers representing ASCII codes.

You can assume that the input contains at least one non-space character.

The output should consist of characters (even if the input is by means of ASCII codes). There has to be an unambiguous separator between groups, different than any non-space character that may appear in the input.

If the output is via function return, it may also be an array or strings, or an array of arrays of chars, or similar structure. In that case the structure provides the necessary separation.

A separator between characters of each group is optional. If there is one, the same rule applies: it can't be a non-space character that may appear in the input. Also, it can't be the same separator as used between groups.

Other than that, the format is flexible. Here are some examples:

The groups may be strings separated by newlines, as shown above.

The groups may be separated by any non-ASCII character, such as  ¬. The output for the above input would be the string:

```<code>!¬,¬A¬aaaaa¬bb¬c¬d¬h¬rr
</code>```

The groups may be separated by n>1 spaces (even if n is variable), with chars between each group separated by a single space:

```<code>!  ,    A   a a a a a    b b  c       d   h  r r
</code>```

The output may also be an array or list of strings returned by a function:

```<code>['!', 'A', 'aaaaa', 'bb', 'c', 'd', 'h', 'rr']
</code>```

Or an array of char arrays:

```<code>[['!'], ['A'], ['a', 'a', 'a', 'a', 'a'], ['b', 'b'], ['c'], ['d'], ['h'], ['r', 'r']]
</code>```

Examples of formats that are not allowed, according to the rules:

A comma can't be used as separator (!,,,A,a,a,a,a,a,b,b,c,d,h,r,r), because the input may contain commas.

It's not accepted to drop the separator between groups (!,Aaaaaabbcdhrr) or to use the same separator between groups and within groups (! , A a a a a a b b c d h r r).

The groups may appear in any order in the output. For example: alphabetical order (as in the examples above), order of first appearance in the string, ... The order need not be consistent or even deterministic.

Note that the input cannot contain newline characters, and A and a are different characters (grouping is case-sentitive).

Shortest code in bytes wins.

Test cases

In each test case, first line is input, and the remaining lines are the output, with each group in a different line.

Test case 1:

```
Ah, abracadabra!
!
,
A
aaaaa
bb
c
d
h
rr
```

Test case 2:

```
\o/\o/\o/
///
\\\
ooo
```

Test case 3:

```
A man, a plan, a canal: Panama!
!
,,
:
A
P
aaaaaaaaa
c
ll
mm
nnnn
p
```

Test case 4:

```
"Show me how you do that trick, the one that makes me scream" she said
""
,
S
aaaaa
cc
dd
eeeeeee
hhhhhh
ii
kk
mmmm
n
ooooo
rr
ssss
tttttt
u
ww
y
```

Body:
><>, 49 bytes

i:0(?v
84}0~/&{!*
v!?: <}/?=&:&:<
>&1+&}aol1-?!;^

Very spaciously wasteful in the output, but i assume is still allowed given the lenience of the rules

Explanation:

i:0(?v           Collects text from input
84}0~/&{!*       adds 32 (first ascii starting at space) to register and 0 to stack
v!?: <}/?=&:&:<  checks all characters to the current register, if equal:
       o         prints the character and continues looping
>&1+&}aol1-?!;^  when all characters are checked, adds 1 to register, prints a newline,
                 checks the stack length to halt the program if 0, and starts looping again

fit some things in pretty tight, even using jumps to get around some functions so i could run the pointer vertically.

Basically this puts each ASCII character on its own newline, and if none of that character exists, the line will be blank

Try it online

Edit: i was wrong there was an error in the code what would cause it to never complete if there was a space in the input


答:
Swift, <s>105</s> 91 bytes

Thanks to @NobodyNada for 14 bytes :)

Yeah, I'm pretty new to Swift...

```<code>func f(a:[Character]){for c in Set(a){for d in a{if c==d && c != " "{print(c)}}
print("")}}
</code>```

Characters within a group are separated by a single newline. Groups are separated by two newlines.

Title: Exploded view of a string

Body:
Swift, <s>105</s> 91 bytes

Thanks to @NobodyNada for 14 bytes :)

Yeah, I'm pretty new to Swift...

func f(a:[Character]){for c in Set(a){for d in a{if c==d && c != " "{print(c)}}
print("")}}

Characters within a group are separated by a single newline. Groups are separated by two newlines.


问:
The Letter A without A
Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

Since this is code-golf, the shortest solution, in bytes, that follows all the rules, is the winner.

Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}```
</div>
</div>
</p>

<p><em>This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.</em></p>

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;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;</code>```

body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><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>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

Title: The Letter A without A

Body:
Perl6, 20

(?0).comb[3>2].print


答:
Javascript (using external Library - Enumerable) (<s>78</s> 67 bytes)

```<code> n=>_.From(n).Where(y=>y!=' ').GroupBy(x=>x).WriteLine(y=>y.Write())
</code>```

Link to lib: https://github.com/mvegh1/Enumerable

Code explanation: This is what Enumerable was made to do! Load the string into the library, which converts it to a char array. Filter out the white space entries. Group by char. Write each group to a line, according to the specified predicate. That predicate says to join all the elements of the current group into a string, without a delimiter.

Title: Exploded view of a string

Body:
Javascript (using external Library - Enumerable) (<s>78</s> 67 bytes)

 n=>_.From(n).Where(y=>y!=' ').GroupBy(x=>x).WriteLine(y=>y.Write())

Link to lib: https://github.com/mvegh1/Enumerable

Code explanation: This is what Enumerable was made to do! Load the string into the library, which converts it to a char array. Filter out the white space entries. Group by char. Write each group to a line, according to the specified predicate. That predicate says to join all the elements of the current group into a string, without a delimiter.


问:
Find the minimum and maximum integers in an array, without using builtins

Challenge

Given an array of integers, received from stdin, function arguments, program arguments, or some other method:

Output only the minimum and maximum numbers in the array, through a return value, stdout, or other fitting methods.

Example session

```<code>> minmax( {0, 15, 2, 3, 7, 18, -2, 9, 6, -5, 3, 8, 9, -14} )
-14 18
</code>```

Reference implementation

```<code>// C++14

void minmax(std::vector<int> v) {
    int min = v[0]; int max = v[0];
    for(auto it : v) {
        if (*it < min)
            min = *it;
        if (*it > max)
            max = *it;
    }
    std::cout << min << ' ' << max << std::endl;
}
</code>```

Rules

You may not use a built-in function to calculate the values.

Standard loopholes disallowed.

Creative implementations encouraged.

This is code-golf, shortest answer wins but will not be selected.

Clarifications

If the array contains 1 element you need to output it twice.

If the minimum and maximum values are the same, you need to output them both.

答:
zsh, 22 bytes

```<code>(){echo $1 $_} ${(n)@}
</code>```

defines a lambda function that prints its first arg ($1) and the last argument to the previous command ($_), and passes it $@ after sorting it so the previous command becomes the invocation of that lambda

zsh, 21 bytes

this only works fine if there's more than 1 argument :(

```<code><<<"${${(n)@}/ * / }"
</code>```

sorts $@, makes it a string and replaces everything from the first space to the last one with a single space, then passes it as input to cat with <<<

usage:

```<code>$ ./minmax 23 342 21 10
10 342
</code>```

Body:
zsh, 22 bytes

(){echo $1 $_} ${(n)@}

defines a lambda function that prints its first arg ($1) and the last argument to the previous command ($_), and passes it $@ after sorting it so the previous command becomes the invocation of that lambda

zsh, 21 bytes

this only works fine if there's more than 1 argument :(

<<<"${${(n)@}/ * / }"

sorts $@, makes it a string and replaces everything from the first space to the last one with a single space, then passes it as input to cat with <<<

usage:

$ ./minmax 23 342 21 10
10 342


答:
C++ (g++), <s>148 133 131 122</s> 119 bytes

```<code>#import<map>
#import<vector>
[](std::vector<int>v){int a=v[0],b=a;for(int i:v)i<a?a=i:i<b?:b=i;printf("%d %d\n",a,b);};
</code>```

Try it online!

Title: Find the minimum and maximum integers in an array, without using builtins

Body:
Challenge

Given an array of integers, received from stdin, function arguments, program arguments, or some other method:

Output only the minimum and maximum numbers in the array, through a return value, stdout, or other fitting methods.

Example session

```<code>> minmax( {0, 15, 2, 3, 7, 18, -2, 9, 6, -5, 3, 8, 9, -14} )
-14 18
</code>```

Reference implementation

```<code>// C++14

void minmax(std::vector<int> v) {
    int min = v[0]; int max = v[0];
    for(auto it : v) {
        if (*it < min)
            min = *it;
        if (*it > max)
            max = *it;
    }
    std::cout << min << ' ' << max << std::endl;
}
</code>```

Rules

You may not use a built-in function to calculate the values.

Standard loopholes disallowed.

Creative implementations encouraged.

This is code-golf, shortest answer wins but will not be selected.

Clarifications

If the array contains 1 element you need to output it twice.

If the minimum and maximum values are the same, you need to output them both.

Body:
C++ (g++), <s>148 133 131 122</s> 119 bytes

#import<map>
#import<vector>
[](std::vector<int>v){int a=v[0],b=a;for(int i:v)i<a?a=i:i<b?:b=i;printf("%d %d\n",a,b);};

Try it online!


问:
Russian Roulette
Write a program which plays Russian Roulette!

If the program is started,

there should be a 5 in 6 chance of it ending normally after printing "I survived!"

there should be a 1 in 6 chance of the program crashing. (segmentation fault, etc.)

No input, and no other outputs are allowed.

The randomness must be fair: it must have a uniform probability distribution. This means an uninitialized variable (or a RNG without seed) MOD 6 will not be sufficient.

If the solution works with only one dedicated operating system / platform, you will receive a 6 byte penalty to the score.

Shortest code wins, not sooner than 10 days after first valid answer.

答:
CMD Shell (Win XP or later), 40 +6

I'm only doing this one because DOS is not something that should even be thought of for code golf, and the whitespace is important

```<code>set/a1/(%RANDOM% %% 6)&&echo I Survived!
</code>```

On failure, it will print

Divide by zero error.

Title: Russian Roulette

Body:
CMD Shell (Win XP or later), 40 +6

I'm only doing this one because DOS is not something that should even be thought of for code golf, and the whitespace is important

set/a1/(%RANDOM% %% 6)&&echo I Survived!

On failure, it will print

Divide by zero error.


答:
Pyth, 5 bytes

```<code>.gksc
</code>```

Try it here!

Takes input as a Python string (i.e. wrapped in quotes, escaped quotes and slashes as necessary).

Explanation:

```<code>    c    Split (implied) input on whitespace
   s     Sum together
.gk      Group by value
</code>```

If you guarantee at least one space in the input, there's a 4-byte solution:

```<code>t.gk
</code>```

Try it here!

Explanation:

```<code> .gk (Q)  groups the characters in the string by their value
           this sorts them by their value, which guarantees that spaces are first
t         Remove the first element (the spaces)
</code>```

Title: Exploded view of a string

Body:
Pyth, 5 bytes

.gksc

Try it here!

Takes input as a Python string (i.e. wrapped in quotes, escaped quotes and slashes as necessary).

Explanation:

    c    Split (implied) input on whitespace
   s     Sum together
.gk      Group by value

If you guarantee at least one space in the input, there's a 4-byte solution:

t.gk

Try it here!

Explanation:

 .gk (Q)  groups the characters in the string by their value
           this sorts them by their value, which guarantees that spaces are first
t         Remove the first element (the spaces)


答:
Dyalog APL, 11 bytes

Function returning list of strings.

(⊂∩¨∪)~∘' '
```

(⊂∩¨∪) the intersection of the entirety and its unique characters

~∘' ' except spaces

TryAPL online!

Title: Exploded view of a string

Body:
Dyalog APL, 11 bytes

Function returning list of strings.

(⊂∩¨∪)~∘' '

(⊂∩¨∪) the intersection of the entirety and its unique characters

~∘' ' except spaces

TryAPL online!


问:
Show off your tree analysing toolbox
As a programmer or computer scientist one might encounter quite a lot of trees - of course not the woody growing-in-the-wrong-direction kind, but the nice, pure mathematical kind:

```<code>  *<- root (also a node)
 /|\<- edge
* * *<- inner node
|  / \
* *   *<- leaf (also a node)
  |
  *
</code>```

Naturally over time we all have put together our own small handy toolbox to analyse such trees as we encounter them, right?
Now is the time to show it off!

Task

The toolbox must include the following functions:

size: The number of nodes in the tree.

depth: The number of edges on the longest path from the root to any leaf.

breadth: The number of leaves.

degree: The maximum number of child nodes for any node.

You have to submit a program or function for each of the tools, however they might share subroutines (e.g. parsing) which then have to be submitted only once. Note that those subroutines need to be full programs or functions too.

Input Format

The trees can be given in any reasonable format capturing the structure, e.g. the tree

```<code>  *
 / \
*   *
</code>```

could be represented through parentheses (()()), lists of lists [[],[]], or data structures with a constructor T[T[],T[]].
However not through linearisation [2,0,0] or a format like (size, depth, breath, degree, whatever-else-is-needed-to-make-this-format-unique-for-every-tree).
Generally speaking, your tree format should not contain numbers.

Output Format

A natural number for each of the properties described above.

Scoring

Lowest code in bytes for the 4 functions in every language wins, thus I will not accept an answer.

Feel free to provide additional tree tools like fold, isBinaryTree, preLinearise, postLinearize, or whatever you like. Of course those don't have to be included in the byte count.

Examples

First the tree is given in the sample formats from above, then the results of the functions as (size, depth, breadth, degree).

```<code>()
[]
T[]
(1,0,1,0)

(()())
[[],[]]
T[T[],T[]]
(3,1,2,2)

((())()((())()))
[[[]],[],[[[]],[]]]
T[T[T[]],T[],T[T[T[]],T[]]]
(8,3,4,3)

((()())((())()((())()))(()())(()))
[[[],[]],[[[]],[],[[[]],[]]],[[],[]],[[]]]
T[T[T[],T[]],T[T[T[]],T[],T[T[T[]],T[]]],T[T[],T[]],T[T[]]]
(17,4,9,4)

((((((((()))))))))
[[[[[[[[[]]]]]]]]]
T[T[T[T[T[T[T[T[T[]]]]]]]]]
(9,8,1,1)

(((((((()()))((()()))))((((()()))((()()))))))((((((()()))((()()))))((((()()))((()())))))))
[[[[[[[[],[]]],[[[],[]]]]],[[[[[],[]]],[[[],[]]]]]]],[[[[[[[],[]]],[[[],[]]]]],[[[[[],[]]],[[[],[]]]]]]]]
T[T[T[T[T[T[T[T[],T[]]],T[T[T[],T[]]]]],T[T[T[T[T[],T[]]],T[T[T[],T[]]]]]]],T[T[T[T[T[T[T[],T[]]],T[T[T[],T[]]]]],T[T[T[T[T[],T[]]],T[T[T[],T[]]]]]]]]
(45,7,16,2)
</code>```

答:
C#, <s>380</s>, 357 bytes

I've just noticed I forgot to remove some of my test code, so 23 bytes shaved off...

This is my first submission on PPCG and I'm not sure if the format is entirely correct especially because I'm using C#, but here are my four functions:

```<code>int d(string t){int l=-1,p=0;t.Max(m=>p=p<(l+=m=='('?1:-1)?l:p);return p;}
int s(string t){return t.Count(c=>c=='(');}
int f(string t){int q=0,w=d(t)+2;int[]l=new int[w],i=new int[w];t.Max(m=>l[q]=m=='('?l[q++]+1:(0*(i[q]=l[q]>i[q]?l[q]:i[q])*(q--)));return i.Max();}
int b(string t){var f='(';int l=0;t.Max(m=>l+=(f=='('&m==')')?(f=m)*0+1:(f=m)*0);return l;}
</code>```

d: Depth
s: Size:
f: Degree
b: Breadth

The functions use () as input

I'm using LINQ's Max function to iterate through the items in the string array. I'm not using the functionality of Max, I only use it because it's the shortest iterative function; I could just as well have used Min. There's no recursion and all is done in linear time.

A slightly more readable version of my code, but the LINQ is still a bit cryptic:

```<code>    /*Depth: Increment counter on open bracket and
     decrement on closed bracket;
     return highest number reached*/
    int d(string t)
    {
        int l = -1, p = 0;
        t.Max(m => p = p < (l += m == '(' ? 1 : -1) ? l : p);
        return p;
    }

    int s(string t)//Size: Count the number of open brackets
    {
        return t.Count(c => c == '(');
    }

    int f(string t)//Degree, this one took me hours to figure out
    {
        int q = 0, w = d(t) + 2;
        int[] l = new int[w], i = new int[w];
        t.Max(m => l[q] = m == '(' ? l[q++] + 1 : (0 * (i[q] = l[q] > i[q] ? l[q] : i[q]) * (q--)));
        return i.Max();
    }

    int b(string t)//Breadth
    {
        var f = '(';
        int l = 0;
        t.Max(m => l += (f == '(' & m == ')') ? (f = m) * 0 + 1 : (f = m) * 0);
        return l;
    }
</code>```

Title: Show off your tree analysing toolbox

Body:
C#, <s>380</s>, 357 bytes

I've just noticed I forgot to remove some of my test code, so 23 bytes shaved off...

This is my first submission on PPCG and I'm not sure if the format is entirely correct especially because I'm using C#, but here are my four functions:

int d(string t){int l=-1,p=0;t.Max(m=>p=p<(l+=m=='('?1:-1)?l:p);return p;}
int s(string t){return t.Count(c=>c=='(');}
int f(string t){int q=0,w=d(t)+2;int[]l=new int[w],i=new int[w];t.Max(m=>l[q]=m=='('?l[q++]+1:(0*(i[q]=l[q]>i[q]?l[q]:i[q])*(q--)));return i.Max();}
int b(string t){var f='(';int l=0;t.Max(m=>l+=(f=='('&m==')')?(f=m)*0+1:(f=m)*0);return l;}

d: Depth
s: Size:
f: Degree
b: Breadth

The functions use () as input

I'm using LINQ's Max function to iterate through the items in the string array. I'm not using the functionality of Max, I only use it because it's the shortest iterative function; I could just as well have used Min. There's no recursion and all is done in linear time.

A slightly more readable version of my code, but the LINQ is still a bit cryptic:

    /*Depth: Increment counter on open bracket and
     decrement on closed bracket;
     return highest number reached*/
    int d(string t)
    {
        int l = -1, p = 0;
        t.Max(m => p = p < (l += m == '(' ? 1 : -1) ? l : p);
        return p;
    }

    int s(string t)//Size: Count the number of open brackets
    {
        return t.Count(c => c == '(');
    }

    int f(string t)//Degree, this one took me hours to figure out
    {
        int q = 0, w = d(t) + 2;
        int[] l = new int[w], i = new int[w];
        t.Max(m => l[q] = m == '(' ? l[q++] + 1 : (0 * (i[q] = l[q] > i[q] ? l[q] : i[q]) * (q--)));
        return i.Max();
    }

    int b(string t)//Breadth
    {
        var f = '(';
        int l = 0;
        t.Max(m => l += (f == '(' & m == ')') ? (f = m) * 0 + 1 : (f = m) * 0);
        return l;
    }


问:
Smallest palindrome divisible by the input
Given a positive integer N, output the smallest positive integer such that this number is a palindrome (i.e. is its own reverse) and is divisible by N.

The palindrome (i.e. the output) must not need a leading zero to be a palindrome, e.g. 080 is not the valid answer for 16.

The input will never be a multiple of 10, because of the previous reason.

Your program may take as much time as necessary, even if in practice it would be way too long to output the answer.

Inputs and outputs

You may take the input through STDIN, as a function argument, or anything similar.

You may print the output to STDOUT, return it from a function, or anything similar.

Inputs and outputs must be in the decimal base.

Test cases

```<code>N        Output
1        1
2        2
16       272
17       272
42       252
111      111
302      87278
1234     28382
</code>```

Scoring

This is code-golf, so the shortest answer in bytes wins.

答:
Brachylog, 8 bytes

```<code>:L#>*.r=
</code>```

Try it online! (around 5 seconds for 1234)

Verify all testcases. (around 20 seconds)

```<code>:L#>*.r=
?:L#>*.r=.   Implicitly filling Input and Output:
             Input is prepended to every predicate,
             Output is appended to every predicate.

?:L  *.      Input*L is Output,
  L#>        L is positive,
      .r .   Output reversed is Output,
        =.   Assign a value to Output.
</code>```

Body:
Brachylog, 8 bytes

:L#>*.r=

Try it online! (around 5 seconds for 1234)

Verify all testcases. (around 20 seconds)

:L#>*.r=
?:L#>*.r=.   Implicitly filling Input and Output:
             Input is prepended to every predicate,
             Output is appended to every predicate.

?:L  *.      Input*L is Output,
  L#>        L is positive,
      .r .   Output reversed is Output,
        =.   Assign a value to Output.


答:
Pyth, <s>52</s> <s>49</s> <s>47</s> 46 bytes

```<code>jm++*;-lsQhAd<HGr>HG4hhMDfhhShMTm.b,xNYNtdhd.p
</code>```

Try it online.

This is probably very golfable. It prints a bunch of leading spaces.

Title: Together Everyone Achieves More

Body:
(related: one, two, three)

An acrostic is a style of poem/writing where the beginning character of each line, when read vertically, also produces a word or message. For example,

```<code>Together
Everyone
Achieves
More
</code>```

also spells out the word TEAM when the first column is read vertically.

Acrostics are a subset of mesostics, where the vertical word can be anywhere in the horizontal words. For example, the TEAM one above could also be written as a mesostic as follows

```<code>   togeTher
everyonE
       Achieves
       More
</code>```

along with several other variations.

The challenge here will be to produce an acrostic or mesostic from a given list of input words.

Input

A list of words in any any suitable format.

The list will only contain words made from lowercase [a-z].

The list is guaranteed to form an acrostic or a mesostic (no need to handle bogus input).

One of the words in the input will form the vertical word, while the rest make the horizontal words - part of the challenge here is to find the appropriate vertical word, so it cannot be taken separately.

Output

The ASCII-art acrostic or mesostic formed from the input words, written to STDOUT or returned, in any reasonable format.

The corresponding vertical word must be capitalized (as in the examples).

Leading spaces to get the vertical word to line up appropriately are required. Trailing spaces, and leading/trailing newlines are optional. Extra leading spaces are fine as well, so long as the words align correctly.

If both an acrostic and mesostic are possible, output only the acrostic.

If more than one acrostic/mesostic is possible, your code can output any or all of them.

Rules

Either a full program or a function are acceptable.

Standard loopholes are forbidden.

This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

```<code>['together', 'team', 'everyone', 'achieves', 'more']
Together
Everyone
Achieves
More

['aaa', 'aaa', 'aaa', 'aaa']
Aaa
Aaa
Aaa
# One output, or multiple (of the same) output is allowed

['aaa', 'aaa', 'aab', 'baa']
Aaa
Aaa
Baa
# This is the only allowed output, since others would be mesostic, which are lower priority

['live', 'every', 'love', 'very', 'ohio']
Live
Ohio
Very
Every
# Note that 'live' couldn't be the vertical word since then it would be a mesostic, which is lower priority output

['cow', 'of', 'fox']
cOw
 Fox
# A shorter mesostic test case

['late', 'ballroom', 'anvil', 'to', 'head']
anviL
   bAllroom
    To
   hEad
</code>```

Body:
Pyth, <s>52</s> <s>49</s> <s>47</s> 46 bytes

jm++*;-lsQhAd<HGr>HG4hhMDfhhShMTm.b,xNYNtdhd.p

Try it online.

This is probably very golfable. It prints a bunch of leading spaces.


答:
Pyth, 7 bytes

```<code>*f_I`*Q
</code>```

Try it online: Demonstration

Explanation

```<code>*f_I`*QT)Q   implicit endings, Q=input number
 f      )    find the first number T >= 1, which satisfies:
     *QT        product of Q and T
    `           as string
  _I            is invariant under inversion (=palindrom)
*        Q   multiply this number with Q and print
</code>```

Title: Smallest palindrome divisible by the input

Body:
Given a positive integer N, output the smallest positive integer such that this number is a palindrome (i.e. is its own reverse) and is divisible by N.

The palindrome (i.e. the output) must not need a leading zero to be a palindrome, e.g. 080 is not the valid answer for 16.

The input will never be a multiple of 10, because of the previous reason.

Your program may take as much time as necessary, even if in practice it would be way too long to output the answer.

Inputs and outputs

You may take the input through STDIN, as a function argument, or anything similar.

You may print the output to STDOUT, return it from a function, or anything similar.

Inputs and outputs must be in the decimal base.

Test cases

```<code>N        Output
1        1
2        2
16       272
17       272
42       252
111      111
302      87278
1234     28382
</code>```

Scoring

This is code-golf, so the shortest answer in bytes wins.

Body:
Pyth, 7 bytes

*f_I`*Q

Try it online: Demonstration

Explanation

*f_I`*QT)Q   implicit endings, Q=input number
 f      )    find the first number T >= 1, which satisfies:
     *QT        product of Q and T
    `           as string
  _I            is invariant under inversion (=palindrom)
*        Q   multiply this number with Q and print


答:
2sable / 05AB1E, 6 / 7 bytes

2sable

```<code>[DÂQ#+
</code>```

Explanation

```<code>[         # infinite loop
 D        # duplicate current number
  Â       # bifurcate
   Q#     # if the number is equal to its reverse, break loop
     +    # add input
          # implicitly print
</code>```

Try it online

05AB1E

```<code>[DÂQ#¹+
</code>```

The difference to the 2sable code is that input is only implicit once in 05AB1E, so here we need ¹ to get the first input again.

Try it online

Saved 1 byte with 2sable as suggested by Adnan

Body:
2sable / 05AB1E, 6 / 7 bytes

2sable

[DÂQ#+

Explanation

[         # infinite loop
 D        # duplicate current number
  Â       # bifurcate
   Q#     # if the number is equal to its reverse, break loop
     +    # add input
          # implicitly print

Try it online

05AB1E

[DÂQ#¹+

The difference to the 2sable code is that input is only implicit once in 05AB1E, so here we need ¹ to get the first input again.

Try it online

Saved 1 byte with 2sable as suggested by Adnan


答:
Python 2, 46 bytes

f=lambda x,c=0:`c`[::-1]==`c`and c or f(x,c+x)
```

Ideone it!

Recursive solution with c as counter.

The case for 0 is interesting, because although c=0 satisfies the palindrome condition, it would not be returned, because ccc and 0 or xxx always returns xxx.

Body:
Python 2, 46 bytes

f=lambda x,c=0:`c`[::-1]==`c`and c or f(x,c+x)

Ideone it!

Recursive solution with c as counter.

The case for 0 is interesting, because although c=0 satisfies the palindrome condition, it would not be returned, because ccc and 0 or xxx always returns xxx.


问:
Official Dyalog APL 2016 Year Game
If you think this could be fun, but too much work, consider participating in this much smaller challenge.

A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". Enjoy!

The Objective

Find Dyalog APL (download) expressions (other languages are allowed, see Eligibility below) involving exactly the digits 2 0 1 6 in that order to equal the numbers 0 to 100. For example:

20=16

×2016

2⌊016

2+0+1*6

...

The aim is to use as few characters as possible in each expression (the minimum number of characters for an expression is 5 – the four digits 2 0 1 6 and a single primitive function/operator).

The Rules

Each expression must contain the digits 2 0 1 6 (in that order) and
no other digits. Pre-set constants and variables are also not allowed.

In addition to the four digits 2 0 1 6, only built-in symbols and names, parentheses/braces, spaces, high minus signs and
decimal points can be used. The resultant expressions must be
deterministic (that is, give the same result on repeated
evaluations). For non-APLs, functions/operators with a name are also allowed; same rules as here.

Assume all default settings for your language. For Dyalog APL, this means ⎕ML and ⎕IO are both 1, and ⎕PP is 10.

Each entry comprising correct expressions for all the numbers from 0
to 100 inclusive will be rated according to the number of characters
used by those expressions excluding redundant spaces (minimum 505 for
all 101 expressions).

Eligibility

Anyone can enter. You may answer in any language, but only APL answers will be considered for accepting. If you use another language than APL, you may use snippets, programs, functions, etc. as alternatives to expressions, and you may print, leave the number in an accessible memory location, or otherwise return the result, as long as your code directly evaluates to the desired number as any standard numeric data type for your language.

Closing Date

30 November 2016.

Prizes

Have your answer accepted

Be immortalised in Dyalog's 2016 Hall of Fame!

Submitting Your Entry

After 30 November 2016, I will accept the shortest answer, and submit your answer, in your name, to Dyalog's 2016 Hall of Fame.

FAQ

Is J (e.g. 37=⌈⍟!20J16) allowed?

No: In addition to the four digits 2 0 1 6, only only built-in symbols and names, parentheses/braces, spaces, high minus signs and decimal points can be used.

Is output as a string acceptable?

No: equal the numbers 0 to 100.

Physical digits, or data digits?

Data digits, as per OP: same rules as here, where one of the examples contain LOG10(.

Is assigning variables then using them as part of the expression (e.g. 56=a+16+a←20) allowed?

Yes, but you may not use an assignment from one expression in another one.

I have explicit written permission to post this challenge here from the original author of this challenge. Feel free to verify by following the provided link and contacting the author. I gave the original competition author the link to this page within the minute I posted it, so they can check if I submit someone's answer as my own.

Title: Official Dyalog APL 2016 Year Game

Body:
Java 7, 1,083 bytes

For the byte-count I've only counted the expressions itself between the parenthesis. So I've excluded the System.out.printlns and class. Including those it would be 3,049 bytes.

PS: Not entirely sure if the int-cast for 72 is valid.. Although it does add 5 bytes anyway..

201&6
2-01%6
2%016
201%6
20-16
201%~6
2%01+6
2-01+6
2*01+6
2+01+6
~2+016
~2+016
2^016
20-1-6
2|016
20+1-6
2+016
2-~016
2+0+16
20-1%6
20|16
20+1%6
20*1|6
20|1|6
20+~1+6
20-1+6
20*1+6
20+1+6
2*016
20-~1-~6
-2*~016
20|~-16
(2+0)*16
20*~1^~6
-20*~1-6
20+~-16
20+16
20-~16
20-~-~16
-~2*~-016
20<<1%6
~-(-~2*016)
~2*-016
~20^-1<<6
~20*~1^6
~2*~016
20<<1|6
-20*~1-~6
~20*~1+6
~20*~1-~6
-20/~1*~-6
~2*~-~-~016
20|1<<~-6
-20*~-~1+~6
20*-~-~1-6
-20*~-~1-~-6
~-~2*-016
~20*~-~1-6
-20*~-~1^6
~(20/~1*6)
-20/~1*6
~2^(0-1)<<6
-2^(0-1)<<6
~20/~1*6
(2-01)<<6
(2+~0)|1<<6
2|01<<6
2-~0|1<<6
~-~2*~16
~20*~-~1+6
20/~1*~6
-~(20/~1*~6)
~-~(int)2.0*~-~16
-20<<-~1^~6
-20<<-~1^-6
~-~-~2*~016
~-20*(~1+6)
~-~20/~1*-~6
~-20<<-~1|6
~-(20*~(1-6))
20*(~1+6)
-~(20*~(1-6))
~-~-20|1<<6
~-20|1<<6
20|1<<6
-~20|1<<6
20<<-~1|6
20<<-~1|-~6
-~-~20*(~1+6)
~20*~-~-~1+~-6
~-~-20*-(1-6)
~20*~-~-~1-~6
~20*~-~-~1-~-~6
~2^~-~01<<~-6
-2^~-~01<<~-6
~-20*1*~-6
(2+01)<<~-6
-~(~2*~-~0*16)
~-~-(20*-(1-6))
~-(20*1*~-6)
20*-(1-6)

Ungolfed & test code:

Try it here.

class M{
  public static void main(String[]a){
    System.out.println(201&6);
    System.out.println(2-01%6);
    System.out.println(2%016);
    System.out.println(201%6);
    System.out.println(20-16);
    System.out.println(201%~6);
    System.out.println(2%01+6);
    System.out.println(2-01+6);
    System.out.println(2*01+6);
    System.out.println(2+01+6);
    System.out.println(~2+016);
    System.out.println(~2+016);
    System.out.println(2^016);
    System.out.println(20-1-6);
    System.out.println(2|016);
    System.out.println(20+1-6);
    System.out.println(2+016);
    System.out.println(2-~016);
    System.out.println(2+0+16);
    System.out.println(20-1%6);
    System.out.println(20|16);
    System.out.println(20+1%6);
    System.out.println(20*1|6);
    System.out.println(20|1|6);
    System.out.println(20+~1+6);
    System.out.println(20-1+6);
    System.out.println(20*1+6);
    System.out.println(20+1+6);
    System.out.println(2*016);
    System.out.println(20-~1-~6);
    System.out.println(-2*~016);
    System.out.println(20|~-16);
    System.out.println((2+0)*16);
    System.out.println(20*~1^~6);
    System.out.println(-20*~1-6);
    System.out.println(20+~-16);
    System.out.println(20+16);
    System.out.println(20-~16);
    System.out.println(20-~-~16);
    System.out.println(-~2*~-016);
    System.out.println(20<<1%6);
    System.out.println(~-(-~2*016));
    System.out.println(~2*-016);
    System.out.println(~20^-1<<6);
    System.out.println(~20*~1^6);
    System.out.println(~2*~016);
    System.out.println(20<<1|6);
    System.out.println(-20*~1-~6);
    System.out.println(~20*~1+6);
    System.out.println(~20*~1-~6);
    System.out.println(-20/~1*~-6);
    System.out.println(~2*~-~-~016);
    System.out.println(20|1<<~-6);
    System.out.println(-20*~-~1+~6);
    System.out.println(20*-~-~1-6);
    System.out.println(-20*~-~1-~-6);
    System.out.println(~-~2*-016);
    System.out.println(~20*~-~1-6);
    System.out.println(-20*~-~1^6);
    System.out.println(~(20/~1*6));
    System.out.println(-20/~1*6);
    System.out.println(~2^(0-1)<<6);
    System.out.println(-2^(0-1)<<6);
    System.out.println(~20/~1*6);
    System.out.println((2-01)<<6);
    System.out.println((2+~0)|1<<6);
    System.out.println(2|01<<6);
    System.out.println(2-~0|1<<6);
    System.out.println(~-~2*~16);
    System.out.println(~20*~-~1+6);
    System.out.println(20/~1*~6);
    System.out.println(-~(20/~1*~6));
    System.out.println(~-~(int)2.0*~-~16);
    System.out.println(-20<<-~1^~6);
    System.out.println(-20<<-~1^-6);
    System.out.println(~-~-~2*~016);
    System.out.println(~-20*(~1+6));
    System.out.println(~-~20/~1*-~6);
    System.out.println(~-20<<-~1|6);
    System.out.println(~-(20*~(1-6)));
    System.out.println(20*(~1+6));
    System.out.println(-~(20*~(1-6)));
    System.out.println(~-~-20|1<<6);
    System.out.println(~-20|1<<6);
    System.out.println(20|1<<6);
    System.out.println(-~20|1<<6);
    System.out.println(20<<-~1|6);
    System.out.println(20<<-~1|-~6);
    System.out.println(-~-~20*(~1+6));
    System.out.println(~20*~-~-~1+~-6);
    System.out.println(~-~-20*-(1-6));
    System.out.println(~20*~-~-~1-~6);
    System.out.println(~20*~-~-~1-~-~6);
    System.out.println(~2^~-~01<<~-6);
    System.out.println(-2^~-~01<<~-6);
    System.out.println(~-20*1*~-6);
    System.out.println((2+01)<<~-6);
    System.out.println(-~(~2*~-~0*16));
    System.out.println(~-~-(20*-(1-6)));
    System.out.println(~-(20*1*~-6));
    System.out.println(20*-(1-6));
  }
}


答:
R, 50 44 42 36

```<code>ifelse(!is.na(sample(c(NA,1:5),1)),'I Survived!',)
</code>```

```<code>ifelse(floor(runif(1,0,5))>0,'I Survived!',)
</code>```

```<code>ifelse(floor(runif(1,0,5)),'I Survived!',)
</code>```

```<code>ifelse(sample(0:5,1),'I Survived!',)
</code>```

Death Err Message:

Error in ifelse(!is.na(1/sample(c(NA, 1:5), 1)), "I Survived!", ) :
    argument "no" is missing, with no default

Title: Russian Roulette

Body:
Write a program which plays Russian Roulette!

If the program is started,

there should be a 5 in 6 chance of it ending normally after printing "I survived!"

there should be a 1 in 6 chance of the program crashing. (segmentation fault, etc.)

No input, and no other outputs are allowed.

The randomness must be fair: it must have a uniform probability distribution. This means an uninitialized variable (or a RNG without seed) MOD 6 will not be sufficient.

If the solution works with only one dedicated operating system / platform, you will receive a 6 byte penalty to the score.

Shortest code wins, not sooner than 10 days after first valid answer.

Body:
R, 50 44 42 36

ifelse(!is.na(sample(c(NA,1:5),1)),'I Survived!',)

ifelse(floor(runif(1,0,5))>0,'I Survived!',)

ifelse(floor(runif(1,0,5)),'I Survived!',)

ifelse(sample(0:5,1),'I Survived!',)

Death Err Message:

Error in ifelse(!is.na(1/sample(c(NA, 1:5), 1)), "I Survived!", ) :
    argument "no" is missing, with no default


答:
Javascript (ES6), <s>55</s> 51 bytes

4 bytes thanks to Neil.

f=(x,c=x)=>c==[...c+""].reverse().join``?c:f(x,x+c)```
<pre class="snippet-code-html lang-html prettyprint-override"><code><input type=number min=1 oninput=o.textContent=this.value%10&&f(+this.value)><pre id=o></code>```

Body:
Javascript (ES6), <s>55</s> 51 bytes

4 bytes thanks to Neil.

f=(x,c=x)=>c==[...c+""].reverse().join``?c:f(x,x+c)

<input type=number min=1 oninput=o.textContent=this.value%10&&f(+this.value)><pre id=o>


答:
Pyke, <s>11</s> 9 bytes

```<code>.f*`D_q)*
</code>```

Try it here!

Body:
Pyke, <s>11</s> 9 bytes

.f*`D_q)*

Try it here!


答:
CJam, 10 bytes

```<code>{S-$e`::*}
</code>```

An unnamed block that expects the string on top of the stack and replaces it with a list of strings.

Try it online!

Explanation

```<code>S-  Remove spaces.
$   Sort.
e`  Run-length encode, gives pairs [R C], where R is the run-length and
    C is the character.
::* Repeat the C in each pair R times.
</code>```

Title: Exploded view of a string

Body:
Don't you love those exploded-view diagrams  in which a machine or object is taken apart into its smallest pieces?

Let's do that to a string!

The challenge

Write a program or function that

inputs a string containing only printable ASCII characters;

dissects the string into groups of non-space equal characters (the "pieces" of the string);

outputs those groups in any convenient format, with some separator between groups.

For example, given the string

```<code>Ah, abracadabra!
</code>```

the output would be the following groups:

```
!
,
A
aaaaa
bb
c
d
h
rr
```

Each group in the output contains equal characters, with spaces removed. A newline has been used as separator between groups. More about allowed formats below.

Rules

The input should be a string or an array of chars. It will only contain printable ASCII chars (the inclusive range from space to tilde). If your language does not support that, you can take the input in the form of numbers representing ASCII codes.

You can assume that the input contains at least one non-space character.

The output should consist of characters (even if the input is by means of ASCII codes). There has to be an unambiguous separator between groups, different than any non-space character that may appear in the input.

If the output is via function return, it may also be an array or strings, or an array of arrays of chars, or similar structure. In that case the structure provides the necessary separation.

A separator between characters of each group is optional. If there is one, the same rule applies: it can't be a non-space character that may appear in the input. Also, it can't be the same separator as used between groups.

Other than that, the format is flexible. Here are some examples:

The groups may be strings separated by newlines, as shown above.

The groups may be separated by any non-ASCII character, such as  ¬. The output for the above input would be the string:

```<code>!¬,¬A¬aaaaa¬bb¬c¬d¬h¬rr
</code>```

The groups may be separated by n>1 spaces (even if n is variable), with chars between each group separated by a single space:

```<code>!  ,    A   a a a a a    b b  c       d   h  r r
</code>```

The output may also be an array or list of strings returned by a function:

```<code>['!', 'A', 'aaaaa', 'bb', 'c', 'd', 'h', 'rr']
</code>```

Or an array of char arrays:

```<code>[['!'], ['A'], ['a', 'a', 'a', 'a', 'a'], ['b', 'b'], ['c'], ['d'], ['h'], ['r', 'r']]
</code>```

Examples of formats that are not allowed, according to the rules:

A comma can't be used as separator (!,,,A,a,a,a,a,a,b,b,c,d,h,r,r), because the input may contain commas.

It's not accepted to drop the separator between groups (!,Aaaaaabbcdhrr) or to use the same separator between groups and within groups (! , A a a a a a b b c d h r r).

The groups may appear in any order in the output. For example: alphabetical order (as in the examples above), order of first appearance in the string, ... The order need not be consistent or even deterministic.

Note that the input cannot contain newline characters, and A and a are different characters (grouping is case-sentitive).

Shortest code in bytes wins.

Test cases

In each test case, first line is input, and the remaining lines are the output, with each group in a different line.

Test case 1:

```
Ah, abracadabra!
!
,
A
aaaaa
bb
c
d
h
rr
```

Test case 2:

```
\o/\o/\o/
///
\\\
ooo
```

Test case 3:

```
A man, a plan, a canal: Panama!
!
,,
:
A
P
aaaaaaaaa
c
ll
mm
nnnn
p
```

Test case 4:

```
"Show me how you do that trick, the one that makes me scream" she said
""
,
S
aaaaa
cc
dd
eeeeeee
hhhhhh
ii
kk
mmmm
n
ooooo
rr
ssss
tttttt
u
ww
y
```

Body:
CJam, 10 bytes

{S-$e`::*}

An unnamed block that expects the string on top of the stack and replaces it with a list of strings.

Try it online!

Explanation

S-  Remove spaces.
$   Sort.
e`  Run-length encode, gives pairs [R C], where R is the run-length and
    C is the character.
::* Repeat the C in each pair R times.


答:
Pyke, <s>16</s> 9 bytes

```<code>d-}F/i*d+
</code>```

Try it here!

Title: Exploded view of a string

Body:
Pyke, <s>16</s> 9 bytes

d-}F/i*d+

Try it here!


答:
PHP, 39 bytes

```<code>while(strrev($i+=$argv[1])!=$i);echo$i;
</code>```

Takes number N as argument $argv[1];

; after while to do nothing

strrev return string backward

Same length with for-loop

```<code>for(;strrev($i+=$argv[1])!=$i;);echo$i;
</code>```

Body:
PHP, 39 bytes

while(strrev($i+=$argv[1])!=$i);echo$i;

Takes number N as argument $argv[1];

; after while to do nothing

strrev return string backward

Same length with for-loop

for(;strrev($i+=$argv[1])!=$i;);echo$i;


问:
How can I get a repdigit?
In honor of how much rep I had several hours ago, when I first thought of this challenge:

Numbers like this that are made up of a single digit repeating are called repdigits. Repdigits are fun! Every body would be more happy if the amount of rep they had was a repdigit¹, but I am impatient, so you need to help me find out the fastest way to get to a repdigit.

Here is your challenge:

Given a positive integers representing reputation, output the minimum amount of rep they need to gain to get to a repdigit. For example, at the time of writing this challenge, user Martin Ender had 102,856 rep. The nearest rep-digit is 111,111, so he would need to gain: 8255 rep to be at a repdigit.

Since people dislike losing rep, we will only consider non-negative changes. This means that, for example, if someone is at 12 rep, rather than losing 1 rep, the solution is to gain 10 rep. This allows '0' to be a valid output, since anyone who has 111 rep is already at a repdigit.

Input and output can be in any reasonable format, and since it is impossible to have less than 1 rep on any Stack Exchange site, you can assume no inputs will be less than 1.

One cornercase to note:

If a user has less than 10 rep, they are already at a repdigit, and so they also need '0'.

Test IO:

```<code>#Input      #Ouput
8           0
100         11
113         109
87654321    1234567
42          2
20000       2222
11132       11090
</code>```

Standard loopholes apply, and the shortest solution in bytes wins!

答:
Java, 59 bytes

int c(int i){return(i+"").matches("^(.)\\1*$")?0:c(i+1)+1;}
```

<p><em>(I'm still not sure how to count Java entries, but according to the standard set by the first Java entry, this entry is 59 bytes, since it's 17 bytes shorter).</em></p>

<p>Anyway, if we have a repdigit, return 0, else add 1 to the input, call itself and add 1 to the result.</p>

<hr>

<p><strong>Ungolfed & test cases:</strong></p>

<p>Try it here.</p>

<pre class="lang-java prettyprint-override"><code>class Main{
  static int c(int i) {
    return
      (i+"").matches("^(.)\\1*$")
      ? 0
      : c(i+1) + 1;
  }

  public static void main(String[] a){
    System.out.println(c(8));
    System.out.println(c(100));
    System.out.println(c(113));
    System.out.println(c(42));
    System.out.println(c(20000));
    System.out.println(c(19122));
    // Entry below will run out of memory
    System.out.println(c(19121));
  }
}
</code>```

Output:

Runtime error   time: 0.09 memory: 321152 signal:-1
0
11
109
2
2222
3100
```

As you can see, the last entry runs out of memory before it can finish. The (very appropriate) StackOverflowError is thrown from java.util.regex.Pattern.sequence(Pattern.java:2134), but I'm pretty confident there's nothing wrong with the regex itself, since it's the same one I used in my previous entry.

Title: How can I get a repdigit?

Body:
Java, 59 bytes

int c(int i){return(i+"").matches("^(.)\\1*$")?0:c(i+1)+1;}

(I'm still not sure how to count Java entries, but according to the standard set by the first Java entry, this entry is 59 bytes, since it's 17 bytes shorter).

Anyway, if we have a repdigit, return 0, else add 1 to the input, call itself and add 1 to the result.

Ungolfed & test cases:

Try it here.

class Main{
  static int c(int i) {
    return
      (i+"").matches("^(.)\\1*$")
      ? 0
      : c(i+1) + 1;
  }

  public static void main(String[] a){
    System.out.println(c(8));
    System.out.println(c(100));
    System.out.println(c(113));
    System.out.println(c(42));
    System.out.println(c(20000));
    System.out.println(c(19122));
    // Entry below will run out of memory
    System.out.println(c(19121));
  }
}

Output:

Runtime error   time: 0.09 memory: 321152 signal:-1
0
11
109
2
2222
3100

As you can see, the last entry runs out of memory before it can finish. The (very appropriate) StackOverflowError is thrown from java.util.regex.Pattern.sequence(Pattern.java:2134), but I'm pretty confident there's nothing wrong with the regex itself, since it's the same one I used in my previous entry.


问:
Numbers of purity
Today we'll look at a sequence \$a\$, related to the Collatz function \$f\$:

$$f = \begin{cases}
n/2  & \text{if } n \equiv 0 \text{ (mod }2) \\
3n+1 & \text{if } n \equiv 1 \text{ (mod }2) \\
\end{cases}$$

We call a sequence of the form \$z, f(z), f(f(z)), …\$ a Collatz sequence.

The first number in our sequence, \$a(1)\$, is \$0\$. Under repeated application of \$f\$, it falls into a cycle \$0\to0\to0\to\:\cdots\$

The smallest number we haven't seen yet is 1, making \$a(2)=1\$. Under repeated application of \$f\$, it falls into a cycle \$1\to4\to2\to1\to\cdots\$

Now we have seen the number \$2\$ in the cycle above, so the next smallest number is \$a(3) = 3\$, falling into the cycle \$3\to10\to5\to16\to8\to4\to2\to1\to4\to\cdots\$

In all above cycles we've seen \$4\$ and \$5\$ already, so the next number is \$a(4) = 6\$.

By now you should get the idea. \$a(n)\$ is the smallest number that was not part of any Collatz sequences for all \$a(1), ..., a(n-1)\$

Write a program or function that, given an positive integer \$n\$, returns \$a(n)\$. Shortest code in bytes wins.

Testcases:

```<code>1  -> 0
2  -> 1
3  -> 3
4  -> 6
5  -> 7
6  -> 9
7  -> 12
8  -> 15
9  -> 18
10 -> 19
50 -> 114
</code>```

(This is OEIS sequence A061641.)

答:
Java, 148 bytes

int a(int n){if(n<2)return 0;int f=a(n-1),b,i,c;do{f++;for(b=1,i=1;i<n;i++)for(c=i==2?4:a(i);c>1;c=c%2>0?c*3+1:c/2)b=c==f?0:b;}while(b<1);return f;}
```

Ideone it! (Warning: exponential complexity due to zero optimization.)

Converting it from a do...while loop to a for loop would be golfier, but I am having trouble doing so.

Golfing advice is welcome as usual.

ContentLicense: CC BY-SA 4.0

Title: Numbers of purity

Body:
Java, 148 bytes

int a(int n){if(n<2)return 0;int f=a(n-1),b,i,c;do{f++;for(b=1,i=1;i<n;i++)for(c=i==2?4:a(i);c>1;c=c%2>0?c*3+1:c/2)b=c==f?0:b;}while(b<1);return f;}

Ideone it! (Warning: exponential complexity due to zero optimization.)

Converting it from a do...while loop to a for loop would be golfier, but I am having trouble doing so.

Golfing advice is welcome as usual.


答:
Java, <s>164</s> <s>159</s> <s>126</s> <s>108</s> 94 bytes

Golfed version:

```<code>int c(int a){int x=a;while(!(x+"").equals(new StringBuffer(x+"").reverse()+""))x+=a;return x;}
</code>```

Ungolfed version:

```<code>int c(int a)
{
    int x = a;
    while (!(x + "").equals(new StringBuffer(x + "").reverse() + ""))
        x += a;
    return x;
}
</code>```

Shoutout to Emigna and Kevin Cruijssen for contributing improvements and cutting the bytes almost in half :)

Body:
Java, <s>164</s> <s>159</s> <s>126</s> <s>108</s> 94 bytes

Golfed version:

int c(int a){int x=a;while(!(x+"").equals(new StringBuffer(x+"").reverse()+""))x+=a;return x;}

Ungolfed version:

int c(int a)
{
    int x = a;
    while (!(x + "").equals(new StringBuffer(x + "").reverse() + ""))
        x += a;
    return x;
}

Shoutout to Emigna and Kevin Cruijssen for contributing improvements and cutting the bytes almost in half :)


答:
Using the usual divide by zero method:

Perl 5.8 Version

```<code>1/(int rand 6)&&print "I survived!"
</code>```

Perl 5.10 Version

```<code>1/(int rand 6)&&say "I survived!"
</code>```

On failure, these will display:

```<code>Illegal division by zero at -e line 1.
</code>```

Using the bless function which is used for creating objects in perl.

Perl 5.8 Version

```<code>print (int rand 6?"I survived!":bless me);
</code>```

Perl 5.10 Version

```<code>say (int rand 6?"I survived!":bless me);
</code>```

On failure, these will display:

```<code>Can't bless non-reference value at -e line 1.
</code>```

Title: Russian Roulette

Body:
Using the usual divide by zero method:

Perl 5.8 Version

1/(int rand 6)&&print "I survived!"

Perl 5.10 Version

1/(int rand 6)&&say "I survived!"

On failure, these will display:

Illegal division by zero at -e line 1.

Using the bless function which is used for creating objects in perl.

Perl 5.8 Version

print (int rand 6?"I survived!":bless me);

Perl 5.10 Version

say (int rand 6?"I survived!":bless me);

On failure, these will display:

Can't bless non-reference value at -e line 1.


答:
Ruby, 42 characters

->n{i=0;n.next!&&i+=1while n.squeeze[1];i}
```

<p>Expects string input.</p>

<p>Sample run:</p>

```irb(main):019:0> ->n{i=0;n.next!&&i+=1while n.squeeze[1];i}['87654321']
=> 1234567
```

<h2>Ruby, 39 characters</h2>

<p>Recursive call, runs into “SystemStackError: stack level too deep” on bigger results.</p>

<pre class="lang-ruby prettyprint-override"><code>r=->n,i=0{n.squeeze[1]?r[n.next,i+1]:i}
</code>```

Sample run:

```<code>irb(main):001:0> r=->n,i=0{n.squeeze[1]?r[n.next,i+1]:i}
=> #<Proc:0x00000002367ca0@(irb):10 (lambda)>

irb(main):002:0> r['20000']
=> 2222
</code>```

Title: How can I get a repdigit?

Body:
In honor of how much rep I had several hours ago, when I first thought of this challenge:

Numbers like this that are made up of a single digit repeating are called repdigits. Repdigits are fun! Every body would be more happy if the amount of rep they had was a repdigit¹, but I am impatient, so you need to help me find out the fastest way to get to a repdigit.

Here is your challenge:

Given a positive integers representing reputation, output the minimum amount of rep they need to gain to get to a repdigit. For example, at the time of writing this challenge, user Martin Ender had 102,856 rep. The nearest rep-digit is 111,111, so he would need to gain: 8255 rep to be at a repdigit.

Since people dislike losing rep, we will only consider non-negative changes. This means that, for example, if someone is at 12 rep, rather than losing 1 rep, the solution is to gain 10 rep. This allows '0' to be a valid output, since anyone who has 111 rep is already at a repdigit.

Input and output can be in any reasonable format, and since it is impossible to have less than 1 rep on any Stack Exchange site, you can assume no inputs will be less than 1.

One cornercase to note:

If a user has less than 10 rep, they are already at a repdigit, and so they also need '0'.

Test IO:

```<code>#Input      #Ouput
8           0
100         11
113         109
87654321    1234567
42          2
20000       2222
11132       11090
</code>```

Standard loopholes apply, and the shortest solution in bytes wins!

Body:
Ruby, 42 characters

->n{i=0;n.next!&&i+=1while n.squeeze[1];i}

Expects string input.

Sample run:

irb(main):019:0> ->n{i=0;n.next!&&i+=1while n.squeeze[1];i}['87654321']
=> 1234567

Ruby, 39 characters

Recursive call, runs into “SystemStackError: stack level too deep” on bigger results.

r=->n,i=0{n.squeeze[1]?r[n.next,i+1]:i}

Sample run:

irb(main):001:0> r=->n,i=0{n.squeeze[1]?r[n.next,i+1]:i}
=> #<Proc:0x00000002367ca0@(irb):10 (lambda)>

irb(main):002:0> r['20000']
=> 2222


答:
Brachylog, <s>27</S> 23 bytes

```<code>:1f
hS,?tye.:S+:.L*$pL,
</code>```

Try it online!

Verify all testcases.

Predicate 0 (main predicate)

```<code>:1f                     Find all solutions of predicate 1
                        given Input as Input,
                        Unify Output with the set of all solutions.
</code>```

Predicate 1 (auxiliary predicate)

```<code>hS,?tye.:S+:.L*$pL,

hS                      the first element of Input is S,
   ?tye.                Output is an element between 0 and
                        the last element of Input,
       .:S+:.L          The list [Output+S,Output] is L,
             L*$pL      The product of L, prime-factorized, is still L
</code>```

Title: Variable Prime "Twins"

Body:
I am 2/3 twins with my brother, i.e. born on the same day of the same month but twelve years later. When I was 5, he was 17, both primes; the last pair of ages we can reasonably count on is [71, 83] with both of us being alive and able to celebrate this coincidental jubilee.

Task

Create a code that

takes two integers as input: the difference between the counter and the "twin" as a positive integer k (well yes, I'm the younger) and the upper bound as a positive integer u (runtime consideration)

and gives output as an array or list of all i numbers lower than or equal u for which both i and i+k are primes. The output does not need to be sorted.

Test Cases

```<code>12, 1000 -> [5, 7, 11, 17, 19, 29, 31, 41, 47, 59, 61, 67, 71, 89, 97, 101, 127, 137, 139, 151, 167, 179, 181, 199, 211, 227, 229, 239, 251, 257, 269, 271, 281, 337, 347, 367, 389, 397, 409, 419, 421, 431, 449, 467, 479, 487, 491, 509, 557, 587, 601, 607, 619, 631, 641, 647, 661, 727, 739, 757, 761, 797, 809, 811, 827, 907, 929, 941, 971, 997]
2, 999 -> [3, 5, 11, 17, 29, 41, 59, 71, 101, 107, 137, 149, 179, 191, 197, 227, 239, 269, 281, 311, 347, 419, 431, 461, 521, 569, 599, 617, 641, 659, 809, 821, 827, 857, 881]
3, 1500 -> [2]
30, 1500 -> [7, 11, 13, 17, 23, 29, 31, 37, 41, 43, 53, 59, 67, 71, 73, 79, 83, 97, 101, 107, 109, 127, 137, 149, 151, 163, 167, 181, 193, 197, 199, 211, 227, 233, 239, 241, 251, 263, 277, 281, 283, 307, 317, 337, 349, 353, 359, 367, 379, 389, 401, 409, 419, 431, 433, 449, 457, 461, 479, 491, 541, 547, 557, 563, 569, 571, 577, 587, 601, 613, 617, 631, 643, 647, 653, 661, 709, 727, 739, 743, 757, 797, 809, 823, 827, 829, 853, 857, 877, 881, 907, 911, 937, 941, 947, 953, 967, 983, 991, 1009, 1019, 1021, 1031, 1033, 1039, 1061, 1063, 1087, 1093, 1123, 1151, 1163, 1171, 1187, 1193, 1201, 1229, 1249, 1259, 1277, 1289, 1291, 1297, 1399, 1409, 1423, 1429, 1451, 1453, 1459, 1481, 1493]
</code>```

Edit

Since I failed to specify the upper bound, both inclusive and exclusive solutions are welcome.

Edit No. 2

The challenge ends on 1st September, one week from the start.

Looks like we have a winner but in case of a tie popularity is the tie-breaker; in this case the "second" will be compensated via bounty.

Body:
Brachylog, <s>27</S> 23 bytes

:1f
hS,?tye.:S+:.L*$pL,

Try it online!

Verify all testcases.

Predicate 0 (main predicate)

:1f                     Find all solutions of predicate 1
                        given Input as Input,
                        Unify Output with the set of all solutions.

Predicate 1 (auxiliary predicate)

hS,?tye.:S+:.L*$pL,

hS                      the first element of Input is S,
   ?tye.                Output is an element between 0 and
                        the last element of Input,
       .:S+:.L          The list [Output+S,Output] is L,
             L*$pL      The product of L, prime-factorized, is still L


答:
Pyke, 10 bytes

```<code>S#_PiQ+_P&
</code>```

Try it here!

```<code>S#         - filter(range(input_2), V) as i
  _P       -   is_prime(i)
         & -  ^ & V
    iQ+    -    i + input_1
       _P  -   is_prime(^)
</code>```

Also 10 bytes:

```<code>S#_DP.IQ-P
</code>```

Try it here!

Title: Variable Prime "Twins"

Body:
Pyke, 10 bytes

S#_PiQ+_P&

Try it here!

S#         - filter(range(input_2), V) as i
  _P       -   is_prime(i)
         & -  ^ & V
    iQ+    -    i + input_1
       _P  -   is_prime(^)

Also 10 bytes:

S#_DP.IQ-P

Try it here!


答:
05AB1E, 9 bytes

Code:

```<code>LDpÏDI+pÏ
</code>```

Uses the CP-1252 encoding. Try it online!.

Title: Variable Prime "Twins"

Body:
05AB1E, 9 bytes

Code:

LDpÏDI+pÏ

Uses the CP-1252 encoding. Try it online!.


答:
Octave, <s>34</s> 33 bytes

```<code>@(k,u)(a=primes(u))(isprime(a+k))
</code>```

Title: Variable Prime "Twins"

Body:
Octave, <s>34</s> 33 bytes

@(k,u)(a=primes(u))(isprime(a+k))