答:
Java 7,140 bytes

```<code>void c(char[]a,int l,int j){if(l<1)return;c(a,--l,++j);for(int i=0,k;i<j;i++)for(k=0;k++<=i;)System.out.print(a[i+l]);System.out.println();}
</code>```

Ungolfed

```<code> void c(char[]a,int l,int j)
{
if (l < 1)
return ;
c(a , --l , ++j) ;
for(int i = 0 , k; i < j ; i++)
for(k = 0 ; k++ <= i ;)
System.out.print(a[i+l]);
System.out.println();
}
</code>```

Following line giving me very pain.i don't know how can i golfed it(because there are two loops to break the condition to put "\n" in print statement).

System.out.println();

Title: Exploded Suffixes

Body:
Java 7,140 bytes

void c(char[]a,int l,int j){if(l<1)return;c(a,--l,++j);for(int i=0,k;i<j;i++)for(k=0;k++<=i;)System.out.print(a[i+l]);System.out.println();}

Ungolfed

 void c(char[]a,int l,int j)
{
if (l < 1)
return ;
c(a , --l , ++j) ;
for(int i = 0 , k; i < j ; i++)
for(k = 0 ; k++ <= i ;)
System.out.print(a[i+l]);
System.out.println();
}

Following line giving me very pain.i don't know how can i golfed it(because there are two loops to break the condition to put "\n" in print statement).

System.out.println();


问:
Exploded Suffixes
Given an ASCII string, output the exploded suffixes of it. For example, if the string was abcde, there are 5 suffixes, ordered longest to shortest:

```<code>abcde
bcde
cde
de
e
</code>```

Each suffix is then exploded, meaning each character is copied as many times as its one-indexed location in that suffix. For example, exploding the suffixes of abcde,

```<code>abcde
12345
abbcccddddeeeee

bcde
1234
bccdddeeee

cde
123
cddeee

de
12
dee

e
1
e
</code>```

Altogether, the exploded suffixes of abcde are

```<code>abbcccddddeeeee
bccdddeeee
cddeee
dee
e
</code>```

Rules

This is code-golf so the shortest code wins.

The input will consist of the printable ASCII characters. (This excludes newlines but includes spaces.)

The output will have each string on a separate line.

Trailing spaces are allowed on each line and there may be an extra newline at the end.

Test Cases

```<code>''

'a'
a

'bc'
bcc
c

'xyz'
xyyzzz
yzz
z

'code-golf'
coodddeeee-----ggggggooooooollllllllfffffffff
oddeee----gggggoooooolllllllffffffff
dee---ggggooooollllllfffffff
e--gggoooolllllffffff
-ggooollllfffff
goolllffff
ollfff
lff
f

's p a c e'
s  ppp    aaaaa      ccccccc        eeeeeeeee
 pp   aaaa     cccccc       eeeeeeee
p  aaa    ccccc      eeeeeee
 aa   cccc     eeeeee
a  ccc    eeeee
 cc   eeee
c  eee
 ee
e
</code>```

答:
MATL, 12 bytes

```<code>&+gYRYs"G@Y"
</code>```

I love it when quote marks come together!

Try it online!

Explanation

This works by building a matrix whose columns are used, one by one, to run-length decode the input. As an example, for input 'abcde' the matrix is

```<code>1 0 0 0 0
2 1 0 0 0
3 2 1 0 0
4 3 2 1 0
5 4 3 2 1
</code>```

Code:

```<code>&+g    % Implicit input. NxN matrix of ones, where N is input size
YR     % Set entries above diagonal to zero
Ys     % Cumulative sum of each column. This gives the desired matrix
"      % For each column
  G    %   Push input (for example 'abcde')
  @    %   Push current column (for example [0;0;1;2;3])
  Y"   %   Run-length decode (example output 'cddeee')
       % Implicit end
       % Implicit display
</code>```

ContentLicense: CC BY-SA 3.0

Title: Exploded Suffixes

Body:
MATL, 12 bytes

&+gYRYs"G@Y"

I love it when quote marks come together!

Try it online!

Explanation

This works by building a matrix whose columns are used, one by one, to run-length decode the input. As an example, for input 'abcde' the matrix is

1 0 0 0 0
2 1 0 0 0
3 2 1 0 0
4 3 2 1 0
5 4 3 2 1

Code:

&+g    % Implicit input. NxN matrix of ones, where N is input size
YR     % Set entries above diagonal to zero
Ys     % Cumulative sum of each column. This gives the desired matrix
"      % For each column
  G    %   Push input (for example 'abcde')
  @    %   Push current column (for example [0;0;1;2;3])
  Y"   %   Run-length decode (example output 'cddeee')
       % Implicit end
       % Implicit display


问:
Generate a 6 character string from a 15 character alphabet
In one of our projects at work, we recently discovered a particularly large method for generating a 6 character string from a 15 character alphabet. A few of us claimed "I bet we can get that in one line" which started a little internal game of code golf.

Your task is to beat us, which I have no doubt won't take long!

The original algorithm used the alphabet 0-9A-E, but we've experimented with other alphabets. There are therefore three subtasks.

Generate a 6 character string randomly selecting from an arbitrary hardcoded 15 character alphabet like ABC123!@TPOI098. (This is just an example, and should be customizable without affecting the byte count.)

Generate a 6 character string randomly selecting from a 15 character alphabet 0123456789ABCDE.

Generate a 6 character string randomly selecting from a 15 character alphabet of your choice (printable characters only please).

Each character should have equal chance of selection and repetition should be possible.

The best we have been able to manage for each of the subtasks is:

"ABC123!@TPOI098" - 24 bytes

"0123456789ABCDE" - 21 bytes

Custom alphabet   -  13 bytes

Your score is the sum of the bytes in each subtask's solution. i.e. our score is currently 58.

We've attempted using among others, CJam and Ruby. The original was in C#. Use any language you like, but we'll be interested to see solutions in these languages particularly

答:
Jelly, 38 bytes

TryItOnline links A, B, and C.

A: ABC123!@£POI098, 22 bytes

```<code>“ABC123!@£POI098”Wẋ6X€
</code>```

(thinking about a compression to lessen this one)

B: 0123456789ABCDE, 8 bytes:

```<code>ØHṖWẋ6X€
</code>```

C:123456789ABCDEF (choice), 8 bytes:

```<code>ØHḊWẋ6X€
</code>```

How?

```<code>...Wẋ6X€ - common theme
   W     - wrap (string) in a list
    ẋ6   - repeat six times
      X€ - random choice from €ach

ØH...... - hexadecimal digit yield: "0123456789ABCDEF"

..Ṗ..... - pop: z[:-1] (B)

..Ḋ..... - dequeue: z[1:] (C)
</code>```

Body:
Jelly, 38 bytes

TryItOnline links A, B, and C.

A: ABC123!@£POI098, 22 bytes

“ABC123!@£POI098”Wẋ6X€

(thinking about a compression to lessen this one)

B: 0123456789ABCDE, 8 bytes:

ØHṖWẋ6X€

C:123456789ABCDEF (choice), 8 bytes:

ØHḊWẋ6X€

How?

...Wẋ6X€ - common theme
   W     - wrap (string) in a list
    ẋ6   - repeat six times
      X€ - random choice from €ach

ØH...... - hexadecimal digit yield: "0123456789ABCDEF"

..Ṗ..... - pop: z[:-1] (B)

..Ḋ..... - dequeue: z[1:] (C)


答:
Perl, 46 + 26 + 26 = 98 bytes

A lot of the credit goes to @Dom Hastings for saving 13 bytes!

The 3 programs are pretty much identical, except for the alphabet that changes.

Hardcoded alphabet (ABC123!@)POI098 in this example) -> 46 bytes:

say map{substr"ABC123!@)POI098",15*rand,1}1..6

Fixed alphabet 0123456789ABCDE -> 26 bytes:

printf"%X",rand 15for 1..6

Custom alphabet 0123456789ABCDE in that case -> 26 bytes:

printf"%X",rand 15for 1..6

You can put them all in a file to run them :

```<code>$ cat 6chr_strings.pl
say map{substr"ABC123!@)POI098",15*rand,1}1..6;
say "";
printf"%X",rand 15for 1..6;
say "";
printf"%X",rand 15for 1..6;
say "";
$ perl -M5.010 6chr_string.pl
CB8!8!
24D582
9ED58C
</code>```

(the say ""; are just here to improve the output format)

Title: Generate a 6 character string from a 15 character alphabet

Body:
In one of our projects at work, we recently discovered a particularly large method for generating a 6 character string from a 15 character alphabet. A few of us claimed "I bet we can get that in one line" which started a little internal game of code golf.

Your task is to beat us, which I have no doubt won't take long!

The original algorithm used the alphabet 0-9A-E, but we've experimented with other alphabets. There are therefore three subtasks.

Generate a 6 character string randomly selecting from an arbitrary hardcoded 15 character alphabet like ABC123!@TPOI098. (This is just an example, and should be customizable without affecting the byte count.)

Generate a 6 character string randomly selecting from a 15 character alphabet 0123456789ABCDE.

Generate a 6 character string randomly selecting from a 15 character alphabet of your choice (printable characters only please).

Each character should have equal chance of selection and repetition should be possible.

The best we have been able to manage for each of the subtasks is:

"ABC123!@TPOI098" - 24 bytes

"0123456789ABCDE" - 21 bytes

Custom alphabet   -  13 bytes

Your score is the sum of the bytes in each subtask's solution. i.e. our score is currently 58.

We've attempted using among others, CJam and Ruby. The original was in C#. Use any language you like, but we'll be interested to see solutions in these languages particularly

Body:
Perl, 46 + 26 + 26 = 98 bytes

A lot of the credit goes to @Dom Hastings for saving 13 bytes!

The 3 programs are pretty much identical, except for the alphabet that changes.

Hardcoded alphabet (ABC123!@)POI098 in this example) -> 46 bytes:

say map{substr"ABC123!@)POI098",15*rand,1}1..6

Fixed alphabet 0123456789ABCDE -> 26 bytes:

printf"%X",rand 15for 1..6

Custom alphabet 0123456789ABCDE in that case -> 26 bytes:

printf"%X",rand 15for 1..6

You can put them all in a file to run them :

$ cat 6chr_strings.pl
say map{substr"ABC123!@)POI098",15*rand,1}1..6;
say "";
printf"%X",rand 15for 1..6;
say "";
printf"%X",rand 15for 1..6;
say "";
$ perl -M5.010 6chr_string.pl
CB8!8!
24D582
9ED58C

(the say ""; are just here to improve the output format)


答:
JavaScript (ES6), 184 bytes

Custom alphabet: 66 bytes

```<code>_=>"......".replace(/./g,c=>"ABC123!@TPOI098"[Math.random()*15|0])
</code>```

0-9A-E: 63 bytes

```<code>_=>"......".replace(/./g,c=>"ABCDE"[n=Math.random()*15|0]||n-5)
</code>```

0-9a-e: 55 bytes

```<code>_=>(Math.random()*11390625+1e8|0).toString(15).slice(1)
</code>```

(Subtract 6 bytes if date-based randomness is permissible.)

Body:
JavaScript (ES6), 184 bytes

Custom alphabet: 66 bytes

_=>"......".replace(/./g,c=>"ABC123!@TPOI098"[Math.random()*15|0])

0-9A-E: 63 bytes

_=>"......".replace(/./g,c=>"ABCDE"[n=Math.random()*15|0]||n-5)

0-9a-e: 55 bytes

_=>(Math.random()*11390625+1e8|0).toString(15).slice(1)

(Subtract 6 bytes if date-based randomness is permissible.)


问:
How many answers does this question have?
Write a program or a function that outputs the integer number of answers this question has. Your solution should still work as more answers are added.

Languages that run in a browser may be run from the js console while on this page. Otherwise, you'd probably have to download this page. Multi-language solutions, e.g. wgeting the page and parsing it using grep is ok. Just sum up the command line and all source used.

This is code golf; shortest answer in bytes wins.

EDIT:

Let's allow at most one occourance of the url of this page to not count, either as input or in the source. No url shorteners, no data stored as get parameters etc. Quotes around url, if needed, still count. Taking the url as input is also fine. If you want to remove some part of the url, e.g. /how-many-answers..., you can, but it probably doesn't help you.

答:
Mathematica, 33 bytes

```<code>Length@Import[#,"Data"][[4,2]]-1&
</code>```

The input is the url of this page.

Body:
Mathematica, 33 bytes

Length@Import[#,"Data"][[4,2]]-1&

The input is the url of this page.


答:
Python 2, 120 bytes, 79 w/o URL

I can't say Python was made for this challenge.

```<code>import urllib
print[l for l in urllib.urlopen("http://codegolf.stackexchange.com/q/96298")if"answerCount"in l][0][83:-9]
</code>```

Unfortunately, inline import is the same length :(

Any help with golfing this further would be greatly appreciated!

If the URL (a whopping 41 bytes—over 1/3 my byte count) can be taken as input, it is 82 bytes:

```<code>import urllib
lambda u:[l for l in urllib.urlopen(u)if"answerCount"in l][0][83:-9]
</code>```

Title: How many answers does this question have?

Body:
Write a program or a function that outputs the integer number of answers this question has. Your solution should still work as more answers are added.

Languages that run in a browser may be run from the js console while on this page. Otherwise, you'd probably have to download this page. Multi-language solutions, e.g. wgeting the page and parsing it using grep is ok. Just sum up the command line and all source used.

This is code golf; shortest answer in bytes wins.

EDIT:

Let's allow at most one occourance of the url of this page to not count, either as input or in the source. No url shorteners, no data stored as get parameters etc. Quotes around url, if needed, still count. Taking the url as input is also fine. If you want to remove some part of the url, e.g. /how-many-answers..., you can, but it probably doesn't help you.

Body:
Python 2, 120 bytes, 79 w/o URL

I can't say Python was made for this challenge.

import urllib
print[l for l in urllib.urlopen("http://codegolf.stackexchange.com/q/96298")if"answerCount"in l][0][83:-9]

Unfortunately, inline import is the same length :(

Any help with golfing this further would be greatly appreciated!

If the URL (a whopping 41 bytes—over 1/3 my byte count) can be taken as input, it is 82 bytes:

import urllib
lambda u:[l for l in urllib.urlopen(u)if"answerCount"in l][0][83:-9]


答:
CJam, 48 bytes

Arbitrary alphabet, 23 bytes:

```<code>{"ABC123!@TPOI098"mR}6*
</code>```

Try it online!

Hex digits, 15 bytes:

```<code>{A,'F,65>+mR}6*
</code>```

Try it online!

Alphabet ABCDEFGHIJKLMNO, 10 bytes:

```<code>{Fmr'A+}6*
</code>```

Try it online!

Body:
CJam, 48 bytes

Arbitrary alphabet, 23 bytes:

{"ABC123!@TPOI098"mR}6*

Try it online!

Hex digits, 15 bytes:

{A,'F,65>+mR}6*

Try it online!

Alphabet ABCDEFGHIJKLMNO, 10 bytes:

{Fmr'A+}6*

Try it online!


答:
CJam (23 + 14 + 10 = 47 bytes)

Arbitrary alphabet: 23 bytes (online demo)

```<code>{"ABC123!@TPOI098"mR}6*
</code>```

Hexadecimal alphabet: 14 bytes (online demo)

```<code>{FmrAbHb'0+}6*
</code>```

Custom alphabet: ABCDEFGHIJKLMNO, 10 bytes (online demo)

```<code>{Fmr'A+}6*
</code>```

Dissection

The hexadecimal one is the interesting one:

```<code>{      e# Loop...
  Fmr  e#   Select a random number from 0 to 14
  AbHb e#   Convert to base 10 and then to base 17
       e#   (i.e. add 7 if the number is greater than 9)
  '0+  e#   Add character '0' (i.e. add 48 and convert from integer to character)
       e#   Note that 'A' - '0' = 17
}6*    e# ...six times
</code>```

The six characters are left on the stack and printed automatically.

Body:
CJam (23 + 14 + 10 = 47 bytes)

Arbitrary alphabet: 23 bytes (online demo)

{"ABC123!@TPOI098"mR}6*

Hexadecimal alphabet: 14 bytes (online demo)

{FmrAbHb'0+}6*

Custom alphabet: ABCDEFGHIJKLMNO, 10 bytes (online demo)

{Fmr'A+}6*

Dissection

The hexadecimal one is the interesting one:

{      e# Loop...
  Fmr  e#   Select a random number from 0 to 14
  AbHb e#   Convert to base 10 and then to base 17
       e#   (i.e. add 7 if the number is greater than 9)
  '0+  e#   Add character '0' (i.e. add 48 and convert from integer to character)
       e#   Note that 'A' - '0' = 17
}6*    e# ...six times

The six characters are left on the stack and printed automatically.


问:
Natural Pi #1 - Sand

Goal

Generate (N) random line segments of uniform length (l), check if they cross the equidistant (t) parallel lines.

Simulation

What are we simulating? Buffon's needle. Smooth out the sand in your sandbox, draw a set of equally spaced parallel lines (call the distance in between t). Take a straight stick of length l and drop it N times into the sandbox. Let the number of times it crossed a line be c. Then Pi = (2 * l * n) / (t * c)!

How are we simulating this?

Take input N,t,l

With N, t, l all being positive integers

Do the following N times:

Generate a uniformly random integer coordinate x,y

With 1 <= x, y <= 10^6

x,y is the center of a line segment of length l

Generate a uniformly random integer a

With 1 <= a <= 180

Let P be the point where the line segment would cross the x-axis

Then a is the angle (x,y), P, (inf,0)

Count the number, c, of line segments that cross the line x = i*t for any integer i

Return (2 * l * N) / (t * c)

Specification

Input

Flexible, take input in any of the standard ways (eg function parameter,STDIN) and in any standard format (eg String, Binary)

Output

Flexible, give output in any of the standard ways (eg return, print)

White space, trailing and leading white space is acceptable

Accuracy, please provide at least 4 decimal places of accuracy (ie 3.1416)

Scoring

Shortest code wins!

Test Cases

Your output may not line up with these, because of random chance. But on average, you should get about this much accuracy for the given value of N, t, l.

```<code>Input (N,t,l)    ->  Output
-----------        ------
10,10,5          -> ?.????
10,100,50        -> ?.????
1000,1000,600    -> 3.????
10000,1000,700   -> 3.1???
100000,1000,700  -> 3.14??
</code>```

TL;DR

These challenges are simulations of algorithms that only require nature and your brain (and maybe some re-usable resources) to approximate Pi. If you really need Pi during the zombie apocalypse, these methods don't waste ammo! There are nine challenges total.

答:
R, <s>113</s> <s>100</s> <s>75</s> <s>70</s> <s>68</s> <s>67</s> <s>65</s> <s>59</s> <s>63</s> 57 bytes

As a statistical, functional programming language, it's not surprising that R is fairly well-suited to this kind of task. The fact that most functions can take vectorized input is really helpful for this problem, as rather than looping over N iterations, we just pass around vectors of size N. Thanks to @Billywob for some suggestions that lead to cutting off 4 bytes. Many thanks to @Primo for patiently explaining to me how my code wasn't working for cases where t > l, which is now fixed.

```<code>pryr::f(2*l*N/t/sum(floor(runif(N)+sinpi(runif(N))*l/t)))
</code>```

Try it online!

Sample output:

```<code>N=1000, t=1000, l=500
3.037975

N=10000, t=1000, l=700
3.11943

N=100000, t=1000, l=700
3.140351
</code>```

Explanation

The problem boils down to determining whether the two x values of the needle are on either side of a parallel line. This has some important consequences:

y-values are irrelevant

The absolute location on the x-axis is irrelevant, only the position relative to the closest parallel lines.

Essentially this is a task in a 1-dimensional space, where we generate a line with length in [0, l] (the angle a determines this length), and then we check to see how many times this length exceeds t. The rough algorithm is then:

Sample x1 values from [0, 1000000]. Since parallel lines occur at every tth point along the x-axis, the relative x-position is x modulo t.

Sample an angle a.

Calculate the x2 position based on a.

Check how many times x1+x2 fits into t, i.e. take the floor of (x1+x2)/t.

Sampling N numbers in [0, 1e6] modulo t is equivalent to simply sampling N numbers in [0, t]. Since (x1+x2)/t is equivalent to x1/t + x2/t, the first step becomes sampling from [0, t]/t, i.e. [0, 1]. Lucky for us, that is the default range for R's runif function, which returns N real numbers from 0 to 1 from a uniform distribution.

```<code>                          runif(N)
</code>```

We repeat this step to generate a, the angle of the needle.

```<code>                                         runif(N)
</code>```

These numbers are is interpreted as a half-turn (i.e. .5 is 90 degrees). (The OP asks for degrees from 1 to 180, but in comments it's clarified that any method is allowed if it is as or more precise.) For an angle θ, sin(θ) gives us the x-axis distance between the ends of the needle. (Normally you'd use the cosine for something like this; but in our case, we are considering the angle θ as being relative to the y-axis, not the x-axis (that is, a value of 0 degrees goes up, not right), and therefore we use the sine, which basically phase-shifts the numbers.) Multiplied by l this gives us the x location of the end of the needle.

```<code>                                   sinpi(runif(N))*l
</code>```

Now we divide by t and add the x1 value. This yields (x1+x2)/t, which is how far the needle protrudes from x1, in terms of number of parallel lines. To get the integer of how many lines were crossed, we take the floor.

```<code>                    floor(runif(N)+sinpi(runif(N))*l/t)
</code>```

We calculate the sum, giving us the count c of how many lines are crossed by needles.

```<code>                sum(floor(runif(N)+sinpi(runif(N))*l/t))
</code>```

The rest of the code is just implementing the formula for approximating pi, that is, (2*l*N)/(t*c). We save some bytes on parentheses by taking advantage of the fact that (2*l*N)/(t*c) == 2*l*N/t/c:

```<code>        2*l*N/t/sum(floor(runif(N)+sinpi(runif(N))*l/t))
</code>```

And the whole thing is wrapped into an anonymous function:

```<code>pryr::f(2*l*N/t/sum(floor(runif(N)+sinpi(runif(N))*l/t)))
</code>```

Title: Natural Pi #1 - Sand

Body:
R, <s>113</s> <s>100</s> <s>75</s> <s>70</s> <s>68</s> <s>67</s> <s>65</s> <s>59</s> <s>63</s> 57 bytes

As a statistical, functional programming language, it's not surprising that R is fairly well-suited to this kind of task. The fact that most functions can take vectorized input is really helpful for this problem, as rather than looping over N iterations, we just pass around vectors of size N. Thanks to @Billywob for some suggestions that lead to cutting off 4 bytes. Many thanks to @Primo for patiently explaining to me how my code wasn't working for cases where t > l, which is now fixed.

pryr::f(2*l*N/t/sum(floor(runif(N)+sinpi(runif(N))*l/t)))

Try it online!

Sample output:

N=1000, t=1000, l=500
3.037975

N=10000, t=1000, l=700
3.11943

N=100000, t=1000, l=700
3.140351

Explanation

The problem boils down to determining whether the two x values of the needle are on either side of a parallel line. This has some important consequences:

y-values are irrelevant

The absolute location on the x-axis is irrelevant, only the position relative to the closest parallel lines.

Essentially this is a task in a 1-dimensional space, where we generate a line with length in [0, l] (the angle a determines this length), and then we check to see how many times this length exceeds t. The rough algorithm is then:

Sample x1 values from [0, 1000000]. Since parallel lines occur at every tth point along the x-axis, the relative x-position is x modulo t.

Sample an angle a.

Calculate the x2 position based on a.

Check how many times x1+x2 fits into t, i.e. take the floor of (x1+x2)/t.

Sampling N numbers in [0, 1e6] modulo t is equivalent to simply sampling N numbers in [0, t]. Since (x1+x2)/t is equivalent to x1/t + x2/t, the first step becomes sampling from [0, t]/t, i.e. [0, 1]. Lucky for us, that is the default range for R's runif function, which returns N real numbers from 0 to 1 from a uniform distribution.

                          runif(N)

We repeat this step to generate a, the angle of the needle.

                                         runif(N)

These numbers are is interpreted as a half-turn (i.e. .5 is 90 degrees). (The OP asks for degrees from 1 to 180, but in comments it's clarified that any method is allowed if it is as or more precise.) For an angle θ, sin(θ) gives us the x-axis distance between the ends of the needle. (Normally you'd use the cosine for something like this; but in our case, we are considering the angle θ as being relative to the y-axis, not the x-axis (that is, a value of 0 degrees goes up, not right), and therefore we use the sine, which basically phase-shifts the numbers.) Multiplied by l this gives us the x location of the end of the needle.

                                   sinpi(runif(N))*l

Now we divide by t and add the x1 value. This yields (x1+x2)/t, which is how far the needle protrudes from x1, in terms of number of parallel lines. To get the integer of how many lines were crossed, we take the floor.

                    floor(runif(N)+sinpi(runif(N))*l/t)

We calculate the sum, giving us the count c of how many lines are crossed by needles.

                sum(floor(runif(N)+sinpi(runif(N))*l/t))

The rest of the code is just implementing the formula for approximating pi, that is, (2*l*N)/(t*c). We save some bytes on parentheses by taking advantage of the fact that (2*l*N)/(t*c) == 2*l*N/t/c:

        2*l*N/t/sum(floor(runif(N)+sinpi(runif(N))*l/t))

And the whole thing is wrapped into an anonymous function:

pryr::f(2*l*N/t/sum(floor(runif(N)+sinpi(runif(N))*l/t)))


问:
Appease Your Google Overlords: Draw the "G" Logo
Write a program or function that takes in a positive integer N, and outputs an N×N pixel image of Google's "G" logo according to this* construction:

For example, if N is 400, a 400×400 pixel logo should be output, with correct dimensions and colors:

It should look accurate regardless of how large or small N is. e.g. here is N = 13:

Your code should not need to connect to the internet. For example, scaling an externally hosted svg is not allowed. (Scaling an svg encoded in your code would be fine though.)

Anti-aliasing may be used or not. It's up to you.

Notice that the horizontal bar of the "G" does not extend all the way to the right edge of the image. The circle curves normally inward on the right edge before it is cut off.

The shortest code in bytes wins.

* The construction of the logo has been simplified for this challenge. The correct construction can be seen here and here.

答:
SAS - <s>590</s> <s>536</s> 521 bytes

This uses the GTL Annotation facility. Input is specified in a macro variable on the first line. For a few extra bytes you can define the whole thing as a macro. It still sneaks in below Java and a few of the HTML answers, even though you have to define a null graph template just to be able to plot anything at all!

I've left the line breaks in for a modicum of readability, but I'm not counting those towards the total as it works without them.

```<code>%let R=;
%let F=FILLCOLOR;
ods graphics/width=&R height=&R;
proc template;
define statgraph a;
begingraph;
annotate;
endgraph;
end;
data d;
retain FUNCTION "RECTANGLE" DISPLAY "FILL" DRAWSPACE "graphPERCENT";
length &F$8;
_="CX4285F4";
P=100/&R;
HEIGHT=P;
width=P;
do i=1to &R;
x1=i*P;
U=x1-50;
do j=1to &R;
y1=j*P;
V=y1-50;
r=euclid(U,V);
&F="";
if 30<=r<=50then if V>U then if V>-U then &F="CXEA4335";
else &F="CXFBBC05";
else if V<-U then &F="CX34A853";
else if V<10then &F=_;
if &F>'' then output;
end;
end;
x1=65;
y1=50;
width=30;
height=20;
&F=_;
output;
proc sgrender sganno=d template=a;
</code>```

Edit: shaved off a few more bytes via use of macro vars, default settings and choice of operators.

Edit 2: got rid of the do-end blocks for the if-then-else logic and it somehow still works - I don't entirely understand how. Also, I discovered the euclid function!

Body:
SAS - <s>590</s> <s>536</s> 521 bytes

This uses the GTL Annotation facility. Input is specified in a macro variable on the first line. For a few extra bytes you can define the whole thing as a macro. It still sneaks in below Java and a few of the HTML answers, even though you have to define a null graph template just to be able to plot anything at all!

I've left the line breaks in for a modicum of readability, but I'm not counting those towards the total as it works without them.

%let R=;
%let F=FILLCOLOR;
ods graphics/width=&R height=&R;
proc template;
define statgraph a;
begingraph;
annotate;
endgraph;
end;
data d;
retain FUNCTION "RECTANGLE" DISPLAY "FILL" DRAWSPACE "graphPERCENT";
length &F$8;
_="CX4285F4";
P=100/&R;
HEIGHT=P;
width=P;
do i=1to &R;
x1=i*P;
U=x1-50;
do j=1to &R;
y1=j*P;
V=y1-50;
r=euclid(U,V);
&F="";
if 30<=r<=50then if V>U then if V>-U then &F="CXEA4335";
else &F="CXFBBC05";
else if V<-U then &F="CX34A853";
else if V<10then &F=_;
if &F>'' then output;
end;
end;
x1=65;
y1=50;
width=30;
height=20;
&F=_;
output;
proc sgrender sganno=d template=a;

Edit: shaved off a few more bytes via use of macro vars, default settings and choice of operators.

Edit 2: got rid of the do-end blocks for the if-then-else logic and it somehow still works - I don't entirely understand how. Also, I discovered the euclid function!


答:
JavaScript (ES6), <s>167</s> <s>166</s> <s>164</s> 163 bytes

Saved 1 byte thanks to Neil

Saved 2 bytes thanks to ETHproductions

Saved 1 byte thanks to premek.v

Hardcoded: "ABC123!@TPOI098" (58 bytes)

```<code>f=(n=6)=>n?"ABC123!@TPOI098"[Math.random()*15|0]+f(n-1):''
</code>```

Fixed: "0123456789ABCDE" (<s>58</s> 57 bytes)

```<code>f=(n=6)=>n?f(n-1)+("ABCDE"[n=Math.random()*15|0]||n-5):''
</code>```

Custom: "()+.1=>?M[afhnt" (<s>51</s> <s>49</s> 48 bytes)

```<code>f=(n=6)=>n?(f+1)[Math.random()*15|0+5]+f(n-1):''
</code>```

Body:
JavaScript (ES6), <s>167</s> <s>166</s> <s>164</s> 163 bytes

Saved 1 byte thanks to Neil

Saved 2 bytes thanks to ETHproductions

Saved 1 byte thanks to premek.v

Hardcoded: "ABC123!@TPOI098" (58 bytes)

f=(n=6)=>n?"ABC123!@TPOI098"[Math.random()*15|0]+f(n-1):''

Fixed: "0123456789ABCDE" (<s>58</s> 57 bytes)

f=(n=6)=>n?f(n-1)+("ABCDE"[n=Math.random()*15|0]||n-5):''

Custom: "()+.1=>?M[afhnt" (<s>51</s> <s>49</s> 48 bytes)

f=(n=6)=>n?(f+1)[Math.random()*15|0+5]+f(n-1):''


问:
Bootstrap JSF**k
In Javascript you can recover the complete language using only the symbols ()[]!+. Here's the basics:

```<code>false       =>  ![]
true        =>  !![]
undefined   =>  [][[]]
NaN         =>  +[![]]
0           =>  +[]
1           =>  +!+[]
2           =>  !+[]+!+[]
10          =>  [+!+[]]+[+[]]
Array       =>  []
Number      =>  +[]
String      =>  []+[]
Boolean     =>  ![]
Function    =>  []["filter"]
eval        =>  []["filter"]["constructor"]( CODE )()
window      =>  []["filter"]["constructor"]("return this")()
</code>```

That's great and all, but where did they get those first 6 characters from? I think it's best we help them out.

Simply write a program or function that outputs (at least) the 6 characters []()!+ in any order you want, as many times as you want, with as many other characters in between as you want. Shortest code wins. Gold star if you use less than 6 unique characters to do so.

答:
Brainfuck, 5 bytes

```<code>+[+.]
</code>```

Try it online!

Explanation

Increments the byte under the data pointer, then loops while the byte under the data pointer is not zero (until the value overflows and gets back to zero), incrementing and printing the value.

Title: Bootstrap JSF**k

Body:
Brainfuck, 5 bytes

+[+.]

Try it online!

Explanation

Increments the byte under the data pointer, then loops while the byte under the data pointer is not zero (until the value overflows and gets back to zero), incrementing and printing the value.


问:
A Triangular Slice of Squared Pi
Inspired by Bake a slice of Pi

Challenge

Given input 3 <= n <= 100 and 3 <= y <= n, construct an n x n matrix of the decimal portion of pi (14159...), starting in the top left. Then, take the upper-right triangle of size y x y and concatenate it together. Output the resulting number.

For example, for input n = 5, y = 3, the following matrix is constructed

```<code>14159
26535
89793
23846
26433
</code>```

Then, the upper-right 3 x 3 triangle would be

```<code>159
 35
  3
</code>```

so 159353 is the output.

Input

Two integers -- n representing the size of the square matrix of the digits of pi, and y representing the upper-right triangle -- in any convenient format.

Output

The resulting sliced and concatenated number, either printed/displayed to the screen, returned as a string, etc.

Trailing/leading whitespace is optional, so long as there's no whitespace in the output (i.e., 159 35  3 or the like would be invalid).

Note that since we're explicitly looking for the digits of pi, and not an approximation or mathematical calculation, answers should not round the final digit of the matrix.

Rules

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

Either a full program or function are acceptable.

Standard loopholes are forbidden.

Examples

```<code> n  y  output
-------------
 3  3  141923
 5  3  159353
 6  4  1592589383
 6  6  141592535893238643794
20 12  358979323846950288419715820974944628620899211706792306647223172745025559196615
</code>```

答:
Perl, 67 bytes

s/ /bpi++$_**2/e;$%=$';$%-=print/(.{$%})$/ for/\d{$`}/g
```

<p>Requires the command line option <code>-nMbignum=bpi</code>, counted as 12. Input is taken from stdin.</p>

<p><strong>Sample Usage</strong></p>

<pre class="lang-perl prettyprint-override"><code>$ echo 3 3 | perl -nMbignum=bpi primo-square-pi.pl
141923

$ echo 5 3 | perl -nMbignum=bpi primo-square-pi.pl
159353

$ echo 6 4 | perl -nMbignum=bpi primo-square-pi.pl
1592589383

$ echo 6 6 | perl -nMbignum=bpi primo-square-pi.pl
141592535893238643794

$ echo 20 12 | perl -nMbignum=bpi primo-square-pi.pl
358979323846950288419715820974944628620899211706792306647223172745025559196615
</code>```

Title: A Triangular Slice of Squared Pi

Body:
Perl, 67 bytes

s/ /bpi++$_**2/e;$%=$';$%-=print/(.{$%})$/ for/\d{$`}/g

Requires the command line option -nMbignum=bpi, counted as 12. Input is taken from stdin.

Sample Usage

$ echo 3 3 | perl -nMbignum=bpi primo-square-pi.pl
141923

$ echo 5 3 | perl -nMbignum=bpi primo-square-pi.pl
159353

$ echo 6 4 | perl -nMbignum=bpi primo-square-pi.pl
1592589383

$ echo 6 6 | perl -nMbignum=bpi primo-square-pi.pl
141592535893238643794

$ echo 20 12 | perl -nMbignum=bpi primo-square-pi.pl
358979323846950288419715820974944628620899211706792306647223172745025559196615


问:
Digital Diversity
A positive integer may be represented in an integer base \$1 \le b < \infty\$.

When converted to that base it has some number of distinct digits.

Any positive integer in base \$1\$ has \$1\$ distinct digit.

Most positive integers in base \$2\$ have \$2\$ distinct digits, the exceptions being those of the form \$2^n - 1\$, which only have \$1\$.

So the first positive integer that may be represented in an integer base with \$1\$ unique digit is \$1\$ and the first that may be represented with \$2\$ distinct digits is \$2\$.

We can say that \$1\$ is the first integer with digital diversity \$1\$ and \$2\$ is the first integer with digital diversity \$2\$.

Challenge:

Given a positive integer \$n\$ return the first positive integer (in base ten*) that has a digital diversity of \$n\$.

* if your language only supports a specific base (e.g. unary or binary) then you may output in that base.

Your algorithm must work in theory for any positive integer input: it may fail because the precision of your language's integer is too small for the output; but may not fail because base conversion is only defined up to some limit.

Test cases

```<code>input  output
   1     1
   2     2
   3     11
   4     75
   5     694
   6     8345
   7     123717
  17     49030176097150555672
  20     5271200265927977839335179
  35     31553934355853606735562426636407089783813301667210139
  63     3625251781415299613726919161860178255907794200133329465833974783321623703779312895623049180230543882191649073441
 257     87678437238928144977867204156371666030574491195943247606217411725999221158137320290311206746021269051905957869964398955543865645836750532964676103309118517901711628268617642190891105089936701834562621017362909185346834491214407969530898724148629372941508591337423558645926764610261822387781382563338079572769909101879401794746607730261119588219922573912353523976018472514396317057486257150092160745928604277707892487794747938484196105308022626085969393774316283689089561353458798878282422725100360693093282006215082783023264045094700028196975508236300153490495688610733745982183150355962887110565055971546946484175232
</code>```

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

OEIS: A049363 - also smallest pandigital number in base n.

答:
Brain-Flak, <s>84</s> 76 bytes

Thanks to Wheat Wizard for golfing 8 bytes

```<code>(({})<>){(({}[()]))}{}(<{}{}>)((())){{}({<({}[()])><>({})<>}{}{})([][()])}{}
</code>```

Try it online!

Explanation

The program pushes the values from 0 to n-1 to the stack replaces the top 0 and 1 with 1 and 0. Then it multiplies the top of the stack by n and adds the value below it until there is only one value remaining on the stack.

Essentially it finds the digits for the smallest number in base n that contains n different digits (for n > 1 it's always of the form 1023...(n-1)). It then calculates the number given the digits and the base.

Annotated Code

```<code>(({})<>)       # Pushes a copy of n to the right stack and switches to right stack
{(({}[()]))}{} # While the top of the stack != 0 copy the top of the stack-1
               #   and push it
(<{}{}>)       # Discard the top two values (0 and 1 for n > 1) and push 0
((()))         # Push 1 twice (second time so that the loop is works properly)
{{}            # Loop while stack height > 1
  (            #   Push...
    {<({}[()])><>({})<>}{} # The top value of the stack * n
    {}         #     Plus the value below the top of the stack
  )            #   End push
([][()])}{}    # End loop
</code>```

ContentLicense: CC BY-SA 4.0

Title: Digital Diversity

Body:
Brain-Flak, <s>84</s> 76 bytes

Thanks to Wheat Wizard for golfing 8 bytes

(({})<>){(({}[()]))}{}(<{}{}>)((())){{}({<({}[()])><>({})<>}{}{})([][()])}{}

Try it online!

Explanation

The program pushes the values from 0 to n-1 to the stack replaces the top 0 and 1 with 1 and 0. Then it multiplies the top of the stack by n and adds the value below it until there is only one value remaining on the stack.

Essentially it finds the digits for the smallest number in base n that contains n different digits (for n > 1 it's always of the form 1023...(n-1)). It then calculates the number given the digits and the base.

Annotated Code

(({})<>)       # Pushes a copy of n to the right stack and switches to right stack
{(({}[()]))}{} # While the top of the stack != 0 copy the top of the stack-1
               #   and push it
(<{}{}>)       # Discard the top two values (0 and 1 for n > 1) and push 0
((()))         # Push 1 twice (second time so that the loop is works properly)
{{}            # Loop while stack height > 1
  (            #   Push...
    {<({}[()])><>({})<>}{} # The top value of the stack * n
    {}         #     Plus the value below the top of the stack
  )            #   End push
([][()])}{}    # End loop


答:
ShapeScript, 25 bytes

```<code>_0?1'1+@2?*1?+@'2?2-*!#@#
</code>```

Input is in unary, output is in decimal. Try it online!

Title: Digital Diversity

Body:
A positive integer may be represented in an integer base \$1 \le b < \infty\$.

When converted to that base it has some number of distinct digits.

Any positive integer in base \$1\$ has \$1\$ distinct digit.

Most positive integers in base \$2\$ have \$2\$ distinct digits, the exceptions being those of the form \$2^n - 1\$, which only have \$1\$.

So the first positive integer that may be represented in an integer base with \$1\$ unique digit is \$1\$ and the first that may be represented with \$2\$ distinct digits is \$2\$.

We can say that \$1\$ is the first integer with digital diversity \$1\$ and \$2\$ is the first integer with digital diversity \$2\$.

Challenge:

Given a positive integer \$n\$ return the first positive integer (in base ten*) that has a digital diversity of \$n\$.

* if your language only supports a specific base (e.g. unary or binary) then you may output in that base.

Your algorithm must work in theory for any positive integer input: it may fail because the precision of your language's integer is too small for the output; but may not fail because base conversion is only defined up to some limit.

Test cases

```<code>input  output
   1     1
   2     2
   3     11
   4     75
   5     694
   6     8345
   7     123717
  17     49030176097150555672
  20     5271200265927977839335179
  35     31553934355853606735562426636407089783813301667210139
  63     3625251781415299613726919161860178255907794200133329465833974783321623703779312895623049180230543882191649073441
 257     87678437238928144977867204156371666030574491195943247606217411725999221158137320290311206746021269051905957869964398955543865645836750532964676103309118517901711628268617642190891105089936701834562621017362909185346834491214407969530898724148629372941508591337423558645926764610261822387781382563338079572769909101879401794746607730261119588219922573912353523976018472514396317057486257150092160745928604277707892487794747938484196105308022626085969393774316283689089561353458798878282422725100360693093282006215082783023264045094700028196975508236300153490495688610733745982183150355962887110565055971546946484175232
</code>```

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

OEIS: A049363 - also smallest pandigital number in base n.

Body:
ShapeScript, 25 bytes

_0?1'1+@2?*1?+@'2?2-*!#@#

Input is in unary, output is in decimal. Try it online!


答:
R, 33+43+59 = 135 bytes

Arbitrary hard-coded alphabet (change the string to change the alphabet):

```<code>cat(sample(strsplit("ABC123!@TPOI098","")[[1]],6,1),sep="")
</code>```

Alphabet of [0-9A-E]:

```<code>cat(sample(c(0:9,LETTERS[1:6]),6,1),sep="")
</code>```

User-defined alphabet from stdin:

```<code>cat(sample(scan(,''),6,1),sep="")
</code>```

All cases print the output word to stdout.

Body:
R, 33+43+59 = 135 bytes

Arbitrary hard-coded alphabet (change the string to change the alphabet):

cat(sample(strsplit("ABC123!@TPOI098","")[[1]],6,1),sep="")

Alphabet of [0-9A-E]:

cat(sample(c(0:9,LETTERS[1:6]),6,1),sep="")

User-defined alphabet from stdin:

cat(sample(scan(,''),6,1),sep="")

All cases print the output word to stdout.


答:
q, 42 bytes

A

19 bytes

```<code>6?"ABC123!@TPOI098"
</code>```

B

14 bytes

```<code>6?15#.Q.n,.Q.A
</code>```

C

9 bytes

```<code>6?15#.Q.a
</code>```

(uses the first fifteen letters of the alphabet)

Body:
In one of our projects at work, we recently discovered a particularly large method for generating a 6 character string from a 15 character alphabet. A few of us claimed "I bet we can get that in one line" which started a little internal game of code golf.

Your task is to beat us, which I have no doubt won't take long!

The original algorithm used the alphabet 0-9A-E, but we've experimented with other alphabets. There are therefore three subtasks.

Generate a 6 character string randomly selecting from an arbitrary hardcoded 15 character alphabet like ABC123!@TPOI098. (This is just an example, and should be customizable without affecting the byte count.)

Generate a 6 character string randomly selecting from a 15 character alphabet 0123456789ABCDE.

Generate a 6 character string randomly selecting from a 15 character alphabet of your choice (printable characters only please).

Each character should have equal chance of selection and repetition should be possible.

The best we have been able to manage for each of the subtasks is:

"ABC123!@TPOI098" - 24 bytes

"0123456789ABCDE" - 21 bytes

Custom alphabet   -  13 bytes

Your score is the sum of the bytes in each subtask's solution. i.e. our score is currently 58.

We've attempted using among others, CJam and Ruby. The original was in C#. Use any language you like, but we'll be interested to see solutions in these languages particularly

Body:
q, 42 bytes

A

19 bytes

6?"ABC123!@TPOI098"

B

14 bytes

6?15#.Q.n,.Q.A

C

9 bytes

6?15#.Q.a

(uses the first fifteen letters of the alphabet)


答:
05AB1E, 43 bytes

Arbitratry alphabet (ABC123!@TPOI098), 23 bytes Try it online

```<code>"ABC123!@TPOI098"6F.r¬?
</code>```

Almost hexadecimal alphabet (0123456789ABCDE), 10 bytes Try it online

```<code>14Ýh6F.r¬?
</code>```

Custom alphabet (abcdefghijklmno), 10 bytes Try it online

```<code>A15£6F.r¬?
</code>```

Body:
05AB1E, 43 bytes

Arbitratry alphabet (ABC123!@TPOI098), 23 bytes Try it online

"ABC123!@TPOI098"6F.r¬?

Almost hexadecimal alphabet (0123456789ABCDE), 10 bytes Try it online

14Ýh6F.r¬?

Custom alphabet (abcdefghijklmno), 10 bytes Try it online

A15£6F.r¬?


答:
Python 2, 70 + 70 + 64 = 204 bytes

from random import*
s=""
exec"s+=choice('ABC123!@TPOI098');"*6
print s

from random import*
s=""
exec"s+=choice('0123456789ABCDE');"*6
print s

from random import*
s=""
exec"s+=chr(randint(65,80));"*6
print s
```

Unfortunately, the second example is easier with the first method than something like choice([randint(48,57)),choice(65,69)])

Body:
Python 2, 70 + 70 + 64 = 204 bytes

from random import*
s=""
exec"s+=choice('ABC123!@TPOI098');"*6
print s

from random import*
s=""
exec"s+=choice('0123456789ABCDE');"*6
print s

from random import*
s=""
exec"s+=chr(randint(65,80));"*6
print s

Unfortunately, the second example is easier with the first method than something like choice([randint(48,57)),choice(65,69)])


Body:
Ruby 47 + 37 + 31 = 115

Hardcoded: "ABC123!@TPOI098" (47)

(1..6).map{"5CABC123!@TPOI098".chars.sample}*''

Fixed: "0123456789ABCDE" (37)

(1..6).map{[*0..9,*?A..?E].sample}*''

Custom: "ABCDEFGHIJKLMNO" (31)

(1..6).map{[*?A..?O].sample}*''


答:
Scala, 154 bytes

Hardcoded alphabet (54 bytes):

```<code>Seq.fill(6)("ABC123!@TPOI098"((math.random*14).toInt))
</code>```

Hex alphabet (54 bytes):

```<code>Seq.fill(6)("0123456789ABCDE"((math.random*14).toInt))
</code>```

Custom alphabet ABCDEFGHIJKLMNO (47 bytes):

```<code>Seq.fill(6)(('A'to'O')((math.random*14).toInt))
</code>```

Explanation:

```<code>Seq.fill(6)(               //build a sequence of 6 elements, where each element is...
  "ABC123!@TPOI098"(         //from the string
    (math.random*14).toInt   //take a random char
  )
)
</code>```

'A'to'O' creates a sequence of 15 chars, A to O

Body:
Scala, 154 bytes

Hardcoded alphabet (54 bytes):

Seq.fill(6)("ABC123!@TPOI098"((math.random*14).toInt))

Hex alphabet (54 bytes):

Seq.fill(6)("0123456789ABCDE"((math.random*14).toInt))

Custom alphabet ABCDEFGHIJKLMNO (47 bytes):

Seq.fill(6)(('A'to'O')((math.random*14).toInt))

Explanation:

Seq.fill(6)(               //build a sequence of 6 elements, where each element is...
  "ABC123!@TPOI098"(         //from the string
    (math.random*14).toInt   //take a random char
  )
)

'A'to'O' creates a sequence of 15 chars, A to O


问:
Draw an asterisk triangle
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).

Input:

A positive integer n >= 1.

Output:

n lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.

Test case (n=5):

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

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

答:
Braingasm, 27 bytes

Braingasm is a brainfuck variant with just a few more instructions and options. And this task would've been so much easier if I had bothered implementing that as many times as the value in the current cell thing yet..

```<code>;[->+[->+42.<]10.>[-<+>]<<]
</code>```

Here's how it works:

```<code>;                           Read an integer from stdin and write it to cell#1
 [                        ] While the value of cell#1 is not zero,
  ->+                    <    substract one from cell#1 and add one to cell#2.
     [->+   <]                Each time, do the same between cell#2 and cell#3,
         42.                    but also print an asterix on the way.
              10.             Then print a newline.
                 >[-<+>]<     Move the value from cell#3 back to cell#2
</code>```

Title: Draw an asterisk triangle

Body:
Braingasm, 27 bytes

Braingasm is a brainfuck variant with just a few more instructions and options. And this task would've been so much easier if I had bothered implementing that as many times as the value in the current cell thing yet..

;[->+[->+42.<]10.>[-<+>]<<]

Here's how it works:

;                           Read an integer from stdin and write it to cell#1
 [                        ] While the value of cell#1 is not zero,
  ->+                    <    substract one from cell#1 and add one to cell#2.
     [->+   <]                Each time, do the same between cell#2 and cell#3,
         42.                    but also print an asterix on the way.
              10.             Then print a newline.
                 >[-<+>]<     Move the value from cell#3 back to cell#2


答:
171 bytes bash + 3 keys lynx

```<code>lynx -cfg=<(echo PRINTER:Answercount:grep [0-9]*.Answers %s|less:FALSE:999') http://codegolf.stackexchange.com/questions/96298/how-many-answers-does-this-question-have
</code>```

Body:
Write a program or a function that outputs the integer number of answers this question has. Your solution should still work as more answers are added.

Languages that run in a browser may be run from the js console while on this page. Otherwise, you'd probably have to download this page. Multi-language solutions, e.g. wgeting the page and parsing it using grep is ok. Just sum up the command line and all source used.

This is code golf; shortest answer in bytes wins.

EDIT:

Let's allow at most one occourance of the url of this page to not count, either as input or in the source. No url shorteners, no data stored as get parameters etc. Quotes around url, if needed, still count. Taking the url as input is also fine. If you want to remove some part of the url, e.g. /how-many-answers..., you can, but it probably doesn't help you.

Body:
171 bytes bash + 3 keys lynx

lynx -cfg=<(echo PRINTER:Answercount:grep [0-9]*.Answers %s|less:FALSE:999') http://codegolf.stackexchange.com/questions/96298/how-many-answers-does-this-question-have


问:
Export The $PATH Variable, Line-By-Line
Inspired by this question on AskUbuntu.

Your job is extremely simple. Take the PATH environment variable (echo $PATH) and export it such that each entry (separated by the : character) is on its own line.

For example, if the PATH is /bin:/usr/bin:/usr/local/bin, your program should output:

```<code>/bin
/usr/bin
/usr/local/bin
</code>```

Your program may not return a leading newline, but it may return a single trailing newline. You do not need to check if the PATH is right, or that the directory exists. Your program should take no input, meaning that your program is responsible for getting the PATH itself. You may safely assume that objects in the PATH do not contain : or newlines. However, spaces are fair game.

Reference implementations are present in the answers to the question above.

Rules

This is (obviously) code-golf, so the shortest answer will win the prized green checkmark.

The accepted answer will be tested to make sure it's actually legit.

Both Windows and *nix entries are accepted.

However, if you don't explicitly specify Windows, I will try running it in Linux and fail. (If it's obvious (hi, Batch!), you don't need to specify explicitly.)

Only have one solution per answer. If you have both a Windows and *nix version, I will count the shorter one.

If two answers have the same length, I will give priority to the one with the higher vote total. If they have the same vote total, I will count the older one. If the time posted is the same, I will choose the one that executes faster. If they execute in the same amount of time, I don't know.

Leaderboard

var QUESTION_ID=96334,OVERRIDE_USER=15422;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="
"+e.body.replace(OVERRIDE_REG,"")+"
")});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;/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;```
<pre class="snippet-code-css lang-css prettyprint-override"><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}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Bash/Coreutils, <s>17</s> 16 bytes

```<code>tr : '
'<<<$PATH
</code>```

Title: Export The $PATH Variable, Line-By-Line

Body:
Bash/Coreutils, <s>17</s> 16 bytes

tr : '
'<<<$PATH


答:
Batch, 41 bytes

```<code>@for %%a in ("%PATH:;=";"%")do @echo %%~a
</code>```

PATH is semicolon-delimited on Windows of course. Conveniently, for splits on semicolons by default, but inconveniently, also on spaces, so I have to use string replace trickery to quote each path element before splitting. It then remains to remove the quotes afterwards.

Title: Export The $PATH Variable, Line-By-Line

Body:
Inspired by this question on AskUbuntu.

Your job is extremely simple. Take the PATH environment variable (echo $PATH) and export it such that each entry (separated by the : character) is on its own line.

For example, if the PATH is /bin:/usr/bin:/usr/local/bin, your program should output:

```<code>/bin
/usr/bin
/usr/local/bin
</code>```

Your program may not return a leading newline, but it may return a single trailing newline. You do not need to check if the PATH is right, or that the directory exists. Your program should take no input, meaning that your program is responsible for getting the PATH itself. You may safely assume that objects in the PATH do not contain : or newlines. However, spaces are fair game.

Reference implementations are present in the answers to the question above.

Rules

This is (obviously) code-golf, so the shortest answer will win the prized green checkmark.

The accepted answer will be tested to make sure it's actually legit.

Both Windows and *nix entries are accepted.

However, if you don't explicitly specify Windows, I will try running it in Linux and fail. (If it's obvious (hi, Batch!), you don't need to specify explicitly.)

Only have one solution per answer. If you have both a Windows and *nix version, I will count the shorter one.

If two answers have the same length, I will give priority to the one with the higher vote total. If they have the same vote total, I will count the older one. If the time posted is the same, I will choose the one that executes faster. If they execute in the same amount of time, I don't know.

Leaderboard

var QUESTION_ID=96334,OVERRIDE_USER=15422;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="
"+e.body.replace(OVERRIDE_REG,"")+"
")});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;/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;```
<pre class="snippet-code-css lang-css prettyprint-override"><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}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

Body:
Batch, 41 bytes

@for %%a in ("%PATH:;=";"%")do @echo %%~a

PATH is semicolon-delimited on Windows of course. Conveniently, for splits on semicolons by default, but inconveniently, also on spaces, so I have to use string replace trickery to quote each path element before splitting. It then remains to remove the quotes afterwards.


答:
PHP, <s>36</s> <s>35</s> <s>33</s> 32 bytes

Saved 1 byte, thanks to Blackhole

Saved 2 bytes, thanks to user59178

saved 1 byte, thanks to Martijn

*nix version

```<code><?=strtr(getenv(PATH),":","
")?>
</code>```

Windows version

```<code><?=strtr(getenv(PATH),";","
")?>
</code>```

Title: Export The $PATH Variable, Line-By-Line

Body:
PHP, <s>36</s> <s>35</s> <s>33</s> 32 bytes

Saved 1 byte, thanks to Blackhole

Saved 2 bytes, thanks to user59178

saved 1 byte, thanks to Martijn

*nix version

<?=strtr(getenv(PATH),":","
")?>

Windows version

<?=strtr(getenv(PATH),";","
")?>


答:
Python 2, 49 bytes

Saving 2 bytes thanks to @xnor and 1 byte by replacing environ with getenv thanks to @Serg and @Oliver

import os
print os.getenv('PATH').replace(*':\n')
```

For Python 3, just add ( and ) around the print argument and add 1 to the byte count.

Title: Export The $PATH Variable, Line-By-Line

Body:
Python 2, 49 bytes

Saving 2 bytes thanks to @xnor and 1 byte by replacing environ with getenv thanks to @Serg and @Oliver

import os
print os.getenv('PATH').replace(*':\n')

For Python 3, just add ( and ) around the print argument and add 1 to the byte count.


答:
Ruby, 25 bytes

```<code>puts ENV["PATH"].split":"
</code>```

Title: Export The $PATH Variable, Line-By-Line

Body:
Ruby, 25 bytes

puts ENV["PATH"].split":"


问:
Find the program that prints this integer sequence (Cops' thread)
This is the cops' thread. The robbers' thread goes here.

The last cops-and-robbers thread was already 4 months ago.

The cop's task

The cop's task is to write a program/function that takes a positive (or non-negative) integer and outputs/returns another integer.

The cop must state it if the program is intolerant towards zero.

The cop will provide at least 2 sample inputs/outputs.

For example, if I have decided to write the Fibonacci sequence, I would write this in my answer:

```
a(0) returns 0
a(3) returns 2
```

The number of examples is up to the cop's discretion.

However, the sequence must actually exist in the On-Line Encyclopedia of Integer Sequences®, so no pseudo-random number generator for you. :(

The cop can hide as many characters as is so wished.

For example, if my program is:

```<code>function a(n)
    if n>2 then
        return n
    else
        return a(n-1) + a(n-2)
    end
end
</code>```

Then I would hide these characters as I want:

```<code>function a(n)
    if ### then
        ########
    else
        ######################
    end
end
</code>```

The robber's task

is obviously to find the original source code.

However, any proposed source code that produces the same set of output also counts as valid, as long as it is also found in OEIS.

Tips for the cops

<s>The search function in the OEIS only works for consecutive terms, so if you want to hide your sequence, then just leave a hole anywhere.</s>

Apparently there is no way to hide the sequence. Put this in mind when you choose the sequence.

Your score is the number of bytes in your code.

The winner will be the submission with the lowest score that hasn't been cracked in 7 days.

Only submissions that are posted in 2016 April are eligible for the win. Submissions that are posted later than this are welcome, but cannot win.

In order to claim the win you need to reveal the full code and the OEIS sequence (after 7 days).

Your post should be formatted like this (NN is the number of characters):

Lua, 98 bytes

Output:

```<code>a(0) returns 0
a(3) returns 2
</code>```

Code (# marks unrevealed characters):

```<code>function a(n)
    if ### then
        ########
    else
        ######################
    end
end
</code>```

If the code is cracked, insert [Cracked](link to cracker) in the header.
If the submission is safe, insert "Safe" in the header and reveal the full code in your answer. Only answers that have revealed the full code will be eligible for the win.

答:
Jelly, 5 bytes (safe)

Code

```<code>??Œ??
</code>```

Each ? denotes a missing character.

Output

```<code>n a(n)

0    1
1    3
2    9
3   21
4   45
5   93
6  189
7  381
8  765
9 1533
</code>```

This is OEIS entry A068156.

Solution

```<code>Ḷ¡ŒṘL
</code>```

Try it online!

How it works

As noted on the OEIS page, this sequence obeys the recursive formula a(n + 1) = 2a(n) + 3, with base cases a(0) = 1, a(1) = 3.

The code begins with the integer n and applies Ḷ (unlength) n times, which convert all integers k in the previous array into the range [0, ... k - 1]. The output after all n steps is similar to the set-theoretic definition of n.

For n = 0, 1, 2, 3, 4, the outputs of Ḷ¡ŒṘ (unlength n times, then generate Python's string representation) is as follows.

```<code>0: 0
1: [0]
2: [[], [0]]
3: [[], [[]], [[], [0]]]
4: [[], [[]], [[], [[]]], [[], [[]], [[], [0]]]]
</code>```

If we examine the outputs for 3 and 4 closely, we can note the following pattern.

```<code>[[], [[]], [[], [0]]]XX[[], [[]], [[], [0]]]X
[[], [[]], [[], [[]]], [[], [[]], [[], [0]]]]
</code>```

The output for 4 consists of two copies of the output for 3 (the actual characters differ, but we're only interested in the length), and three additional characters (X marks the spots). Thus, if we take the length with L, our program follows the desired recursive formula.

Body:
Jelly, 5 bytes (safe)

Code

??Œ??

Each ? denotes a missing character.

Output

n a(n)

0    1
1    3
2    9
3   21
4   45
5   93
6  189
7  381
8  765
9 1533

This is OEIS entry A068156.

Solution

Ḷ¡ŒṘL

Try it online!

How it works

As noted on the OEIS page, this sequence obeys the recursive formula a(n + 1) = 2a(n) + 3, with base cases a(0) = 1, a(1) = 3.

The code begins with the integer n and applies Ḷ (unlength) n times, which convert all integers k in the previous array into the range [0, ... k - 1]. The output after all n steps is similar to the set-theoretic definition of n.

For n = 0, 1, 2, 3, 4, the outputs of Ḷ¡ŒṘ (unlength n times, then generate Python's string representation) is as follows.

0: 0
1: [0]
2: [[], [0]]
3: [[], [[]], [[], [0]]]
4: [[], [[]], [[], [[]]], [[], [[]], [[], [0]]]]

If we examine the outputs for 3 and 4 closely, we can note the following pattern.

[[], [[]], [[], [0]]]XX[[], [[]], [[], [0]]]X
[[], [[]], [[], [[]]], [[], [[]], [[], [0]]]]

The output for 4 consists of two copies of the output for 3 (the actual characters differ, but we're only interested in the length), and three additional characters (X marks the spots). Thus, if we take the length with L, our program follows the desired recursive formula.


答:
C#, 64 bytes

```<code>x=>Environment.GetEnvironmentVariable("PATH").Replace(";","\n");
</code>```

Anonymous function which returns the path variable, each directory on a separate line. Note that x is just a dummy object to save 1 byte instead of using ().

Full program:

```<code>using System;

namespace ExportPathVariable
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<object,string>f= x=>Environment.GetEnvironmentVariable("PATH").Replace(";","\n");

            Console.WriteLine(f(0));
        }
    }
}
</code>```

Also works on UNIX systems if you replace ; with :, presuming Mono libraries are available. Try it online on ideone, .NET Fiddle returns a security exception.

Alternatively, a full C# program, which is rather verbose:

C#, 118 bytes

```<code>using System;class P{static void Main(){Console.Write(Environment.GetEnvironmentVariable("PATH").Replace(";","\n"));}}
</code>```

Title: Export The $PATH Variable, Line-By-Line

Body:
C#, 64 bytes

x=>Environment.GetEnvironmentVariable("PATH").Replace(";","\n");

Anonymous function which returns the path variable, each directory on a separate line. Note that x is just a dummy object to save 1 byte instead of using ().

Full program:

using System;

namespace ExportPathVariable
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<object,string>f= x=>Environment.GetEnvironmentVariable("PATH").Replace(";","\n");

            Console.WriteLine(f(0));
        }
    }
}

Also works on UNIX systems if you replace ; with :, presuming Mono libraries are available. Try it online on ideone, .NET Fiddle returns a security exception.

Alternatively, a full C# program, which is rather verbose:

C#, 118 bytes

using System;class P{static void Main(){Console.Write(Environment.GetEnvironmentVariable("PATH").Replace(";","\n"));}}


问:
The 3x3 Hexa Prime Square Puzzle

The 3x3 Hexa Prime Square Puzzle

Introduction

We consider 3x3 squares of hexadecimal digits (from 0 to F) such as:

```<code>2 E 3    1 F 3
8 1 5    7 2 7
D D 5    B B 9
</code>```

We define a 3x3 Hexa Prime Square (HPS3) as such a square for which all hexadecimal numbers read from left to right and from top to bottom are odd primes (i.e. primes greater than 2).

This is true for the left square and false for the right square:

```<code>2 E 3 --> 0x2E3 = 739       1 F 3 --> 0x1F3 = 499
8 1 5 --> 0x815 = 2069      7 2 7 --> 0x727 = 1831
D D 5 --> 0xDD5 = 3541      B B 9 --> 0xBB9 = 3001
| | |                       | | |
| | +---> 0x355 = 853       | | +---> 0x379 = 889 = 7 x 127
| +-----> 0xE1D = 3613      | +-----> 0xF2B = 3883 = 11 x 353
+-------> 0x28D = 653       +-------> 0x17B = 379
</code>```

Goal

Given a list of 9 hexadecimal digits, your goal is to find an arrangement that forms a HPS3.

Example:

```<code>Input: 123558DDE
Possible output: 2E3815DD5 (a flattened representation of the above left example)
</code>```

Input / Output

Input and output formats are flexible. The only requirement is that output digits are ordered from left to right and from top to bottom. Below are some possible options:

```<code>"2E3815DD5"
[ 0x2, 0xE, 0x3, 0x8, 0x1, 0x5, 0xD, 0xD, 0x5 ]
[ "2", "E", "3", "8", "1", "5", "D", "D", "5" ]
[
  [ 0x2, 0xE, 0x3 ],
  [ 0x8, 0x1, 0x5 ],
  [ 0xD, 0xD, 0x5 ]
]
[ "2E3", "815", "DD5" ]
etc.
</code>```

Using the same format for both input and output is not required.

Rules

This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

Your algorithm must be deterministic

You can't just bogosort the array until it's valid, even in a deterministic way (by using a constant random seed).

You may list all possible solutions for a given input, but this is neither required nor subject to a bonus.

You're not required to support inputs that do not admit any solution. (It's perfectly fine if your code is looping forever or crashing in that case.)

Test cases

```<code>Input       Possible output
---------------------------
123558dde   2e3815dd5
1155578ab   a7b851551
03bddffff   ffd0dfb3f
35899beff   8f99e3bf5
15899bbdf   581bb9fd9
14667799f   6f1469779
13378bcdd   78d1cd33b
24577bbdd   7274bd5db
1118bbddd   11b18dbdd
223556cdd   623c25dd5
12557899a   8a5295971
113579bbd   5b3db7191
</code>```

答:
Jelly,<s> 34 </s>30 bytes

```<code>i@€ØH’
s3µ;ZÇ€ḅ⁴µ>2aÆPẠ
Œ!ÇÐfḢ
</code>```

(I should be able to use an nfind to just fetch the first match, 1# in place of ÐfḢ, for less bytes and more speed, but I'm seeing errors when I try. EDIT: wrote some changes to possibly implement this in Jelly.)

Brute force search of all permutations, filtered for the criteria, returning first match.

Way too slow for TtyItOnline. Local output examples:

```<code>C:\Jelly\jelly-master>python jelly -fu test.txt "123558DDE"
28DE1D355
C:\Jelly\jelly-master>python jelly -fu test.txt "1155578AB"
11B8A5557
</code>```

How?

```<code>i@€ØH’ - Link 1, convert from hexadecimal string to integer list: string
   ØH  - yield hexadecimal characters, "0123456789ABCDEF"
i@€    - index of €ach character of s in hex chars
     ’ - decrement (vectorises) (from 1 based jelly index to place value)

s3µ;ZÇ€ḅ⁴µ>2aÆPẠ - Link 2, check if a flattened square is "all prime": string
s3               - split into threes (rows)
  µ              - monadic chain separation
   ;             - concatenate with
    Z            - transpose (columns)
     Ç€          - call last link (1) as a monad for €ach string in the list
                       -> list of integer lists
       ḅ⁴        - convert from base 16 (vectorises) -> list of decimals
         µ       - monadic chain separation
          >2     - greater than 2
            a    - and
             ÆP  - isPrime? -> list of 1s and 0s
               Ạ - all truthy?

Œ!ÇÐfḢ  - Main link: string
Œ!      - all permutations of the string
   Ðf   - filter keeping entries that evaluate to truthily for
  Ç     - last link (3) as a monad
     Ḣ  - head - return first entry
</code>```

Title: The 3x3 Hexa Prime Square Puzzle

Body:
Jelly,<s> 34 </s>30 bytes

i@€ØH’
s3µ;ZÇ€ḅ⁴µ>2aÆPẠ
Œ!ÇÐfḢ

(I should be able to use an nfind to just fetch the first match, 1# in place of ÐfḢ, for less bytes and more speed, but I'm seeing errors when I try. EDIT: wrote some changes to possibly implement this in Jelly.)

Brute force search of all permutations, filtered for the criteria, returning first match.

Way too slow for TtyItOnline. Local output examples:

C:\Jelly\jelly-master>python jelly -fu test.txt "123558DDE"
28DE1D355
C:\Jelly\jelly-master>python jelly -fu test.txt "1155578AB"
11B8A5557

How?

i@€ØH’ - Link 1, convert from hexadecimal string to integer list: string
   ØH  - yield hexadecimal characters, "0123456789ABCDEF"
i@€    - index of €ach character of s in hex chars
     ’ - decrement (vectorises) (from 1 based jelly index to place value)

s3µ;ZÇ€ḅ⁴µ>2aÆPẠ - Link 2, check if a flattened square is "all prime": string
s3               - split into threes (rows)
  µ              - monadic chain separation
   ;             - concatenate with
    Z            - transpose (columns)
     Ç€          - call last link (1) as a monad for €ach string in the list
                       -> list of integer lists
       ḅ⁴        - convert from base 16 (vectorises) -> list of decimals
         µ       - monadic chain separation
          >2     - greater than 2
            a    - and
             ÆP  - isPrime? -> list of 1s and 0s
               Ạ - all truthy?

Œ!ÇÐfḢ  - Main link: string
Œ!      - all permutations of the string
   Ðf   - filter keeping entries that evaluate to truthily for
  Ç     - last link (3) as a monad
     Ḣ  - head - return first entry


答:
Perl, 22 bytes

```<code>say$ENV{PATH}=~y/:/
/r
</code>```

Needs -E or -M5.010 to run :

```<code>perl -E 'say$ENV{PATH}=~y/:/
/r'
</code>```

Title: Export The $PATH Variable, Line-By-Line

Body:
Perl, 22 bytes

say$ENV{PATH}=~y/:/
/r

Needs -E or -M5.010 to run :

perl -E 'say$ENV{PATH}=~y/:/
/r'


答:
Pip, 42 bytes

Hardcoded alphabet, 22 bytes:

```<code>L6ORC"ABC123!@TPOI098"
</code>```

Hex digits, 11 bytes:

```<code>L6ORR15TB16
</code>```

First 15 lowercase letters, 9 bytes:

```<code>L6Oz@RR15
</code>```

Explanation

All three programs start with L6O: loop 6 times and output the given expression.

RC"...": Random Choice of a character from the hard-coded string

RR15TB16: RandRange(15), converted To Base 16

z@RR15: lowercase alphabet z, indexed with RandRange(15)

Try it online!

Body:
In one of our projects at work, we recently discovered a particularly large method for generating a 6 character string from a 15 character alphabet. A few of us claimed "I bet we can get that in one line" which started a little internal game of code golf.

Your task is to beat us, which I have no doubt won't take long!

The original algorithm used the alphabet 0-9A-E, but we've experimented with other alphabets. There are therefore three subtasks.

Generate a 6 character string randomly selecting from an arbitrary hardcoded 15 character alphabet like ABC123!@TPOI098. (This is just an example, and should be customizable without affecting the byte count.)

Generate a 6 character string randomly selecting from a 15 character alphabet 0123456789ABCDE.

Generate a 6 character string randomly selecting from a 15 character alphabet of your choice (printable characters only please).

Each character should have equal chance of selection and repetition should be possible.

The best we have been able to manage for each of the subtasks is:

"ABC123!@TPOI098" - 24 bytes

"0123456789ABCDE" - 21 bytes

Custom alphabet   -  13 bytes

Your score is the sum of the bytes in each subtask's solution. i.e. our score is currently 58.

We've attempted using among others, CJam and Ruby. The original was in C#. Use any language you like, but we'll be interested to see solutions in these languages particularly

Body:
Pip, 42 bytes

Hardcoded alphabet, 22 bytes:

L6ORC"ABC123!@TPOI098"

Hex digits, 11 bytes:

L6ORR15TB16

First 15 lowercase letters, 9 bytes:

L6Oz@RR15

Explanation

All three programs start with L6O: loop 6 times and output the given expression.

RC"...": Random Choice of a character from the hard-coded string

RR15TB16: RandRange(15), converted To Base 16

z@RR15: lowercase alphabet z, indexed with RandRange(15)

Try it online!


答:
Python 2, <s>212</s> <s>206</s> <s>197</s> 194 bytes

Requires input enclosed in quotes, like "123558dde"

from itertools import*
k,p,P=3,4,[]
while k<5e3:P+=[k][:p%k];p*=k;k+=1
print[s for s in map(''.join,permutations(input()))if all(int(s[3*i:][:3],16)in P and int(s[i::3],16)in P for i in(0,1,2))]
```

Saving 9 and 3 bytes thanks to Jonathan Allan

Found new prime filter from xnor (modified the square away, since we dont want 2 as prime here), old prime filter is from Bob

Title: The 3x3 Hexa Prime Square Puzzle

Body:
The 3x3 Hexa Prime Square Puzzle

Introduction

We consider 3x3 squares of hexadecimal digits (from 0 to F) such as:

```<code>2 E 3    1 F 3
8 1 5    7 2 7
D D 5    B B 9
</code>```

We define a 3x3 Hexa Prime Square (HPS3) as such a square for which all hexadecimal numbers read from left to right and from top to bottom are odd primes (i.e. primes greater than 2).

This is true for the left square and false for the right square:

```<code>2 E 3 --> 0x2E3 = 739       1 F 3 --> 0x1F3 = 499
8 1 5 --> 0x815 = 2069      7 2 7 --> 0x727 = 1831
D D 5 --> 0xDD5 = 3541      B B 9 --> 0xBB9 = 3001
| | |                       | | |
| | +---> 0x355 = 853       | | +---> 0x379 = 889 = 7 x 127
| +-----> 0xE1D = 3613      | +-----> 0xF2B = 3883 = 11 x 353
+-------> 0x28D = 653       +-------> 0x17B = 379
</code>```

Goal

Given a list of 9 hexadecimal digits, your goal is to find an arrangement that forms a HPS3.

Example:

```<code>Input: 123558DDE
Possible output: 2E3815DD5 (a flattened representation of the above left example)
</code>```

Input / Output

Input and output formats are flexible. The only requirement is that output digits are ordered from left to right and from top to bottom. Below are some possible options:

```<code>"2E3815DD5"
[ 0x2, 0xE, 0x3, 0x8, 0x1, 0x5, 0xD, 0xD, 0x5 ]
[ "2", "E", "3", "8", "1", "5", "D", "D", "5" ]
[
  [ 0x2, 0xE, 0x3 ],
  [ 0x8, 0x1, 0x5 ],
  [ 0xD, 0xD, 0x5 ]
]
[ "2E3", "815", "DD5" ]
etc.
</code>```

Using the same format for both input and output is not required.

Rules

This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

Your algorithm must be deterministic

You can't just bogosort the array until it's valid, even in a deterministic way (by using a constant random seed).

You may list all possible solutions for a given input, but this is neither required nor subject to a bonus.

You're not required to support inputs that do not admit any solution. (It's perfectly fine if your code is looping forever or crashing in that case.)

Test cases

```<code>Input       Possible output
---------------------------
123558dde   2e3815dd5
1155578ab   a7b851551
03bddffff   ffd0dfb3f
35899beff   8f99e3bf5
15899bbdf   581bb9fd9
14667799f   6f1469779
13378bcdd   78d1cd33b
24577bbdd   7274bd5db
1118bbddd   11b18dbdd
223556cdd   623c25dd5
12557899a   8a5295971
113579bbd   5b3db7191
</code>```

Body:
Python 2, <s>212</s> <s>206</s> <s>197</s> 194 bytes

Requires input enclosed in quotes, like "123558dde"

from itertools import*
k,p,P=3,4,[]
while k<5e3:P+=[k][:p%k];p*=k;k+=1
print[s for s in map(''.join,permutations(input()))if all(int(s[3*i:][:3],16)in P and int(s[i::3],16)in P for i in(0,1,2))]

Saving 9 and 3 bytes thanks to Jonathan Allan

Found new prime filter from xnor (modified the square away, since we dont want 2 as prime here), old prime filter is from Bob


答:
05AB1E, <s>23</s> 21 bytes

Uses CP-1252 encoding.

```<code>œJvy3ôD€SøJìHDps2›*P—
</code>```

Too slow for TIO.

Explanation

```<code>œJ                     # all permutations of input as strings
  v                    # for each permutation
                       # EXAMPLE: 2E3815DD5
   y3ô                 # split in pieces of 3
                       # EXAMPLE: ['2E3','815','DD5']
      D                # duplicate
                       # EXAMPLE: ['2E3','815','DD5'], ['2E3','815','DD5']
       €SøJ            # zip the copy to swap rows and columns
                       # EXAMPLE: ['2E3','815','DD5'], ['28D','E1D','355']
           ì           # attach them to the same list
                       # EXAMPLE: ['2E3','815','DD5','28D','E1D','355']
            H          # convert from base 16 to base 10
                       # EXAMPLE: [739, 2069, 3541, 653, 3613, 853]
             D         # duplicate
                       # EXAMPLE: [739, 2069, 3541, 653, 3613, 853],[739, 2069, 3541, 653, 3613, 853]
              p        # check first copy for primality
                       # EXAMPLE: [739, 2069, 3541, 653, 3613, 853],[1,1,1,1,1,1]
               s2›     # check that each in second copy is larger than 2
                       # EXAMPLE: [1,1,1,1,1,1],[1,1,1,1,1,1]
                  *    # pairwise multiplication
                       # EXAMPLE: [1,1,1,1,1,1]
                   P   # product (1 if all were primes larger than 2, else 0)
                       # EXAMPLE: 1
                    —  # if 1, print y
                       # EXAMPLE: 2E3815DD5
</code>```

Title: The 3x3 Hexa Prime Square Puzzle

Body:
05AB1E, <s>23</s> 21 bytes

Uses CP-1252 encoding.

œJvy3ôD€SøJìHDps2›*P—

Too slow for TIO.

Explanation

œJ                     # all permutations of input as strings
  v                    # for each permutation
                       # EXAMPLE: 2E3815DD5
   y3ô                 # split in pieces of 3
                       # EXAMPLE: ['2E3','815','DD5']
      D                # duplicate
                       # EXAMPLE: ['2E3','815','DD5'], ['2E3','815','DD5']
       €SøJ            # zip the copy to swap rows and columns
                       # EXAMPLE: ['2E3','815','DD5'], ['28D','E1D','355']
           ì           # attach them to the same list
                       # EXAMPLE: ['2E3','815','DD5','28D','E1D','355']
            H          # convert from base 16 to base 10
                       # EXAMPLE: [739, 2069, 3541, 653, 3613, 853]
             D         # duplicate
                       # EXAMPLE: [739, 2069, 3541, 653, 3613, 853],[739, 2069, 3541, 653, 3613, 853]
              p        # check first copy for primality
                       # EXAMPLE: [739, 2069, 3541, 653, 3613, 853],[1,1,1,1,1,1]
               s2›     # check that each in second copy is larger than 2
                       # EXAMPLE: [1,1,1,1,1,1],[1,1,1,1,1,1]
                  *    # pairwise multiplication
                       # EXAMPLE: [1,1,1,1,1,1]
                   P   # product (1 if all were primes larger than 2, else 0)
                       # EXAMPLE: 1
                    —  # if 1, print y
                       # EXAMPLE: 2E3815DD5


答:
Bash+Python, 43 bytes

Let's use shell's variable expansion. It eliminates calling os.environ , thus less code and less imports. That gives us 46 bytes, and with xnor's trick and removing space before -c we've got 43 bytes.

```<code>python -c"print('$PATH'.replace(*':\n'))"
</code>```

Title: Export The $PATH Variable, Line-By-Line

Body:
Bash+Python, 43 bytes

Let's use shell's variable expansion. It eliminates calling os.environ , thus less code and less imports. That gives us 46 bytes, and with xnor's trick and removing space before -c we've got 43 bytes.

python -c"print('$PATH'.replace(*':\n'))"


问:
The plus-minus sequence

The plus-minus sequence

The plus-minus sequence is one that starts with two seeds, a(0) and b(0). Each iteration of this sequence is the addition and subtraction of the previous two members of the sequence. That is, a(N) = a(N-1) + b(N-1) and b(N) = a(N-1) - b(N-1).

Objective Produce the plus-minus sequence, in infinitude or the first K steps given K. You may do this using an infinite output program, a generator, or a function/program that gives the first K steps. The output order does not matter, so long as it is consistent. (I.e., b(K) a(K) or a(K) b(K), with some non-numeric, non-newline separator in between.) The output must start with the input.

Test cases

For inputs 10 2 (of a(0) b(0), this is a possible output for the first K approach (or a subsection of the infinite approach):

```<code>10     2
12     8
20     4
24     16
40     8
48     32
80     16
96     64
160    32
192    128
320    64
384    256
640    128
768    512
1280   256
1536   1024
2560   512
3072   2048
5120   1024
6144   4096
10240  2048
12288  8192
20480  4096
24576  16384
40960  8192
49152  32768
81920  16384
98304  65536
</code>```

For inputs 2 20 10 (a(0) b(0) k):

```<code>2     20
22   -18
4     40
44   -36
8     80
88   -72
16    160
176  -144
32    320
352  -288
</code>```

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

Catalog

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

```<code>## Language Name, N bytes
</code>```

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:

```<code>## Ruby, <s>104</s> <s>101</s> 96 bytes
</code>```

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:

```<code>## Perl, 43 + 2 (-p flag) = 45 bytes
</code>```

You can also make the language name a link which will then show up in the snippet:

```<code>## [><>](http://esolangs.org/wiki/Fish), 121 bytes
</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Julia, 25 bytes

a<|b=[a b]|>show<a+b<|a-b
```

<p>Maximum syntax abuse. Julia is <em>weird</em>. Try it online!</p>

<h3>Alternate version, 29 bytes</h3>

<p>Note that the output will eventually overflow unless you call <code><|</code> on a <em>BigInt</em>. Unfortunately, <code>show</code> will prefix each array with <code>BigInt</code> in this case. At the cost of four more bytes, we can generated whitespace-separated output for all numeric types.</p>

<pre class="lang-julia prettyprint-override"><code>a<|b="$a $b
"|>print<a+b<|a-b
</code>```

Try it online!

How it works

We define the binary operator <| for out purposes. It is undefined in recent versions of Julia, but still recognized as an operator by the parser. While \ (not explicitly defined for integers) is one byte shorter, its high precedence would require replacing a+b<|a-b with (a+b)\(a-b) (+3 bytes) or \(a+b,a-b) (+2 bytes).

When a<|b is executed, it starts by calling show to print [a b] to STDOUT. Then, a+b<|a-b recursively calls <| on the sum or the difference.

Since the recursion is (supposed to be) infinite, the comparison < is never performed; it sole purpose is chaining the two parts of the code. This saves two bytes over the more straightforward alternative ([a b]|>show;a+b<|a-b).

Title: The plus-minus sequence

Body:
Julia, 25 bytes

a<|b=[a b]|>show<a+b<|a-b

Maximum syntax abuse. Julia is weird. Try it online!

Alternate version, 29 bytes

Note that the output will eventually overflow unless you call <| on a BigInt. Unfortunately, show will prefix each array with BigInt in this case. At the cost of four more bytes, we can generated whitespace-separated output for all numeric types.

a<|b="$a $b
"|>print<a+b<|a-b

Try it online!

How it works

We define the binary operator <| for out purposes. It is undefined in recent versions of Julia, but still recognized as an operator by the parser. While \ (not explicitly defined for integers) is one byte shorter, its high precedence would require replacing a+b<|a-b with (a+b)\(a-b) (+3 bytes) or \(a+b,a-b) (+2 bytes).

When a<|b is executed, it starts by calling show to print [a b] to STDOUT. Then, a+b<|a-b recursively calls <| on the sum or the difference.

Since the recursion is (supposed to be) infinite, the comparison < is never performed; it sole purpose is chaining the two parts of the code. This saves two bytes over the more straightforward alternative ([a b]|>show;a+b<|a-b).


问:
Write a self-aware program
A standard (but disputed) test of self-awareness is the mirror test: An animal is considered self aware if it can recognize itself in the mirror.

Your task is to write a program that is self-aware according to this test. More exactly:

The program reads input in whatever form is suitable for your language.

If the input contains a mirror image of its own source code, it produces a truthy value, otherwise a falsey value.

A valid mirror image is the exact source of the program with the order of characters reversed, with no extra characters in between. As a special exception, for systems/languages that don't use single characters to terminate/separate lines (e.g. using a CR/LF sequence), the line termination sequence is allowed, but not required to be kept intact on reversal. However the program must be consistent in its treatment of lines.

For example, on a system using CR/LF as line separator, the sequence  AB<cr><lf>CD may be reversed either to DC<cr><lf>BA (keeping the line ending intact) or to DC<lf><cr>BA (completely reversing the character sequence).

The mirror image must be detected also if it is preceded or followed by junk, even if that junk contains reversed fragments of the code.

This is code golf; the shortest entry wins.

Note this is not the same as this question because of (a) the  reversal of the code, and (b) the fact that it has to tolerate junk before and after the reversed code, including junk that is very similar to the actual reversed code.

答:
Retina, 1 byte

```<code>x
</code>```

Try it online!

Prints a positive integer when the input contains at least one "reversed" copy of the source and 0 otherwise.

Any character that isn't a backtick or a regex metacharacter ([()?*+\\^$.) would work.

Title: Write a self-aware program

Body:
Retina, 1 byte

x

Try it online!

Prints a positive integer when the input contains at least one "reversed" copy of the source and 0 otherwise.

Any character that isn't a backtick or a regex metacharacter ([()?*+\\^$.) would work.


答:
Python 2, 141 bytes

shameless port of rtumbull, already skipping y because totally not needed.

from math import*
from random import*
lambda N,t,l:(2.*l*N)/(t*sum(randint(1,1e6)%t+abs(cos(randint(1,180)*pi/180))*l>t for _ in range(N)))
```
<p>Problem is only, that pi is already known in the program.</p>
<p>Here it is (golfable) with unknown pi and no trigonometric functions</p>
<pre class="lang-python prettyprint-override"><code>def g(N,t,l):
 c=0
 for _ in range(N):
    x,y=gauss(0,1),gauss(0,1);c+=randint(1,1e6)%t+abs(x/sqrt(x*x+y*y))*l>t
 return(2.*l*N)/(t*c)
</code>```

x,y in g is only for the direction.

Title: Natural Pi #1 - Sand

Body:
Goal

Generate (N) random line segments of uniform length (l), check if they cross the equidistant (t) parallel lines.

Simulation

What are we simulating? Buffon's needle. Smooth out the sand in your sandbox, draw a set of equally spaced parallel lines (call the distance in between t). Take a straight stick of length l and drop it N times into the sandbox. Let the number of times it crossed a line be c. Then Pi = (2 * l * n) / (t * c)!

How are we simulating this?

Take input N,t,l

With N, t, l all being positive integers

Do the following N times:

Generate a uniformly random integer coordinate x,y

With 1 <= x, y <= 10^6

x,y is the center of a line segment of length l

Generate a uniformly random integer a

With 1 <= a <= 180

Let P be the point where the line segment would cross the x-axis

Then a is the angle (x,y), P, (inf,0)

Count the number, c, of line segments that cross the line x = i*t for any integer i

Return (2 * l * N) / (t * c)

Specification

Input

Flexible, take input in any of the standard ways (eg function parameter,STDIN) and in any standard format (eg String, Binary)

Output

Flexible, give output in any of the standard ways (eg return, print)

White space, trailing and leading white space is acceptable

Accuracy, please provide at least 4 decimal places of accuracy (ie 3.1416)

Scoring

Shortest code wins!

Test Cases

Your output may not line up with these, because of random chance. But on average, you should get about this much accuracy for the given value of N, t, l.

```<code>Input (N,t,l)    ->  Output
-----------        ------
10,10,5          -> ?.????
10,100,50        -> ?.????
1000,1000,600    -> 3.????
10000,1000,700   -> 3.1???
100000,1000,700  -> 3.14??
</code>```

TL;DR

These challenges are simulations of algorithms that only require nature and your brain (and maybe some re-usable resources) to approximate Pi. If you really need Pi during the zombie apocalypse, these methods don't waste ammo! There are nine challenges total.

Body:
Python 2, 141 bytes

shameless port of rtumbull, already skipping y because totally not needed.

from math import*
from random import*
lambda N,t,l:(2.*l*N)/(t*sum(randint(1,1e6)%t+abs(cos(randint(1,180)*pi/180))*l>t for _ in range(N)))

Problem is only, that pi is already known in the program.

Here it is (golfable) with unknown pi and no trigonometric functions

def g(N,t,l):
 c=0
 for _ in range(N):
    x,y=gauss(0,1),gauss(0,1);c+=randint(1,1e6)%t+abs(x/sqrt(x*x+y*y))*l>t
 return(2.*l*N)/(t*c)

x,y in g is only for the direction.


答:
J, 49 bytes

```<code>[:(#~([:*/@(2&<*1&p:)@(,&dfh|:)_3]\])"{)i.@!@#A.]
</code>```

Brute-force search that tests all permutations and outputs all permutations that satisfy the conditions for the puzzle.

The performance is good enough to compute each test case in about 3 seconds.

Usage

```<code>   f =: [:(#~([:*/@(2&<*1&p:)@(,&dfh|:)_3]\])"{)i.@!@#A.]
   f '123558dde'
28de1d355
28de1d355
28de1d355
28de1d355
2e3815dd5
2e3815dd5
2e3815dd5
2e3815dd5
   timex 'f ''123558dde'''
3.68822
</code>```

Explanation

```<code>[:(#~([:*/@(2&<*1&p:)@(,&dfh|:)_3]\])"{)i.@!@#A.]  Input: string S
                                             #     Length of S
                                           !@      Factorial
                                        i.@        Range [0, len(S)!)
                                                ]  Get S
                                              A.   Find the permutations of S by index
[:(                                    )           Operate on the permutations
     (                              )"{              For each permutation P
                                   ]                   Get P
                               _3]\                    Get sublists of size 3
      [:              (       )                        Operate on the sublists
                            |:                           Transpose
                        &dfh                             Convert both the transpose and
                                                         initial from hex to decimal
                       ,                                 Join them
           (        )                                  Operate on the decimals
                1&p:                                     Test each for primality
            2&<                                          Test each if greater than 2
               *                                         Multiply them (AND)
        */@                                            Reduce using multiplication
   #~                                                Filter the permutations by those
                                                     values and return
</code>```

Title: The 3x3 Hexa Prime Square Puzzle

Body:
J, 49 bytes

[:(#~([:*/@(2&<*1&p:)@(,&dfh|:)_3]\])"{)i.@!@#A.]

Brute-force search that tests all permutations and outputs all permutations that satisfy the conditions for the puzzle.

The performance is good enough to compute each test case in about 3 seconds.

Usage

   f =: [:(#~([:*/@(2&<*1&p:)@(,&dfh|:)_3]\])"{)i.@!@#A.]
   f '123558dde'
28de1d355
28de1d355
28de1d355
28de1d355
2e3815dd5
2e3815dd5
2e3815dd5
2e3815dd5
   timex 'f ''123558dde'''
3.68822

Explanation

[:(#~([:*/@(2&<*1&p:)@(,&dfh|:)_3]\])"{)i.@!@#A.]  Input: string S
                                             #     Length of S
                                           !@      Factorial
                                        i.@        Range [0, len(S)!)
                                                ]  Get S
                                              A.   Find the permutations of S by index
[:(                                    )           Operate on the permutations
     (                              )"{              For each permutation P
                                   ]                   Get P
                               _3]\                    Get sublists of size 3
      [:              (       )                        Operate on the sublists
                            |:                           Transpose
                        &dfh                             Convert both the transpose and
                                                         initial from hex to decimal
                       ,                                 Join them
           (        )                                  Operate on the decimals
                1&p:                                     Test each for primality
            2&<                                          Test each if greater than 2
               *                                         Multiply them (AND)
        */@                                            Reduce using multiplication
   #~                                                Filter the permutations by those
                                                     values and return