问:
Generate a random program in your favorite language
We all heard of testing compilers using randomly generated inputs. Your task is to write a program to generate a valid program (including no undefined behavior) in your favorite language. The generating program language doesn't have to be the same as the generated program language.

Your program will receive an integer as the argument which you can use as seed for your random number generator. The generated programs should be structurally different (given different seeds) not just different variable names or constants.

Examples:

```<code>$ ./generate 1
int main() { return 0; }

$ ./generate 2
#include <math.h>
int main() { return (int) pow(4, 3); }
</code>```

Please include a couple of outputs in your answers.

The shortest solution wins. I will give a small bonus based on the number of votes, so please vote the most creative solutions.

答:
Python -> Fractran (117)

```<code>import random as r,sys
r.seed(int(sys.argv[1]))
z=r.randint
print','.join(`z(1,99)`+'/'+`z(1,99)`for q in[0]*z(1,99))
</code>```

Body:
Python -> Fractran (117)

import random as r,sys
r.seed(int(sys.argv[1]))
z=r.randint
print','.join(`z(1,99)`+'/'+`z(1,99)`for q in[0]*z(1,99))


问:
Alphabet triangle strikes again

Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

答:
Actually, <s>18</s> 17 bytes

```<code>úl`╜²1╖╜²;ú*Ht`na
</code>```

Ungolfing:

```<code>úl    Pushes 26 (the length of the lowercase alphabet).
  `     Start function
  ╜²    Push register 0 (default: 0) and square. Call this a.
  1╖    Increment register 0.
  ╜²;   Push register 0, square and duplicate. Call this b.
  ú*    b times the lowercase alphabet. Call this repeated_alphabet.
  Ht    Get repeated_alphabet[:b][a:]
  `     End function.
n     Run the above function (26) times.
a     Invert the stack.
      Print the stack implicitly with newlines.
</code>```

Try it online!

ContentLicense: CC BY-SA 3.0

Title: Alphabet triangle strikes again

Body:
Actually, <s>18</s> 17 bytes

úl`╜²1╖╜²;ú*Ht`na

Ungolfing:

úl    Pushes 26 (the length of the lowercase alphabet).
  `     Start function
  ╜²    Push register 0 (default: 0) and square. Call this a.
  1╖    Increment register 0.
  ╜²;   Push register 0, square and duplicate. Call this b.
  ú*    b times the lowercase alphabet. Call this repeated_alphabet.
  Ht    Get repeated_alphabet[:b][a:]
  `     End function.
n     Run the above function (26) times.
a     Invert the stack.
      Print the stack implicitly with newlines.

Try it online!


问:
The Piggyback Sequence
I made my own sequence recently (called the Piggyback sequence), and it works like this:

P(1), P(2) and P(3) = 1.

For all P(n) where n>3, the sequence works like this:

```<code>P(n) = P(n-3) + P(n-2)/P(n-1)
</code>```

So, continuing the sequence:

P(4) = 1 + 1/1 = 2

P(5) = 1 + 1/2 = 3/2
= 1.5

P(6) = 1 + 2/(3/2) = 7/3
= 2.33333...

P(7) = 2 + (3/2)/(7/3) = 37/14 = 2.6428571428...

P(8) = 3/2 + (7/3)/(37/14) = 529/222
= 2.3828828828...

Your task is, when given n, calculate P(n) either as a floating point number or an (im)proper fraction.

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

If anyone can find the name of the sequence, please edit the post accordingly.

Current leaders: MATL and Jelly (both at 15 bytes).

答:
Javascript (ES6), 31 bytes

```<code>P=n=>n<4?1:P(n-3)+P(n-2)/P(n-1)
</code>```

A simple function.

P=n=>n<4?1:P(n-3)+P(n-2)/P(n-1)

var out = '';

for (var i=1;i <= 20;i++) {
out +=''+i+': '+P(i)+'
';
}

document.getElementById('text').innerHTML = out;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>div {
font-family: Arial
}</code>```

```

Title: The Piggyback Sequence

Body:
Javascript (ES6), 31 bytes

P=n=>n<4?1:P(n-3)+P(n-2)/P(n-1)

A simple function.

P=n=>n<4?1:P(n-3)+P(n-2)/P(n-1)

var out = '';

for (var i=1;i <= 20;i++) {
out +='<strong>'+i+':</strong> '+P(i)+'<br/>';
}

document.getElementById('text').innerHTML = out;

div {
font-family: Arial
}

<div id="text"></div>


答:
Dyalog APL, 18 bytes

↑2{⍺↓⍵⍴⎕a}/×⍨0,⍳26

Title: Alphabet triangle strikes again

Body:
Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

Body:
Dyalog APL, 18 bytes

↑2{⍺↓⍵⍴⎕a}/×⍨0,⍳26


问:
Smallest positive number whose y-th power is divisible by x

Task

Given integers x and y which are both at least 2, find the smallest positive number whose y-th power is divisible by x.

Example

Given x=96 and y=2, the output should be 24 since 24 is the smallest positive n satisfying n^2 is divisible by 96.

Testcases

```<code>x  y output
26 2 26
96 2 24
32 3 4
64 9 2
27 3 3
</code>```

Scoring

This is code-golf. Solution with lowest byte-count wins.

References

y=2: OEIS A019554

y=3: OEIS A019555

y=4: OEIS A053166

y=5: OEIS A015052

y=6: OEIS A015054

答:
MATL, 9 bytes

```<code>y:w^w\&X<
</code>```

Try it online!

Explanation

```<code>y       % Take x and y implicitly. Push x again
        % STACK: x, y, x
:       % Range from 1 to x
        % STACK: x, y, [1, 2, ..., x]
w       % Swap
        % STACK: x, [1, 2, ..., x], y
^       % Power, element-wise
        % STACK: x, [1^y,  2^y, ..., x^y]
w       % Swap
        % STACK: [1^y, 2^y, ..., x^y], x
\       % Modulo, element-wise
        % STACK: [mod(1^y,x), mod(2^y,x), ..., mod(x^y,x)]
        % A 0 at the k-th entry indicates that x^y is divisible by x. The last entry
        % is guaranteed to be 0
&X<     % Arg min: get (1-based) index of the first minimum (the first zero), say n
        % STACK: n
        % Implicitly display
</code>```

Body:
MATL, 9 bytes

y:w^w\&X<

Try it online!

Explanation

y       % Take x and y implicitly. Push x again
        % STACK: x, y, x
:       % Range from 1 to x
        % STACK: x, y, [1, 2, ..., x]
w       % Swap
        % STACK: x, [1, 2, ..., x], y
^       % Power, element-wise
        % STACK: x, [1^y,  2^y, ..., x^y]
w       % Swap
        % STACK: [1^y, 2^y, ..., x^y], x
\       % Modulo, element-wise
        % STACK: [mod(1^y,x), mod(2^y,x), ..., mod(x^y,x)]
        % A 0 at the k-th entry indicates that x^y is divisible by x. The last entry
        % is guaranteed to be 0
&X<     % Arg min: get (1-based) index of the first minimum (the first zero), say n
        % STACK: n
        % Implicitly display


答:
JavaScript (Using external library - Enumerable) (<s>90</s> <s>88</s> <s>86</s> 80 bytes)

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

```<code>(z=_.Range)(0,26).WriteLine(x=>z(x*x,2*x+1).Write("",y=>(y%26+10).toString(36)))
</code>```

Code explanation: Create range of ints 0 to 25, and for each write a new line according to the predicate. For each line, create a range of ints starting at the square of the current int, for a count of 2x+1. Then take that range, and join it into a string delimited by nothing where each int is casted to the String represented by the int ascii code

Title: Alphabet triangle strikes again

Body:
JavaScript (Using external library - Enumerable) (<s>90</s> <s>88</s> <s>86</s> 80 bytes)

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

(z=_.Range)(0,26).WriteLine(x=>z(x*x,2*x+1).Write("",y=>(y%26+10).toString(36)))

Code explanation: Create range of ints 0 to 25, and for each write a new line according to the predicate. For each line, create a range of ints starting at the square of the current int, for a count of 2x+1. Then take that range, and join it into a string delimited by nothing where each int is casted to the String represented by the int ascii code


答:
Brachylog, <s>19</s> <s>17</s> <s>16</s> <s>15</s> 12 bytes

2 bytes saved thanks to @LeakyNun.

```<code>:[I:1]*$r=#>
</code>```

Try it online!

Explanation

```<code>               Input = [X, Y]
:[I:1]*        Get a list [X*I, Y] (I being any integer at this point)
       $r=     Get the first integer which is the Yth root of X*I
          #>   This integer must be strictly positive
               This integer is the Output
</code>```

Title: Smallest positive number whose y-th power is divisible by x

Body:
Task

Given integers x and y which are both at least 2, find the smallest positive number whose y-th power is divisible by x.

Example

Given x=96 and y=2, the output should be 24 since 24 is the smallest positive n satisfying n^2 is divisible by 96.

Testcases

```<code>x  y output
26 2 26
96 2 24
32 3 4
64 9 2
27 3 3
</code>```

Scoring

This is code-golf. Solution with lowest byte-count wins.

References

y=2: OEIS A019554

y=3: OEIS A019555

y=4: OEIS A053166

y=5: OEIS A015052

y=6: OEIS A015054

Body:
Brachylog, <s>19</s> <s>17</s> <s>16</s> <s>15</s> 12 bytes

2 bytes saved thanks to @LeakyNun.

:[I:1]*$r=#>

Try it online!

Explanation

               Input = [X, Y]
:[I:1]*        Get a list [X*I, Y] (I being any integer at this point)
       $r=     Get the first integer which is the Yth root of X*I
          #>   This integer must be strictly positive
               This integer is the Output


答:
Python 3, <s>60</s> <s>43</s> 39 bytes

Thanks to @LeakyNun and @Sp3000 for help

```<code>f=lambda x,y,i=1:i**y%x<1or-~f(x,y,i+1)
</code>```

A function that takes input via argument and returns the output.

How it works

The function uses recursion to repeatedly check integers i, starting with i=1, until one satisfying the required condition, here i**y%x<1, is found. This is achieved by taking the logical or of the condition and the result of the expression for i+1 incremented, which here is -~f(x,y,i+1). This expression continuously evaluates as False until a satisfying value j is found, at which point it evaluates to True and recursion stops. Since these are respectively equivalent to 0 and 1 in Python, and the function has repeatedly been adding 1 via the incrementing part, the function returns (j-1)*False + True + (j-1)*1 = (j-1)*0 + 1 + (j-1)*1 = 1 + j-1 = j, as required.

Try it on Ideone

Body:
Python 3, <s>60</s> <s>43</s> 39 bytes

Thanks to @LeakyNun and @Sp3000 for help

f=lambda x,y,i=1:i**y%x<1or-~f(x,y,i+1)

A function that takes input via argument and returns the output.

How it works

The function uses recursion to repeatedly check integers i, starting with i=1, until one satisfying the required condition, here i**y%x<1, is found. This is achieved by taking the logical or of the condition and the result of the expression for i+1 incremented, which here is -~f(x,y,i+1). This expression continuously evaluates as False until a satisfying value j is found, at which point it evaluates to True and recursion stops. Since these are respectively equivalent to 0 and 1 in Python, and the function has repeatedly been adding 1 via the incrementing part, the function returns (j-1)*False + True + (j-1)*1 = (j-1)*0 + 1 + (j-1)*1 = 1 + j-1 = j, as required.

Try it on Ideone


问:
Print every printable ASCII character without using it
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.

For example, if your language was Python, your program that outputs the character P might be

```<code>print(chr(80))
</code>```

because P has ASCII code 80. This program is valid because P never appears in the source code. However, for the program that outputs lowercase p, something like

```<code>print(chr(112))
</code>```

would be invalid because, while it does print p, p is present in the code. A valid program could be

```<code>exec(chr(112)+'rint(chr(112))')
</code>```

which prints p but does not contain p.

Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.

If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.

The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.

Rules

The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)

Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.

The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.

Each program's output should go to stdout or your language's accepted alternative.

Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)

Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.

A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.

Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80)), print(chr(81)), print(chr(82))..." but make sure you're sure they all would work and that your score is added correctly.

For reference, here are the 95 printable ASCII your programs must output:

```<code> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
</code>```

答:
><>, <s>443</s> 437 bytes

TIO interpreter link. There's a lot of patterns here:

[num][num]*o;: Multiplication of two numbers, then output the result as a char with o and halt with ;. ><> digits go up to 15, i.e. 0123456789abcdef.

Similarly [num][num]-n;, which takes the difference of two numbers and outputs as a number with n instead.

'-o[invalid char]: ><> is toroidal, so when the instruction pointer reaches the end of a line it moves back to the beginning. In this case, this causes the code to be executed twice, i.e. '-o[char]'-o[char]. The first '-o[char]' part pushes three chars to the stack, - calculates 'o' - [char] then o outputs the result as a character. ><> then errors out when it reaches [char], either due to an unrecognised command or from popping an empty stack.

Similarly '-n[invalid char], which outputs as a number.

Similarly '[num][op]o[invalid char], which applies [op] with [num] on [char], erroring out on char. For example, '2+oJ outputs L, which is two more than J.

''s code is "-oH, using " instead.

-'s code is '%oB, using % instead.

ln;: Push length of stack, output as num then halt, giving 0. Similarly lln; for 1 and 'ln; for 3.

4|n+: Push 4, bounce off the | and push another 4, add, then output 8 as num. Bounce off the | again, and error out trying to execute n again on an empty stack.

Similarly 3|n* for 9.

Similarly [num]|o* for @Qdy.

'1-:00p: The most interesting one, for the o case. To avoid using o in our code, we need to use p to place an o in the codebox, then run it. The initial '1-:00p' sets the stack up to have a p on top, and 1- decrements it into an o. : duplicates this o, and 00p places one o at (0, 0), turning the codebox into o1-:00p. The instruction pointer wraps again, outputting the other o. The (0, 0) char is then replaced a few more times before the program finally errors out.

```<code>      '-oO
!     '-oN
"     '-oM
#     '-oL
$     '-oK
%     '-oJ
&     '-oI
'     "-oH
(     '-oG
)     '-oF
*     '-oE
+     '-oD
,     '-oC
-     '%oB
.     '-oA
/     '-o@
0     ln;
1     lln;
2     '-o=
3     'ln;
4     '-o;
5     61-n;
6     '-nh
7     '-ng
8     4|n+
9     3|n*
:     '1-o;
;     '6-oA
<     6a*o;
=     '2+o;
>     '3+o;
?     79*o;
@     8|o*
A     '-o.
B     '-o-
C     '-o,
D     '-o+
E     '-o*
F     '-o)
G     '-o(
H     89*o;
I     '1-oJ
J     '-o%
K     '-o$
L     '2+oJ
M     7b*o;
N     '-o!
O     '5+oJ
P     8a*o;
Q     9|o*
R     '8+oJ
S     '9+oJ
T     7c*o;
U     'b+oJ
V     'c+oJ
W     'd+oJ
X     8b*o;
Y     'f+oJ
Z     9a*o;
[     7d*o;
\     'c-oh
]     'b-oh
^     'a-oh
_     '9-oh
`     8c*o;
a     '7-oh
b     7e*o;
c     9b*o;
d     a|o*
e     '3-oh
f     '2-oh
g     '1-oh
h     '2-oj
i     8d*o;
j     '2+oh
k     '3+oh
l     9c*o;
m     '5+oh
n     ab*o;
o     '1-:00p
p     8e*o;
q     '3-ot
r     '2-ot
s     '1-ot
t     '1+os
u     9d*o;
v     '2+ot
w     '3+ot
x     ac*o;
y     b|o*
z     '6+ot
{     '7+ot
|     '8+ot
}     '9+ot
~     9e*o;
</code>```

Body:
><>, <s>443</s> 437 bytes

TIO interpreter link. There's a lot of patterns here:

[num][num]*o;: Multiplication of two numbers, then output the result as a char with o and halt with ;. ><> digits go up to 15, i.e. 0123456789abcdef.

Similarly [num][num]-n;, which takes the difference of two numbers and outputs as a number with n instead.

'-o[invalid char]: ><> is toroidal, so when the instruction pointer reaches the end of a line it moves back to the beginning. In this case, this causes the code to be executed twice, i.e. '-o[char]'-o[char]. The first '-o[char]' part pushes three chars to the stack, - calculates 'o' - [char] then o outputs the result as a character. ><> then errors out when it reaches [char], either due to an unrecognised command or from popping an empty stack.

Similarly '-n[invalid char], which outputs as a number.

Similarly '[num][op]o[invalid char], which applies [op] with [num] on [char], erroring out on char. For example, '2+oJ outputs L, which is two more than J.

''s code is "-oH, using " instead.

-'s code is '%oB, using % instead.

ln;: Push length of stack, output as num then halt, giving 0. Similarly lln; for 1 and 'ln; for 3.

4|n+: Push 4, bounce off the | and push another 4, add, then output 8 as num. Bounce off the | again, and error out trying to execute n again on an empty stack.

Similarly 3|n* for 9.

Similarly [num]|o* for @Qdy.

'1-:00p: The most interesting one, for the o case. To avoid using o in our code, we need to use p to place an o in the codebox, then run it. The initial '1-:00p' sets the stack up to have a p on top, and 1- decrements it into an o. : duplicates this o, and 00p places one o at (0, 0), turning the codebox into o1-:00p. The instruction pointer wraps again, outputting the other o. The (0, 0) char is then replaced a few more times before the program finally errors out.

      '-oO
!     '-oN
"     '-oM
#     '-oL
$     '-oK
%     '-oJ
&     '-oI
'     "-oH
(     '-oG
)     '-oF
*     '-oE
+     '-oD
,     '-oC
-     '%oB
.     '-oA
/     '-o@
0     ln;
1     lln;
2     '-o=
3     'ln;
4     '-o;
5     61-n;
6     '-nh
7     '-ng
8     4|n+
9     3|n*
:     '1-o;
;     '6-oA
<     6a*o;
=     '2+o;
>     '3+o;
?     79*o;
@     8|o*
A     '-o.
B     '-o-
C     '-o,
D     '-o+
E     '-o*
F     '-o)
G     '-o(
H     89*o;
I     '1-oJ
J     '-o%
K     '-o$
L     '2+oJ
M     7b*o;
N     '-o!
O     '5+oJ
P     8a*o;
Q     9|o*
R     '8+oJ
S     '9+oJ
T     7c*o;
U     'b+oJ
V     'c+oJ
W     'd+oJ
X     8b*o;
Y     'f+oJ
Z     9a*o;
[     7d*o;
\     'c-oh
]     'b-oh
^     'a-oh
_     '9-oh
`     8c*o;
a     '7-oh
b     7e*o;
c     9b*o;
d     a|o*
e     '3-oh
f     '2-oh
g     '1-oh
h     '2-oj
i     8d*o;
j     '2+oh
k     '3+oh
l     9c*o;
m     '5+oh
n     ab*o;
o     '1-:00p
p     8e*o;
q     '3-ot
r     '2-ot
s     '1-ot
t     '1+os
u     9d*o;
v     '2+ot
w     '3+ot
x     ac*o;
y     b|o*
z     '6+ot
{     '7+ot
|     '8+ot
}     '9+ot
~     9e*o;


答:
Jelly, 15 bytes

```<code>ạ2,1,3ß€÷2/SµḊ¡
</code>```

Try it online! or verify all test cases.

How it works

```<code>ạ2,1,3ß€÷2/SµḊ¡  Main link. Argument: n (integer)

             Ḋ   Dequeue; yield [2, ..., n].
            µ ¡  If the range is non-empty (i.e., if n > 1), execute the chain to
                 the left. If n is 0 or 1, return n.
                 Note that P(3) = P(0) + P(2)/P(1) if we define P(0) := 0.
ạ2,1,3           Take the absolute difference of n and 2, 1, and 3.
                 This gives [0, 1, 1] if n = 2, and P(0) + P(1)/P(1) = 0 + 1/1 = 1.
      ß€         Recursively apply the main each to each difference.
        ÷2/      Perform pairwise division.
                 This maps [P(n-2), P(n-1), P(n-3)] to [P(n-2)/P(n-1), P(n-3)].
           S     Sum, yielding P(n-2)/P(n-1) + P(n-3).
</code>```

Title: The Piggyback Sequence

Body:
I made my own sequence recently (called the Piggyback sequence), and it works like this:

P(1), P(2) and P(3) = 1.

For all P(n) where n>3, the sequence works like this:

```<code>P(n) = P(n-3) + P(n-2)/P(n-1)
</code>```

So, continuing the sequence:

P(4) = 1 + 1/1 = 2

P(5) = 1 + 1/2 = 3/2
= 1.5

P(6) = 1 + 2/(3/2) = 7/3
= 2.33333...

P(7) = 2 + (3/2)/(7/3) = 37/14 = 2.6428571428...

P(8) = 3/2 + (7/3)/(37/14) = 529/222
= 2.3828828828...

Your task is, when given n, calculate P(n) either as a floating point number or an (im)proper fraction.

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

If anyone can find the name of the sequence, please edit the post accordingly.

Current leaders: MATL and Jelly (both at 15 bytes).

Body:
Jelly, 15 bytes

ạ2,1,3ß€÷2/SµḊ¡

Try it online! or verify all test cases.

How it works

ạ2,1,3ß€÷2/SµḊ¡  Main link. Argument: n (integer)

             Ḋ   Dequeue; yield [2, ..., n].
            µ ¡  If the range is non-empty (i.e., if n > 1), execute the chain to
                 the left. If n is 0 or 1, return n.
                 Note that P(3) = P(0) + P(2)/P(1) if we define P(0) := 0.
ạ2,1,3           Take the absolute difference of n and 2, 1, and 3.
                 This gives [0, 1, 1] if n = 2, and P(0) + P(1)/P(1) = 0 + 1/1 = 1.
      ß€         Recursively apply the main each to each difference.
        ÷2/      Perform pairwise division.
                 This maps [P(n-2), P(n-1), P(n-3)] to [P(n-2)/P(n-1), P(n-3)].
           S     Sum, yielding P(n-2)/P(n-1) + P(n-3).


答:
Actually, <s>12</s> 11 bytes

Many thanks to Leaky Nun for his many suggestions. Golfing suggestions welcome. Try it online!

```<code>;)R♀ⁿ♀%0@íu
</code>```

Original 12-byte approach. Try it online!

```<code>1WX│1╖╜ⁿ%WX╜
</code>```

Another 12-byte approach. Try it online!

```<code>w┬i)♀/♂K@♀ⁿπ
</code>```

A 13-byte approach. Try it online!

```<code>k╗2`╜iaⁿ%Y`╓N
</code>```

Ungolfing:

First algorithm

```<code>       Implicitly pushes y, then x.
;      Duplicate x.
)      Rotate duplicate x to bottom of the stack.
R      Range [1, x] (inclusive).
♀ⁿ     Map a**y over the range.
♀%     Map a**y%x over the range.
0@í    new_list.index(0)
u      Increment and print implicitly at the end of the program.
</code>```

Original algorithm

```<code>       Implicitly pushes x, then y.
1WX    Pushes a truthy value to be immediately discarded
         (in future loops, we discard a**y%x)
|      Duplicates entire stack.
         Stack: [y x y x]
1╖     Increment register 0.
╜      Push register 0. Call it a.
ⁿ      Take a to the y-th power.
%      Take a**y mod x.
W      If a**y%x == 0, end loop.
X      Discard the modulus.
╜      Push register 0 as output.
</code>```

Third algorithm

```<code>       Implicitly pushes y, then x.
w      Pushes the full prime factorization of x.
┬      Transposes the factorization (separating primes from exponents)
i      Flatten (into two separate lists of primes and exponents).
)      Rotate primes to the bottom of the stack.
♀/     Map divide over the exponents.
♂K     Map ceil() over all of the divided exponents.
@      Swap primes and modified exponents.
♀ⁿ     Map each prime ** each exponent.
π      Product of that list. Print implicitly at the end of the program.
</code>```

Fourth algorithm

```<code>     Implicitly pushes x, then y.
k╗   Turns stack [x y] into a list [x, y] and saves to register 0.
2    Pushes 2.
  `    Starts function with a.
  ╜i   Pushes register 0 and flattens. Stack: [x y a]
  a    Inverts the stack. Stack: [a y x]
  ⁿ%   Gets a**y%x.
  Y    Logical negate (if a**y is divisible by x, then 1, else 0)
  `    End function.
╓    Push first (2) values where f(x) is truthy, starting with f(0).
N    As f(0) is always truthy, get the second value.
     Print implicitly at the end of the program.
</code>```

Body:
Actually, <s>12</s> 11 bytes

Many thanks to Leaky Nun for his many suggestions. Golfing suggestions welcome. Try it online!

;)R♀ⁿ♀%0@íu

Original 12-byte approach. Try it online!

1WX│1╖╜ⁿ%WX╜

Another 12-byte approach. Try it online!

w┬i)♀/♂K@♀ⁿπ

A 13-byte approach. Try it online!

k╗2`╜iaⁿ%Y`╓N

Ungolfing:

First algorithm

       Implicitly pushes y, then x.
;      Duplicate x.
)      Rotate duplicate x to bottom of the stack.
R      Range [1, x] (inclusive).
♀ⁿ     Map a**y over the range.
♀%     Map a**y%x over the range.
0@í    new_list.index(0)
u      Increment and print implicitly at the end of the program.

Original algorithm

       Implicitly pushes x, then y.
1WX    Pushes a truthy value to be immediately discarded
         (in future loops, we discard a**y%x)
|      Duplicates entire stack.
         Stack: [y x y x]
1╖     Increment register 0.
╜      Push register 0. Call it a.
ⁿ      Take a to the y-th power.
%      Take a**y mod x.
W      If a**y%x == 0, end loop.
X      Discard the modulus.
╜      Push register 0 as output.

Third algorithm

       Implicitly pushes y, then x.
w      Pushes the full prime factorization of x.
┬      Transposes the factorization (separating primes from exponents)
i      Flatten (into two separate lists of primes and exponents).
)      Rotate primes to the bottom of the stack.
♀/     Map divide over the exponents.
♂K     Map ceil() over all of the divided exponents.
@      Swap primes and modified exponents.
♀ⁿ     Map each prime ** each exponent.
π      Product of that list. Print implicitly at the end of the program.

Fourth algorithm

     Implicitly pushes x, then y.
k╗   Turns stack [x y] into a list [x, y] and saves to register 0.
2    Pushes 2.
  `    Starts function with a.
  ╜i   Pushes register 0 and flattens. Stack: [x y a]
  a    Inverts the stack. Stack: [a y x]
  ⁿ%   Gets a**y%x.
  Y    Logical negate (if a**y is divisible by x, then 1, else 0)
  `    End function.
╓    Push first (2) values where f(x) is truthy, starting with f(0).
N    As f(0) is always truthy, get the second value.
     Print implicitly at the end of the program.


答:
Haskell, <s>1874 1864 1856 1855 1795 1791</s> 1589 bytes, 7 DNPs

Most programs are main=putChar '\xx' or main=putChar '\xxx' where xx/xxx is the ascii code of the char to be printed.
This works for all but 14 chars:

```<code> !"#$%& ()*+,-./0123456789:;< >?@AB DEFGHIJKLMNOPQRSTUVWXYZ[ ]^_` bcdefg  jkl  o q s  vwxyz{|}~
       '                     =     C                        \    a      hi   mn p r tu
</code>```

However, for the digits <s>1 7</s> 4 bytes can be saved (thanks to Christian Sievers!):

```<code>0   main=print$1-1
1   main=print$3-2
2   main=print$1+1
3   main=print$1+2
...
</code>```

The 52 programs up to c (code 99) take 18 bytes, the remaining 19 take 19 bytes each.

Partial score: 10*14 + 52*18 + 19*19 = 1437

For 7 of the remaining chars, the following programs work:

```<code>    main=putChar$'\32'
'   main=putStr$pred<$>"("
C   main=putStr['\67']
\   main=putChar$pred ']'
h   main=putStr['\104']
p   main=interact(\_->['\112'])
u   main=interact(\_->['\117'])
</code>```

Partial score: 18 + 22 + 18 + 21 + 19 + 27 + 27 = 152

This leaves 7 DNPs: =aimnrt

Each Haskell program needs to define a main (main=), so that's 5 DNPs. To print to stdOut, putChar, putStr or interact can be used, yielding t and r as further DNPs. (There is also print, however print 'a' prints 'a' and not a - and also contains t and r anyway.)
Haskell also has a chr function which returns the corresponding char given a number, however in order to use it import Data.Char is needed.

Total score: 1437 + 152 = 1589, 7 DNPs

Title: Print every printable ASCII character without using it

Body:
In a programming language of your choice, write 95 programs, each of which outputs a different one of the 95 printable ASCII characters without that character occurring anywhere in the program.

For example, if your language was Python, your program that outputs the character P might be

```<code>print(chr(80))
</code>```

because P has ASCII code 80. This program is valid because P never appears in the source code. However, for the program that outputs lowercase p, something like

```<code>print(chr(112))
</code>```

would be invalid because, while it does print p, p is present in the code. A valid program could be

```<code>exec(chr(112)+'rint(chr(112))')
</code>```

which prints p but does not contain p.

Your goal is to make each of your 95 programs as short as possible. Your score is the sum of the character lengths of all your programs.

If for any reason you are unable to write valid programs for some characters, you may mark those characters as "Did Not Program" or DNP, and omit programs for them entirely. This way syntactically strict languages will be able to compete.

The winning answer is the answer that has the lowest score of the set of answers that have the fewest DNP's.

Rules

The source code of all of your programs may only contain printable ASCII plus tabs and newlines, all of which are counted as one character. (Because in a different encoding it would be easy to omit characters that don't exist!)

Note: This rule seems necessary but there are many languages with different encodings and I'm sure it'd be cool to see the answers for them. Therefore you can break this rule, you can use whatever characters you want, but then your answer becomes non-competitive, it cannot win.

The programs must be actual, full programs, according to your language's standard conventions. Functions and REPL snippets are not allowed.

Each program's output should go to stdout or your language's accepted alternative.

Programs should not prompt for or require input. (If prompting for input is inherent to your language, that's ok.)

Programs should be deterministic, finite in run time, and independent. e.g. it shouldn't matter if one is run in a folder separate from the other programs.

A program's output should be the precise printable ASCII character it corresponds to, optionally followed by a single trailing newline, nothing more, nothing less.

Be sure to include information on all 95 (ideally) programs in your answer, as well as your score and any DNP's. You don't have to list all programs that follow a simple pattern like "print(chr(80)), print(chr(81)), print(chr(82))..." but make sure you're sure they all would work and that your score is added correctly.

For reference, here are the 95 printable ASCII your programs must output:

```<code> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
</code>```

Body:
Haskell, <s>1874 1864 1856 1855 1795 1791</s> 1589 bytes, 7 DNPs

Most programs are main=putChar '\xx' or main=putChar '\xxx' where xx/xxx is the ascii code of the char to be printed.
This works for all but 14 chars:

 !"#$%& ()*+,-./0123456789:;< >?@AB DEFGHIJKLMNOPQRSTUVWXYZ[ ]^_` bcdefg  jkl  o q s  vwxyz{|}~
       '                     =     C                        \    a      hi   mn p r tu

However, for the digits <s>1 7</s> 4 bytes can be saved (thanks to Christian Sievers!):

0   main=print$1-1
1   main=print$3-2
2   main=print$1+1
3   main=print$1+2
...

The 52 programs up to c (code 99) take 18 bytes, the remaining 19 take 19 bytes each.

Partial score: 10*14 + 52*18 + 19*19 = 1437

For 7 of the remaining chars, the following programs work:

    main=putChar$'\32'
'   main=putStr$pred<$>"("
C   main=putStr['\67']
\   main=putChar$pred ']'
h   main=putStr['\104']
p   main=interact(\_->['\112'])
u   main=interact(\_->['\117'])

Partial score: 18 + 22 + 18 + 21 + 19 + 27 + 27 = 152

This leaves 7 DNPs: =aimnrt

Each Haskell program needs to define a main (main=), so that's 5 DNPs. To print to stdOut, putChar, putStr or interact can be used, yielding t and r as further DNPs. (There is also print, however print 'a' prints 'a' and not a - and also contains t and r anyway.)
Haskell also has a chr function which returns the corresponding char given a number, however in order to use it import Data.Char is needed.

Total score: 1437 + 152 = 1589, 7 DNPs


答:
Minkolang 0.15, 604 bytes

For most characters, "<char-1>"1+O. would be a valid program, perhaps one of the shortest. However, due to the fact that characters are stored as code points on the stack means that many of them can be produced by multiplication and addition, in five bytes or fewer. Also, note that l, $1, $2, $3, $4, $5, $6, $l are 10, 11, 12, 13, 14, 15, 16, 100 respectively.

Format: <character>: <program>

```<code> : 48*O.
!: $13*O.
": 66*2-O.
#: 57*O.
$: 66*O.
%: 66*1+O.
&: 4l*2-O.
': 3$3*O.
(: 4l*O.
): 4l*1+O.
*: ")"1+O.
+: "*"1+O.
,: $14*O.
-: 59*O.
.: "-"1+d$10pO-
/: "."1+O.
0: 68*O.
1: 77*O.
2: 5l*O.
3: 5l*1+O.
4: lZIO.
5: lZdIO.
6: 239**O.
7: 5$1*O.
8: 4$4*O.
9: 6l*3-O.
:: 6l*2-O.
;: 6l*1-O.
<: 6l*O.
=: 6l*1+O.
>: 6l*2+O.
?: 79*O.
@: 88*O.
A: 5$3*O.
B: 6$1*O.
C: 7l*3-O.
D: 7l*2-O.
E: 7l*1-O.
F: 7l*O.
G: 7l*1+O.
H: 89*O.
I: 89*1+O.
J: 89*2+O.
K: 355**O.
L: 89*4+O.
M: 7$1*O.
N: 6$3*O.
O: "N"1+d90pN.
P: 8l*O.
Q: 99*O.
R: 8l*2+O.
S: 8l*3+O.
T: 347**O.
U: 8l*5+O.
V: 8l*6+O.
W: 8l*7+O.
X: 8$1*O.
Y: 8l*9+O.
Z: 9l*O.
[: $l9-O.
\: $l8-O.
]: $l7-O.
^: $l6-O.
_: $l5-O.
`: 8$2*O.
a: $l3-O.
b: $l2-O.
c: 9$1*O.
d: $lO.
e: $l1+O.
f: $l2+O.
g: $l3+O.
h: $l4+O.
i: $l5+O.
j: $l6+O.
k: $l7+O.
l: $l8+O.
m: $l9+O.
n: l$1*O.
o: $l$1+O.
p: $l$2+O.
q: $l$3+O.
r: $l$4+O.
s: $l$5+O.
t: $l$6+O.
u: "t"1+O.
v: "u"1+O.
w: 7dl+*O.
x: 358**O.
y: $1d*O.
z: 53;3-O.
{: 53;2-O.
|: 53;1-O.
}: 53;O.
~: 53;1+O.
</code>```

Special mentions:

```<code>.: "-"1+d$10pO-
</code>```

(Try it.) Minkolang has the ability to modify the characters in the code box, so what this program does is that it replaces that - at the end with ., which is necessary for stopping the program. "N"1+d90pN. for O works the same way.

```<code>4: lZIO.
</code>```

(Try it.) lZ pushes the uppercase and lowercase alphabets to the stack, and I pushes the length of the stack, which is 52, precisely the code point of "4". The best part is that I was initially considering the solution of 4$3*O., which multiplies 4 and 13 to get 52, but couldn't because it had a 4 in it, so I ended up finding a golfier solution anyway!

```<code>y: $1d*O.
</code>```

(Try it.) d duplicates the top of stack, so what this piece of code does is that it pushes 11, duplicates it, and then multiplies. An alternate way to write this would have been $12;O., which has the same byte count.

```<code>}: 53;O.
</code>```

(Try it.) ; is exponentiation, so this does 5^3 to get 125.

Body:
Minkolang 0.15, 604 bytes

For most characters, "<char-1>"1+O. would be a valid program, perhaps one of the shortest. However, due to the fact that characters are stored as code points on the stack means that many of them can be produced by multiplication and addition, in five bytes or fewer. Also, note that l, $1, $2, $3, $4, $5, $6, $l are 10, 11, 12, 13, 14, 15, 16, 100 respectively.

Format: <character>: <program>

 : 48*O.
!: $13*O.
": 66*2-O.
#: 57*O.
$: 66*O.
%: 66*1+O.
&: 4l*2-O.
': 3$3*O.
(: 4l*O.
): 4l*1+O.
*: ")"1+O.
+: "*"1+O.
,: $14*O.
-: 59*O.
.: "-"1+d$10pO-
/: "."1+O.
0: 68*O.
1: 77*O.
2: 5l*O.
3: 5l*1+O.
4: lZIO.
5: lZdIO.
6: 239**O.
7: 5$1*O.
8: 4$4*O.
9: 6l*3-O.
:: 6l*2-O.
;: 6l*1-O.
<: 6l*O.
=: 6l*1+O.
>: 6l*2+O.
?: 79*O.
@: 88*O.
A: 5$3*O.
B: 6$1*O.
C: 7l*3-O.
D: 7l*2-O.
E: 7l*1-O.
F: 7l*O.
G: 7l*1+O.
H: 89*O.
I: 89*1+O.
J: 89*2+O.
K: 355**O.
L: 89*4+O.
M: 7$1*O.
N: 6$3*O.
O: "N"1+d90pN.
P: 8l*O.
Q: 99*O.
R: 8l*2+O.
S: 8l*3+O.
T: 347**O.
U: 8l*5+O.
V: 8l*6+O.
W: 8l*7+O.
X: 8$1*O.
Y: 8l*9+O.
Z: 9l*O.
[: $l9-O.
\: $l8-O.
]: $l7-O.
^: $l6-O.
_: $l5-O.
`: 8$2*O.
a: $l3-O.
b: $l2-O.
c: 9$1*O.
d: $lO.
e: $l1+O.
f: $l2+O.
g: $l3+O.
h: $l4+O.
i: $l5+O.
j: $l6+O.
k: $l7+O.
l: $l8+O.
m: $l9+O.
n: l$1*O.
o: $l$1+O.
p: $l$2+O.
q: $l$3+O.
r: $l$4+O.
s: $l$5+O.
t: $l$6+O.
u: "t"1+O.
v: "u"1+O.
w: 7dl+*O.
x: 358**O.
y: $1d*O.
z: 53;3-O.
{: 53;2-O.
|: 53;1-O.
}: 53;O.
~: 53;1+O.

Special mentions:

.: "-"1+d$10pO-

(Try it.) Minkolang has the ability to modify the characters in the code box, so what this program does is that it replaces that - at the end with ., which is necessary for stopping the program. "N"1+d90pN. for O works the same way.

4: lZIO.

(Try it.) lZ pushes the uppercase and lowercase alphabets to the stack, and I pushes the length of the stack, which is 52, precisely the code point of "4". The best part is that I was initially considering the solution of 4$3*O., which multiplies 4 and 13 to get 52, but couldn't because it had a 4 in it, so I ended up finding a golfier solution anyway!

y: $1d*O.

(Try it.) d duplicates the top of stack, so what this piece of code does is that it pushes 11, duplicates it, and then multiplies. An alternate way to write this would have been $12;O., which has the same byte count.

}: 53;O.

(Try it.) ; is exponentiation, so this does 5^3 to get 125.


答:
PowerShell, 68 bytes

```<code>$a=-join(65..90|%{[char]$_})*26;26..1|%{$a=$a.Insert($_*$_,"`n")};$a
</code>```

The section before the first semicolon produces a string containing 26 copies of the uppercase alphabet. The next section injects linebreaks at the index of each square number (working backward so I don't have to account for the shifting). Finally, the $a at the end just shoves that string variable onto PowerShell's equivalent of STDOUT.

Title: Alphabet triangle strikes again

Body:
PowerShell, 68 bytes

$a=-join(65..90|%{[char]$_})*26;26..1|%{$a=$a.Insert($_*$_,"`n")};$a

The section before the first semicolon produces a string containing 26 copies of the uppercase alphabet. The next section injects linebreaks at the index of each square number (working backward so I don't have to account for the shifting). Finally, the $a at the end just shoves that string variable onto PowerShell's equivalent of STDOUT.


答:
05AB1E, 417 bytes

```<code>!   62D>B
"   63D>B
#   64D>B
$   65D>B
%   66D>B
&   67D>B
'   68D>B
(   69D>B
)   70D>B
*   71D>B
+   72D>B
,   73D>B
-   74D>B
.   75D>B
/   76D>B
0   1<
1   X
2   Y
3   Z
4   3>
5   4>
6   5>
7   6>
8   7>
9   8>
:   77D>B
;   78D>B
<   79D>B
=   80D>B
>   81D1+B
?   82D>B
@   83D>B
A   Th
B   T>h
C   T>>h
D   T3+h
E   T4+h
F   T5+h
G   16D>B
H   17D>B
I   18D>B
J   19D>B
K   20D>B
L   21D>B
M   22D>B
N   23D>B
O   24D>B
P   25D>B
Q   26D>B
R   27D>B
S   28D>B
T   29D>B
U   30D>B
V   31D>B
W   33D>B
X   33D>B
Y   A`\u
Z   A`u
[   84D>B
\   85D>B
]   86D>B
^   87D>B
_   88D>B
`   89D>B
a   A`r
b   A`r\
c   38D>B
d   39D>B
e   40D>B
f   41D>B
g   42D>B
h   43D>B
i   44D>B
j   45D>B
k   46D>B
l   47D>B
m   48D>B
n   49D>B
o   50D>B
p   51D>B
q   52D>B
r   53D>B
s   54D>B
t   55D>B
u   56D>B
v   57D>B
w   58D>B
x   A`\\
y   A`\
z   A`
{   90D>B
|   91D>B
}   92D>B
~   93D>B
</code>```

Explanation

Most are 5 bytes long of the form: convert nr to base nr+1.

> needs an extra byte since we can't use increment for that.

a,b,x,y,z,Y,Z are extracted from A which contains the alphabet in lower case.

A,B,C,D,E,F are numbers converted to hex.

0-9 are simple increment/decrements as well as predefined variables.

Body:
05AB1E, 417 bytes

!   62D>B
"   63D>B
#   64D>B
$   65D>B
%   66D>B
&   67D>B
'   68D>B
(   69D>B
)   70D>B
*   71D>B
+   72D>B
,   73D>B
-   74D>B
.   75D>B
/   76D>B
0   1<
1   X
2   Y
3   Z
4   3>
5   4>
6   5>
7   6>
8   7>
9   8>
:   77D>B
;   78D>B
<   79D>B
=   80D>B
>   81D1+B
?   82D>B
@   83D>B
A   Th
B   T>h
C   T>>h
D   T3+h
E   T4+h
F   T5+h
G   16D>B
H   17D>B
I   18D>B
J   19D>B
K   20D>B
L   21D>B
M   22D>B
N   23D>B
O   24D>B
P   25D>B
Q   26D>B
R   27D>B
S   28D>B
T   29D>B
U   30D>B
V   31D>B
W   33D>B
X   33D>B
Y   A`\u
Z   A`u
[   84D>B
\   85D>B
]   86D>B
^   87D>B
_   88D>B
`   89D>B
a   A`r
b   A`r\
c   38D>B
d   39D>B
e   40D>B
f   41D>B
g   42D>B
h   43D>B
i   44D>B
j   45D>B
k   46D>B
l   47D>B
m   48D>B
n   49D>B
o   50D>B
p   51D>B
q   52D>B
r   53D>B
s   54D>B
t   55D>B
u   56D>B
v   57D>B
w   58D>B
x   A`\\
y   A`\
z   A`
{   90D>B
|   91D>B
}   92D>B
~   93D>B

Explanation

Most are 5 bytes long of the form: convert nr to base nr+1.

> needs an extra byte since we can't use increment for that.

a,b,x,y,z,Y,Z are extracted from A which contains the alphabet in lower case.

A,B,C,D,E,F are numbers converted to hex.

0-9 are simple increment/decrements as well as predefined variables.


答:
JavaScript (ES6), 77 <s>82 88</s>

EcmaScript 6 required just to save 1 byte using a template string literal for newline.

for(i=r=l=o='';l+52;r++||(r=l-=2,o+=`
`))o+=(i++%26+10).toString(36);alert(o)
```
<p><em>Less golfed</em></p>
<pre class="lang-js prettyprint-override"><code>for(i = r = l = o = '';
    l + 52;
    r++ || (r = l -= 2, o += `\n`))
  o += (i++ % 26 + 10).toString(36);
alert(o);
</code>```

Test

for(i=r=l=o='';l+52;r++||(r=l-=2,o+=`
`))o+=(i++%26+10).toString(36);alert(o)```

Title: Alphabet triangle strikes again

Body:
JavaScript (ES6), 77 <s>82 88</s>

EcmaScript 6 required just to save 1 byte using a template string literal for newline.

for(i=r=l=o='';l+52;r++||(r=l-=2,o+=`
`))o+=(i++%26+10).toString(36);alert(o)

Less golfed

for(i = r = l = o = '';
    l + 52;
    r++ || (r = l -= 2, o += `\n`))
  o += (i++ % 26 + 10).toString(36);
alert(o);

Test

for(i=r=l=o='';l+52;r++||(r=l-=2,o+=`
`))o+=(i++%26+10).toString(36);alert(o)


答:
Jelly, 6 bytes

```<code>ÆE÷ĊÆẸ
</code>```

Try it online! or verify all test cases.

How it works

```<code>ÆE÷ĊÆẸ  Main link. Arguments: x, y

ÆE      Yield the exponents of x's prime factorization.
  ÷     Divide them by y.
   Ċ    Ceil; round the quotients up to the nearest integer.
    ÆẸ  Return the integer with that exponents in its prime factorization.
</code>```

Body:
Jelly, 6 bytes

ÆE÷ĊÆẸ

Try it online! or verify all test cases.

How it works

ÆE÷ĊÆẸ  Main link. Arguments: x, y

ÆE      Yield the exponents of x's prime factorization.
  ÷     Divide them by y.
   Ċ    Ceil; round the quotients up to the nearest integer.
    ÆẸ  Return the integer with that exponents in its prime factorization.


答:
Jelly, 6 bytes

```<code>R*%⁸i0
</code>```

Try it online! or verify all test cases.

How it works

```<code>R*%⁸i0  Main link. Arguments: x, y

R       Yield range from 1 to x inclusive.
 *      Raise each to power y.
  %⁸    Take modulo of each with base x.
    i0  Find the 1-based index of the first
        occurence of zero, returns.
</code>```

Body:
Jelly, 6 bytes

R*%⁸i0

Try it online! or verify all test cases.

How it works

R*%⁸i0  Main link. Arguments: x, y

R       Yield range from 1 to x inclusive.
 *      Raise each to power y.
  %⁸    Take modulo of each with base x.
    i0  Find the 1-based index of the first
        occurence of zero, returns.


答:
MATL, 15 bytes

```<code>llli3-:"3$t/+]&
</code>```

Try it online!

Explanation

```<code>lll       % Push 1, 1, 1
i         % Take input n
3-:       % Pop n and push range [1 2 ... n-3] (empty if n<4)
"         % For each
  3$t     %    Duplicate the top three numbers in the stack
  /       %    Pop the top two numbers and push their division
  +       %    Pop the top two numbers and push their addition
]         % End
&         % Specify that the next function, which is implicit display, will take
          % only one input. So the top of the stack is displayed
</code>```

Title: The Piggyback Sequence

Body:
MATL, 15 bytes

llli3-:"3$t/+]&

Try it online!

Explanation

lll       % Push 1, 1, 1
i         % Take input n
3-:       % Pop n and push range [1 2 ... n-3] (empty if n<4)
"         % For each
  3$t     %    Duplicate the top three numbers in the stack
  /       %    Pop the top two numbers and push their division
  +       %    Pop the top two numbers and push their addition
]         % End
&         % Specify that the next function, which is implicit display, will take
          % only one input. So the top of the stack is displayed


答:
Haskell, 31 bytes

```<code>x#y=[n|n<-[1..],mod(n^y)x<1]!!0
</code>```

Usage example: 96#2 -> 24.

Direct implementation: try all integers n, keep those that meet the condition and pick the first one.

Body:
Haskell, 31 bytes

x#y=[n|n<-[1..],mod(n^y)x<1]!!0

Usage example: 96#2 -> 24.

Direct implementation: try all integers n, keep those that meet the condition and pick the first one.


问:
Shortest power set implementation

Problem definition

Print out the powerset of a given set. For example:

```<code>[1, 2, 3] => [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
</code>```

Each element is to be printed on a separate line, so the above example would be printed as:

```<code>[]
[1]
[2]
...
[1, 2, 3]
</code>```

Example code (in D, python example here):

```<code>import std.stdio;

string[][] powerset(string[] set) {
    if (set.length == 1) {
        return [set, []];
    }

    string[][] ret;
    foreach (item; powerset(set[1 .. $])) {
        ret ~= set[0]~item;
        ret ~= item;
    }

    return ret;
}

void main(string[] argv) {
    foreach (set; powerset(argv[1 .. $]))
        writeln(set);
}
</code>```

Input

Elements will be passed as arguments. For example, the example provided above would be passed to a program called powerset as:

```<code>powerset 1 2 3
</code>```

Arguments will be alphanumeric.

Rules

No libraries besides io

Output does not have to be ordered

Powerset does not have to be stored, only printed

Elements in the set must be delimited (e.g. 1,2,3, [1,2,3] and ['1','2','3'] are acceptable, but 123 is not

Trailing delimiters are fine (e.g. 1,2,3, == 1,2,3)

Best is determined based on number of bytes

The best solution will be decided no less than 10 days after the first submission.

答:
JavaScript, 98

Sadly, a good chunk is spent on output formatting.

```<code>for(n in a=eval(prompt(i=p=[[]])))
    for(j=i+1;j;)
        p[++i]=p[--j].concat(a[n]);
alert('[]'+p.join('\n'))
</code>```

Input

Takes a JavaScript array. (e.g. [1,2,3])

Output

```<code>[]
1
1,2
2
2,3
1,2,3
1,3
3
</code>```

Title: Shortest power set implementation

Body:
JavaScript, 98

Sadly, a good chunk is spent on output formatting.

for(n in a=eval(prompt(i=p=[[]])))
    for(j=i+1;j;)
        p[++i]=p[--j].concat(a[n]);
alert('[]'+p.join('\n'))

Input

Takes a JavaScript array. (e.g. [1,2,3])

Output

[]
1
1,2
2
2,3
1,2,3
1,3
3


Title: The Piggyback Sequence

Body:
Mathematica, 36 bytes

P@n_:=If[n<4,1,P[n-3]+P[n-2]/P[n-1]]

Here are the first few terms:

P /@ Range[10]
{1, 1, 1, 2, 3/2, 7/3, 37/14, 529/222, 38242/11109, 66065507/19809356}


答:
05AB1E (10 bytes)

```<code>>GN²m¹ÖiNq
</code>```

Try it online

> Reads the first argument, increments it, and pushes it on the stack

G pops the stack (a) and starts a loop that contains the rest of the program where N takes on the value 1, 2, ... a - 1.

N²m pushes N and the second entry from the input history, then pops them both and pushes the first to the power of the second.

¹ pushes the first entry from the input history onto the stack.

Ö pops the previous two stack entries, then pushes a % b == 0 on the stack.

i pops that from the stack. If true, it executes the rest of the program; otherwise, the loop continues.

N pushes N on the stack.

q terminates the program.

When the program terminates, the top value of the stack is printed.

Body:
Task

Given integers x and y which are both at least 2, find the smallest positive number whose y-th power is divisible by x.

Example

Given x=96 and y=2, the output should be 24 since 24 is the smallest positive n satisfying n^2 is divisible by 96.

Testcases

```<code>x  y output
26 2 26
96 2 24
32 3 4
64 9 2
27 3 3
</code>```

Scoring

This is code-golf. Solution with lowest byte-count wins.

References

y=2: OEIS A019554

y=3: OEIS A019555

y=4: OEIS A053166

y=5: OEIS A015052

y=6: OEIS A015054

Body:
05AB1E (10 bytes)

>GN²m¹ÖiNq

Try it online

> Reads the first argument, increments it, and pushes it on the stack

G pops the stack (a) and starts a loop that contains the rest of the program where N takes on the value 1, 2, ... a - 1.

N²m pushes N and the second entry from the input history, then pops them both and pushes the first to the power of the second.

¹ pushes the first entry from the input history onto the stack.

Ö pops the previous two stack entries, then pushes a % b == 0 on the stack.

i pops that from the stack. If true, it executes the rest of the program; otherwise, the loop continues.

N pushes N on the stack.

q terminates the program.

When the program terminates, the top value of the stack is printed.


答:
PHP 59 bytes

Sorry, but I can't test this from my mobile. :)

```<code>function blahblah($x,$y){
  for($i=0;1;$i++){
    if(!$i^$y%$x){
      return $i;
    }
  }
}
</code>```

Golfed

```<code>function b($x,$y){for($i=0;1;$i++){if(!$i^$y%$x)return $i;}
</code>```

Body:
PHP 59 bytes

Sorry, but I can't test this from my mobile. :)

function blahblah($x,$y){
  for($i=0;1;$i++){
    if(!$i^$y%$x){
      return $i;
    }
  }
}

Golfed

function b($x,$y){for($i=0;1;$i++){if(!$i^$y%$x)return $i;}


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

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

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

"A", whether uppercase or lowercase.

"U", whether lowercase or uppercase.

X, whether uppercase or lowercase.

+

&

#

0

1

4

5

6

7

9

Cheating, loopholes, etc, are not allowed.

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

Validity Checker

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

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

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

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

<h3>Leaderboard</h3>

<p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false">
<div class="snippet-code snippet-currently-hidden">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var QUESTION_ID=90349,OVERRIDE_USER=58717;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;</code>```

body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td>Link</td></tr></tbody> </table></code>```

答:
JavaScript (ES6), Uppercase, 34 30 bytes

1. I started from the answers of Conor O'Brien to get this:

```<code>_=>this[`${` ${-$}`[2]}tob`]("QQ")
</code>```

Since btoa("A") gives "QQ==", it's doing atob("QQ") wich gives "A".

2. Completing the answer of chronixlol :

```<code>_=>String.fromCodePoint(88-23)
</code>```

Title: The Letter A without A

Body:
JavaScript (ES6), Uppercase, 34 30 bytes

1. I started from the answers of Conor O'Brien to get this:

_=>this[`${` ${-$}`[2]}tob`]("QQ")

Since btoa("A") gives "QQ==", it's doing atob("QQ") wich gives "A".

2. Completing the answer of chronixlol :

_=>String.fromCodePoint(88-23)


答:
05AB1E, 8 bytes

```<code>Lsm¹%0k>
</code>```

Explanation

```<code>L         # range(1,x) inclusive
 sm       # each to the power of y
   ¹%     # each mod x
     0k   # find first index of 0 (0-based)
       >  # increment to 1-based
</code>```

Try it online

Body:
05AB1E, 8 bytes

Lsm¹%0k>

Explanation

L         # range(1,x) inclusive
 sm       # each to the power of y
   ¹%     # each mod x
     0k   # find first index of 0 (0-based)
       >  # increment to 1-based

Try it online


答:
Dyalog APL, 25 bytes

⊃{1↓⍵,⍎⍕' +÷',¨⍵}⍣⎕⊢0 1 1

Title: The Piggyback Sequence

Body:
I made my own sequence recently (called the Piggyback sequence), and it works like this:

P(1), P(2) and P(3) = 1.

For all P(n) where n>3, the sequence works like this:

```<code>P(n) = P(n-3) + P(n-2)/P(n-1)
</code>```

So, continuing the sequence:

P(4) = 1 + 1/1 = 2

P(5) = 1 + 1/2 = 3/2
= 1.5

P(6) = 1 + 2/(3/2) = 7/3
= 2.33333...

P(7) = 2 + (3/2)/(7/3) = 37/14 = 2.6428571428...

P(8) = 3/2 + (7/3)/(37/14) = 529/222
= 2.3828828828...

Your task is, when given n, calculate P(n) either as a floating point number or an (im)proper fraction.

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

If anyone can find the name of the sequence, please edit the post accordingly.

Current leaders: MATL and Jelly (both at 15 bytes).


问:
Paint a still life (or a moving one) - draw an image in the Game of Life
You are given as input a greyscale image. Your task is to find a static or looping pattern in Conway's Game of Life that resembles the input image as closely as possible.

Your output can be either a still image or a looping animation in some format that can be converted to gif. The output image dimensions should be the same as the input, and it must contain only black and white pixels.

If the output is an animation, each frame must be generated from the previous one according to the Game of Life rules, with one cell per pixel. The animation must loop, with the first frame being generated from the last frame by the same rules.

If the output is a still image, applying the game-of-life rules to it must produce the same image. This means that no 'alive' cell may have more than three or less than two 'alive' neighbours, and no 'dead' cell may have exactly three 'alive' neighbours. (Note that this is basically the same as an animation as described above, but with only one frame.)

Extra rules and clarifications:

You (or your program) may choose whether 'alive' cells are represented as white and 'dead' as black, or vice versa. That is, you can either hard-code this or your program can choose it based on the input image. (But it must be the same for every frame of the animation.)

The boundary conditions should be periodic, meaning that cells on the rightmost column have neighbours on the leftmost column, etc.

For animations, the frame rate is up to you (or your program); I imagine fast frame rates will work well for approximating grey pixels.

Please post at least two results embedded in your answer. If you can post results from all of the input images below, it's preferable.

It is acceptable to scale down the test images if this is necessary in order to achieve gifs with small enough file sizes. If you want to link to larger files as well, that's fine. If you want to show off, feel free to find some higher-resolution source files.

Please try to avoid having too many controllable parameters in your code - it's best if your program's only input is the image. The exception is if you want to have a parameter for controlling the number of animation frames, since that will affect the file size.

You may use external programs to change the format of the input and output files, and/or compile output frames into an animation if you want. (This is not a file-format-handling challenge.)

This is popularity-contest, so the answer with the most votes wins.

Here is a selection of test images, mostly taken from other questions on this site. (It's possible that I will add additional "bonus" input images later.)

Just to get things started, here's a very dumb reference attempt in Python 2, which takes advantage of the fact that a block of four squares is a stable structure in the Game of Life. It just rescales the input image by a factor of 4, then draws a block if the corresponding pixel is darker than 0.5.

```<code>from skimage import io
from skimage import transform
import sys

img = io.imread(sys.argv[1],as_grey=True)

source = transform.resize(img, [i/4 for i in img.shape])

img[:]=1
for x in xrange(source.shape[0]):
    for y in xrange(source.shape[1]):
        if source[x,y]<0.5:
            img[x*4, y*4] = 0
            img[x*4+1, y*4] = 0
            img[x*4, y*4+1] = 0
            img[x*4+1, y*4+1] = 0

io.imsave(sys.argv[2], img)
</code>```

Here are some outputs from the example code. I'm sure that much better results are possible.

答:
C++

Straightforward pixelation approach using the average of each 8x8 grid to select an 8x8 output grid (a "color texture").  Each 8x8 output grid has a 2 cell separator at the top and right.  Grids were designed ranging from 4 cell still lifes to 18 cell still lifes within the remaining 6x6 pixels.

The program acts as a filter from binary PGM to binary PBM.  By default, images are "dark"; black is death and white is life; -i inverts this.  -g [value] adds a gamma, which is used to pre-weight averages before selecting the color textures.

```<code>#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>

// colors 4 through 18 have 4 through 18 live cells
// colors 1-3 are repetitions of 0 or 4 used
// as artificially weighted bins
unsigned char gol_colors[]={
      0,  0,  0,  0,  0,  0,  0,  0 // Color  0
   ,  0,  0,  0,  0,  0,  0,  0,  0 // Color  1
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  2
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  3
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  4
   ,  0,  0,  0, 24, 40, 16,  0,  0 // Color  5
   ,  0,  0,  0, 16, 40, 80, 32,  0 // Color  6
   ,  0,  0,  0, 48, 72, 40, 16,  0 // Color  7
   ,  0,  0,  8, 20,  8, 64,160, 64 // Color  8
   ,  0,  0,  8, 20,  8, 64,160, 96 // Color  9
   ,  0,  0, 12, 20,  8, 64,160, 96 // Color 10
   ,  0,  0, 12, 20,  8,192,160, 96 // Color 11
   ,  0,  0,204,204,  0,  0, 48, 48 // Color 12
   ,  0,  0,204,204,  0,192,160, 64 // Color 13
   ,  0,  0,  0,108,168,168,108,  0 // Color 14
   ,  0,  0, 96,144,104, 40,172,192 // Color 15
   ,  0,  0,204,204,  0,  0,204,204 // Color 16
   ,  0,  0,216,216,  0,216,212,  8 // Color 17
   ,  0,  0,204,164, 40, 80,148,204 // Color 18
};

enum { gol_bins = sizeof(gol_colors)/(sizeof(*gol_colors))/8 };

bool inverted=false;

bool applygamma=false;
double gammasetting=0.0;

unsigned int corrected(unsigned int i, unsigned int r) {
   return static_cast<unsigned int>(r*std::pow(i/static_cast<double>(r), gammasetting));
}

int main(int argc, char** argv) {
   std::vector<unsigned short> pgm_data;
   unsigned pgm_width;
   unsigned pgm_height;
   unsigned pgm_vpp;

   std::vector<unsigned char> pbm_data;
   unsigned pbm_width;
   unsigned pbm_height;

   unsigned int doublings=0;

   std::vector<std::string> args(argv+1, argv+argc);
   for (unsigned int i=0, e=args.size(); i<e; ++i) {
      if (args[i]=="-i") { inverted=true; continue; }
      if (args[i]=="-g") {
         if (i+1==e) continue;
         std::stringstream ss;
         ss << args[++i];
         if (ss >> gammasetting) applygamma = true;
         continue;
      }
   }

   std::string line;
   std::getline(std::cin, line);
   if (line!="P5") return 1;
   enum { nothing, have_w, have_h, have_bpp } readstate = nothing;
   while (std::cin) {
      std::getline(std::cin, line);
      if (line.empty()) continue;
      if (line[0]=='#') continue;
      std::stringstream ss; ss << line;
      for(;;) {
         switch (readstate) {
         case nothing: if (ss >> pgm_width) readstate = have_w; break;
         case have_w:  if (ss >> pgm_height) readstate = have_h; break;
         case have_h:  if (ss >> pgm_vpp) readstate = have_bpp; break;
         }
         if (readstate==have_bpp) break;
         if (ss) continue;
         break;
      }
      if (readstate==have_bpp) break;
   }
   if (readstate!=have_bpp) return 1;
   // Fill pgm data
   pgm_data.resize(pgm_width*pgm_height);
   for (unsigned i=0, e=pgm_width*pgm_height; i<e; ++i) {
      int v = std::cin.get();
      if (v==std::char_traits<char>::eof()) return 1;
      pgm_data[i] = static_cast<unsigned int>(std::char_traits<char>::to_char_type(v))&0xFFU;
   }
   pbm_width  = pgm_width/8*8;
   pbm_height = pgm_height/8*8;
   pbm_data.resize(pbm_width*pbm_height/8);
   for (unsigned x=0, xe=pbm_width/8; x<xe; ++x) {
      for (unsigned y=0, ye=pbm_height/8; y<ye; ++y) {
         // Calculate the average of this 8x8 area
         unsigned int total=0;
         for (unsigned int xd=0; xd<8; ++xd) {
            for (unsigned int yd=0; yd<8; ++yd) {
               unsigned int c = x+xd+(y+yd)*pgm_width;
               unsigned int pv = pgm_data[x*8+xd+(y*8+yd)*pgm_width];
               // Apply gamma prior to averaging
               if (applygamma) pv=corrected(pv, pgm_vpp);
               total += pv;
            }
         }
         total /= 64;
         // Invert average if inverting colors (white on black)
         if (inverted) total=pgm_vpp-total;
         total *= gol_bins;
         total /= (pgm_vpp+1);
         // Fill 8x8 areas with gol color texture
         for (unsigned int yd=0; yd<8; ++yd) {
            pbm_data[x+(y*8+yd)*pbm_width/8] = gol_colors[total*8+yd];
         }
      }
   }
   // Now, write a pbm
   std::cout
      << "P4\n"
      << "# generated by pgm2gol\n"
      << pbm_width << " " << pbm_height << "\n";
   for (unsigned i=0, e=pbm_data.size(); i<e; ++i) {
      unsigned char data=pbm_data[i];
      if (!inverted) { data=pbm_data[i]^0xFF; }
      std::cout.put(data);
   }
}
</code>```

Selected results (note: all pbm's were converted to png's using a third party program for upload):

Escher, gamma 2.2

Mona Lisa, gamma 2.2

Ocean, gamma 2.2 inverted

Puppy, gamma 2.2

Treachery of Images, gamma 2.2 inverted

Mona Lisa gamma 2.2, inverted, for comparison

Body:
C++

Straightforward pixelation approach using the average of each 8x8 grid to select an 8x8 output grid (a "color texture").  Each 8x8 output grid has a 2 cell separator at the top and right.  Grids were designed ranging from 4 cell still lifes to 18 cell still lifes within the remaining 6x6 pixels.

The program acts as a filter from binary PGM to binary PBM.  By default, images are "dark"; black is death and white is life; -i inverts this.  -g [value] adds a gamma, which is used to pre-weight averages before selecting the color textures.

#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>

// colors 4 through 18 have 4 through 18 live cells
// colors 1-3 are repetitions of 0 or 4 used
// as artificially weighted bins
unsigned char gol_colors[]={
      0,  0,  0,  0,  0,  0,  0,  0 // Color  0
   ,  0,  0,  0,  0,  0,  0,  0,  0 // Color  1
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  2
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  3
   ,  0,  0,  0, 16, 40, 16,  0,  0 // Color  4
   ,  0,  0,  0, 24, 40, 16,  0,  0 // Color  5
   ,  0,  0,  0, 16, 40, 80, 32,  0 // Color  6
   ,  0,  0,  0, 48, 72, 40, 16,  0 // Color  7
   ,  0,  0,  8, 20,  8, 64,160, 64 // Color  8
   ,  0,  0,  8, 20,  8, 64,160, 96 // Color  9
   ,  0,  0, 12, 20,  8, 64,160, 96 // Color 10
   ,  0,  0, 12, 20,  8,192,160, 96 // Color 11
   ,  0,  0,204,204,  0,  0, 48, 48 // Color 12
   ,  0,  0,204,204,  0,192,160, 64 // Color 13
   ,  0,  0,  0,108,168,168,108,  0 // Color 14
   ,  0,  0, 96,144,104, 40,172,192 // Color 15
   ,  0,  0,204,204,  0,  0,204,204 // Color 16
   ,  0,  0,216,216,  0,216,212,  8 // Color 17
   ,  0,  0,204,164, 40, 80,148,204 // Color 18
};

enum { gol_bins = sizeof(gol_colors)/(sizeof(*gol_colors))/8 };

bool inverted=false;

bool applygamma=false;
double gammasetting=0.0;

unsigned int corrected(unsigned int i, unsigned int r) {
   return static_cast<unsigned int>(r*std::pow(i/static_cast<double>(r), gammasetting));
}

int main(int argc, char** argv) {
   std::vector<unsigned short> pgm_data;
   unsigned pgm_width;
   unsigned pgm_height;
   unsigned pgm_vpp;

   std::vector<unsigned char> pbm_data;
   unsigned pbm_width;
   unsigned pbm_height;

   unsigned int doublings=0;

   std::vector<std::string> args(argv+1, argv+argc);
   for (unsigned int i=0, e=args.size(); i<e; ++i) {
      if (args[i]=="-i") { inverted=true; continue; }
      if (args[i]=="-g") {
         if (i+1==e) continue;
         std::stringstream ss;
         ss << args[++i];
         if (ss >> gammasetting) applygamma = true;
         continue;
      }
   }

   std::string line;
   std::getline(std::cin, line);
   if (line!="P5") return 1;
   enum { nothing, have_w, have_h, have_bpp } readstate = nothing;
   while (std::cin) {
      std::getline(std::cin, line);
      if (line.empty()) continue;
      if (line[0]=='#') continue;
      std::stringstream ss; ss << line;
      for(;;) {
         switch (readstate) {
         case nothing: if (ss >> pgm_width) readstate = have_w; break;
         case have_w:  if (ss >> pgm_height) readstate = have_h; break;
         case have_h:  if (ss >> pgm_vpp) readstate = have_bpp; break;
         }
         if (readstate==have_bpp) break;
         if (ss) continue;
         break;
      }
      if (readstate==have_bpp) break;
   }
   if (readstate!=have_bpp) return 1;
   // Fill pgm data
   pgm_data.resize(pgm_width*pgm_height);
   for (unsigned i=0, e=pgm_width*pgm_height; i<e; ++i) {
      int v = std::cin.get();
      if (v==std::char_traits<char>::eof()) return 1;
      pgm_data[i] = static_cast<unsigned int>(std::char_traits<char>::to_char_type(v))&0xFFU;
   }
   pbm_width  = pgm_width/8*8;
   pbm_height = pgm_height/8*8;
   pbm_data.resize(pbm_width*pbm_height/8);
   for (unsigned x=0, xe=pbm_width/8; x<xe; ++x) {
      for (unsigned y=0, ye=pbm_height/8; y<ye; ++y) {
         // Calculate the average of this 8x8 area
         unsigned int total=0;
         for (unsigned int xd=0; xd<8; ++xd) {
            for (unsigned int yd=0; yd<8; ++yd) {
               unsigned int c = x+xd+(y+yd)*pgm_width;
               unsigned int pv = pgm_data[x*8+xd+(y*8+yd)*pgm_width];
               // Apply gamma prior to averaging
               if (applygamma) pv=corrected(pv, pgm_vpp);
               total += pv;
            }
         }
         total /= 64;
         // Invert average if inverting colors (white on black)
         if (inverted) total=pgm_vpp-total;
         total *= gol_bins;
         total /= (pgm_vpp+1);
         // Fill 8x8 areas with gol color texture
         for (unsigned int yd=0; yd<8; ++yd) {
            pbm_data[x+(y*8+yd)*pbm_width/8] = gol_colors[total*8+yd];
         }
      }
   }
   // Now, write a pbm
   std::cout
      << "P4\n"
      << "# generated by pgm2gol\n"
      << pbm_width << " " << pbm_height << "\n";
   for (unsigned i=0, e=pbm_data.size(); i<e; ++i) {
      unsigned char data=pbm_data[i];
      if (!inverted) { data=pbm_data[i]^0xFF; }
      std::cout.put(data);
   }
}

Selected results (note: all pbm's were converted to png's using a third party program for upload):

Escher, gamma 2.2

Mona Lisa, gamma 2.2

Ocean, gamma 2.2 inverted

Puppy, gamma 2.2

Treachery of Images, gamma 2.2 inverted

Mona Lisa gamma 2.2, inverted, for comparison


答:
Mathematica, 36 bytes

```<code>(i=1;While[n=i++;Mod[n^#2,#]!=0];n)&
</code>```

Body:
Mathematica, 36 bytes

(i=1;While[n=i++;Mod[n^#2,#]!=0];n)&


答:
JavaScript (ES7), 32 bytes

```<code>f=(x,y,i=1)=>i**y%x?f(x,y,i+1):i
</code>```

Body:
JavaScript (ES7), 32 bytes

f=(x,y,i=1)=>i**y%x?f(x,y,i+1):i


问:
Implement this key cipher

Implement this key cipher

Goal

Use the algorithm (explained in the Algorithm section) to implement a certain cipher.

The program must read input from STDIN or the closest available equivalent, use the algorithm to generate the ciphertext and a key.

The ciphertext and the key will be written to STDOUT or the closest available equivalent. Any format is allowed, as long as it outputs the ciphertext and the key.

Algorithm

Convert the characters in the string into the respective ASCII values. For example:

Hello -> 72 101 108 108 111

Next, you will need to generate a key as long as the string with random numbers in the range of 0-9.

Hello -> 62841

Add the integers in the random number sequence to the ASCII values of the string. In the above examples, 72 would become 78, and 101 would become 104.

72 + 6 = 78, 101 + 2 = 103, 108 + 8 = 116, etc

Next, convert the new values back to characters. In the above examples, the text Hello has become Ngtpp.

Examples

(These are simply examples of what the output might look like. The output can and will vary.)

```<code>Hello World

Lfrlu)_supg
41606984343
</code>```

```<code>This will be encoded

Zhjs$~koo gj$iuhofgj
60104723305544750226
</code>```

Rules

You can assume that the input will only contain characters in the range a-z, A-Z, and spaces.

Submissions must be full programs or functions.

Submissions will be scored in bytes.

Standard loopholes are forbidden.

This is code-golf, so the shortest code wins.

(This is one of my first challenges, if there's something wrong with it, feel free to tell me how I could improve it.)

答:
Senva, 74 bytes

Here is the shortest program I've made :

```<code>2'(`>0.>{@}0'{v}2-2'0,{@}1'{v}0'{+}{'}9%+{^}{1-}1'"{+}{~}>$10.~0'2+"0,-:>$
</code>```

A little explanation ? (Note: BM means Back-Memory) :

```<code>// === Input and informations storing ===

2'  // Go to the 3rd cell (the two first will be used to store informations)
(   // Ask the user for a string (it will be stored as a suite of ASCII codes)
`   // Go the end of the string
>   // Make a new cell
0.  // Put a 0 to mark the end of the string
>   // Make a new cell, here will be stored the first random number
{@} // Store its adress in BM
0'  // Go to the 1st cell
{v} // Paste the adress, now the 1st cell contains the adress of the first random number
2-  // Subtract 2 because the string starts at adress 2 (the 3rd cell)
2'  // Go to the 3rd cell (where the string begins)

// === String encryption and displaying ===

0,  // While the current cell doesn't contain 0 (while we didn't reach the string's end)
  {@}  // Store the character's adress into the memory
  1'   // Go to the 2nd cell
  {v}  // Paste the value, now the 1st cell contains the adress of the current char
  0'   // Go to the 1st cell
  {+}  // Add the adress of the first random number to the current char adress
  {'}  // Go to this adrses
  9%+  // A random number between 0 and 10
  {^}  // Store this number in BM
  {1-} // Decrease BM (random number between 0 and 9)
  1'   // Go to the 1st cell
  "    // Go to the adress pointed by the cell (the adress of the current char)
  {+}  // Add it to the random number value
  {~}  // Display it as an ASCII character
  >    // Go to the next cell (the next character)
$   // End of the loop
10. // Set the new line's ASCII code into the current cell (which is now useless, so it can be overwritten)
~   // Display the new line
0'  // Go to the first cell
2+  // Add 2 to the adress, because we are not in the string loop : we cancel the 2 substraction
"   // Go to the pointed adress (the first random number's one)

// === Display the random numbers ===

0,  // While we didn't reach the end of the random numbers suite
    // That was why I stored numbers between 1 and 10, the first equal to 0 will be the end of the suite
  - // Decrease it (number between 0 and 9)
  : // Display the current random number as an integer
  > // Go to the next cell (the next number)
$ // End of the loop
</code>```

That appears bigger now, true :p ? Maybe it's possible to optimize this code, but for the moment that's the shortest I've found.

Title: Implement this key cipher

Body:
Senva, 74 bytes

Here is the shortest program I've made :

2'(`>0.>{@}0'{v}2-2'0,{@}1'{v}0'{+}{'}9%+{^}{1-}1'"{+}{~}>$10.~0'2+"0,-:>$

A little explanation ? (Note: BM means Back-Memory) :

// === Input and informations storing ===

2'  // Go to the 3rd cell (the two first will be used to store informations)
(   // Ask the user for a string (it will be stored as a suite of ASCII codes)
`   // Go the end of the string
>   // Make a new cell
0.  // Put a 0 to mark the end of the string
>   // Make a new cell, here will be stored the first random number
{@} // Store its adress in BM
0'  // Go to the 1st cell
{v} // Paste the adress, now the 1st cell contains the adress of the first random number
2-  // Subtract 2 because the string starts at adress 2 (the 3rd cell)
2'  // Go to the 3rd cell (where the string begins)

// === String encryption and displaying ===

0,  // While the current cell doesn't contain 0 (while we didn't reach the string's end)
  {@}  // Store the character's adress into the memory
  1'   // Go to the 2nd cell
  {v}  // Paste the value, now the 1st cell contains the adress of the current char
  0'   // Go to the 1st cell
  {+}  // Add the adress of the first random number to the current char adress
  {'}  // Go to this adrses
  9%+  // A random number between 0 and 10
  {^}  // Store this number in BM
  {1-} // Decrease BM (random number between 0 and 9)
  1'   // Go to the 1st cell
  "    // Go to the adress pointed by the cell (the adress of the current char)
  {+}  // Add it to the random number value
  {~}  // Display it as an ASCII character
  >    // Go to the next cell (the next character)
$   // End of the loop
10. // Set the new line's ASCII code into the current cell (which is now useless, so it can be overwritten)
~   // Display the new line
0'  // Go to the first cell
2+  // Add 2 to the adress, because we are not in the string loop : we cancel the 2 substraction
"   // Go to the pointed adress (the first random number's one)

// === Display the random numbers ===

0,  // While we didn't reach the end of the random numbers suite
    // That was why I stored numbers between 1 and 10, the first equal to 0 will be the end of the suite
  - // Decrease it (number between 0 and 9)
  : // Display the current random number as an integer
  > // Go to the next cell (the next number)
$ // End of the loop

That appears bigger now, true :p ? Maybe it's possible to optimize this code, but for the moment that's the shortest I've found.


问:
Enterprise Quality Code Prime Sieve

Enterprise Quality Code!

TL;DR

Answers will consist of a full program (of length < 30k) prints the the first N Prime numbers (as a base 10 representation without leading zeros unless the chosen language only supports unary or other based output) separated by newlines (optional trailing linefeed).

You may post cracks at any time, but you must wait one hour after posting each initial bowled submission

Leading or trailing whitespace is not acceptable (except for the trailing newline)

An answer's score is the number of bytes in the answer. A user's score is the total number of bytes of all uncracked answers.

An answer gets cracked when another user posts an answer (in the same language) which is a permutation of any subset of the characters used in the original answer.

The user with the highest score will receive an accepted tick mark on his /her highest scoring post (although it doesnt really matter which specific post gets the tick)

The Inspiration for this challenge

At Pretty Good consultants there is a focus on writing "quality" verbose code that is sufficiently engineered. Your boss has decided to test you on your skills.

Consider the set of all programming languages in existence before the posting of this challenge. For this challenge there will technically be one individual "winner" in each language, however the boss will give a <s>promotion</s> accepted tick mark to only one answer based on your score.

Detailed Spec

The goal of this challenge is to receive an integer N strictly smaller than 2^8-1 and print the first N prime numbers (in less than 24 hours) separated by your platforms choice of new line (a trailing newline is optional). OEIS sequence A000040 in as many bytes as possible in as many languages as possible. However, note that others vying for the promotion will try to "help" you by golfing down your score. (Please note that your prime generation function should theoretically work for integer N inputs strictly smaller than 2^16-1 given enough time, the bounds for N have been reduced after realizing how slow some interpreters are (namely mine) hardcoding the list of primes is strictly forbidden)

Sample output for an input 11

```
2
3
5
7
11
13
17
19
23
29
31
```

How to participate

Pick any language X, but please avoid selecting a language which is just another version or derivative of another answer.
If there is no existing answer in language X than you will write a program (which must fit into a single post I.E it must be less than 30k characters) that solves this challenge.
The length in bytes of the source (in any reasonable preexisting textual encoding) will be added to your score. You must avoid using any unnecessary characters for reasons that will soon become apparent.

If language X already has been used to answer this question, then you must answer using any permutation of any proper subset of the characters used in the shortest answer (I.E take the shortest X answer and remove some (>=1) characters and optionally rearrange the resulting code). The previous holder of the shortest X answer will lose all of the bytes provided by his answer from his score, and the number of bytes of your submission will now be added to your score. The number of bytes golfed off gets "lost" forever.

Rules for Languages

You may only crack a submission by posting an answer in the same language (and version), but you are barred from posting an answer in language X if there exists a submission in a sufficiently similar language Y. Please do not abuse this rule posting an answer in a sufficiently similar language will receive disqualification.

Below is a leader board which removes answers with "cracked" (with any case) in their header.

var QUESTION_ID=90593,OVERRIDE_USER=46918;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 a-r});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<>]+>)^(?:(?!cracked)\i.)*[^\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

```

答:
S.I.L.O.S, 163 bytes

```<code>readIO :
a = 2
lblM
b = i
b - y
if b c
GOTO E
lblc
d = 2
lblI
c = a
c - d
c - 1
if c d
y + 1
printInt a
GOTO i
lbld
z = a
z % d
d + 1
if z I
lbli
a + 1
GOTO M
lblE
</code>```

Nothing in particular was done to arbitrarily lengthen this code, but it should remain safe. (Emphasis on "should")

Feel free to try this code online!

Title: Enterprise Quality Code Prime Sieve

Body:
S.I.L.O.S, 163 bytes

readIO :
a = 2
lblM
b = i
b - y
if b c
GOTO E
lblc
d = 2
lblI
c = a
c - d
c - 1
if c d
y + 1
printInt a
GOTO i
lbld
z = a
z % d
d + 1
if z I
lbli
a + 1
GOTO M
lblE

Nothing in particular was done to arbitrarily lengthen this code, but it should remain safe. (Emphasis on "should")

Feel free to try this code online!


问:
Number Plate Golf: Parsing
See Also: Recognition

Introduction

You've now been taken off the speed camera development team (let's face it, your code is nowhere near production code standards) and are now working on a program to extract information about the car from the number plates. Of course, you've caught the code golf bug and want to write the program in as few bytes as possible.

Challenge

Given a valid, British number plate, display information about the car's registration.

You only have to support number plates registered between 2001 and 2051 (inclusive).

Internet access is disallowed.

The input will be given as a string.

Number Plates

British number plates are ordered like so:

Area code

A table with all of the area code mnemonics which you need to support can be found here.

For the letter X, you only need to output Personal Export due to multiple areas being covered by the same mnemonic.

You must output the DVLA office name.

Age Identifier

Similarly, a table with all of the age identifiers which you need to support can be found here.

If the identifier is in the range Y to 50 inclusive, you must output:

```<code>1/3/[Year] to 31/8/[Year]
</code>```

Likewise, if the identifier is in the range 51 to 00 inclusive, you must output:

```<code>1/9/[Year] to [28/29]/2/[Year + 1]
</code>```

You should support leap years.

Examples

WK94 FRS

```<code>Truro, 1/9/2044 to 28/2/2045
</code>```

CB16 BTD

```<code>Bangor, 1/3/2016 to 31/8/2016
</code>```

BD51 SMR

```<code>Birmingham, 1/9/2011 to 29/2/2012
</code>```

XAY EEA

```<code>Personal Export, 1/3/2001 to 31/8/2001
</code>```

Scoring

The shortest code in bytes wins

答:
Ruby, 629 bytes

```<code>s=gets
p=c=0
'PETeRborOuGh
NORWich
IPSwicH
BIRMiNGHam
CARdiff
SWANsea
BAngOr
CHEsTer
SHREWsbURY
CHELmSFOrd
NOTTInGHAm
LInCOlN
MAIDStone
BRIgHtON
BOURNEMoUth
PORTSMoUth
ISLE OF WIGHt
PORtSmOUtH
BOREHAMwoOD
NORTHAmPton
WIMBLeDoN
BOREHAMwOoD
SIdcup
MANChESTer
NEWCAstle
STOcKtON
oXFOrd
PReStON
CArlISlE
ReADIng
GLAsGoW
EDINBUrGh
DUNdEe
ABERDEen
INvErNEsS
WORcESTer
EXeTeR
TRUro
BRiStoL
PERSONAL eXPOrt
LeEds
SHEFFiElD
BEVERLEY'.split($/).map{|w|c<s[0,2].to_i(35)&&p=w;d=0;w.bytes{|b|d+=d+b/95};c+=d}
y=(?1+s[2,9]).to_i-1
puts p.capitalize+", 1/%d/20%02d to %d/%d/20%02d"%[z=3+y%100/50*6,1+y%=50,z<4?31:y%4==2?29:28,(z+5)%12,1+y+z/9]
</code>```

The first two letters are interpreted as a base 35 number and then looked up to find the correct town. The quantity of addresses assigned to each town is encoded (run-length encoding) in the captialization of each town in binary, where uppercase=0 and lowercase=1.

In order to handle the Y age indicator for the first half of 2001, a 1 is prepended to the age. Thus 1 Y is interpreted by .to_i as 1, and 1 02 is interpreted as 102. 1 is subtracted (to handle the wraparound for 2050) and taken modulo 100 to decide which half of the year we are in. It is then taken modulo 50 (and the 1 added on again) to find the year.

Title: Number Plate Golf: Parsing

Body:
Ruby, 629 bytes

s=gets
p=c=0
'PETeRborOuGh
NORWich
IPSwicH
BIRMiNGHam
CARdiff
SWANsea
BAngOr
CHEsTer
SHREWsbURY
CHELmSFOrd
NOTTInGHAm
LInCOlN
MAIDStone
BRIgHtON
BOURNEMoUth
PORTSMoUth
ISLE OF WIGHt
PORtSmOUtH
BOREHAMwoOD
NORTHAmPton
WIMBLeDoN
BOREHAMwOoD
SIdcup
MANChESTer
NEWCAstle
STOcKtON
oXFOrd
PReStON
CArlISlE
ReADIng
GLAsGoW
EDINBUrGh
DUNdEe
ABERDEen
INvErNEsS
WORcESTer
EXeTeR
TRUro
BRiStoL
PERSONAL eXPOrt
LeEds
SHEFFiElD
BEVERLEY'.split($/).map{|w|c<s[0,2].to_i(35)&&p=w;d=0;w.bytes{|b|d+=d+b/95};c+=d}
y=(?1+s[2,9]).to_i-1
puts p.capitalize+", 1/%d/20%02d to %d/%d/20%02d"%[z=3+y%100/50*6,1+y%=50,z<4?31:y%4==2?29:28,(z+5)%12,1+y+z/9]

The first two letters are interpreted as a base 35 number and then looked up to find the correct town. The quantity of addresses assigned to each town is encoded (run-length encoding) in the captialization of each town in binary, where uppercase=0 and lowercase=1.

In order to handle the Y age indicator for the first half of 2001, a 1 is prepended to the age. Thus 1 Y is interpreted by .to_i as 1, and 1 02 is interpreted as 102. 1 is subtracted (to handle the wraparound for 2050) and taken modulo 100 to decide which half of the year we are in. It is then taken modulo 50 (and the 1 added on again) to find the year.


答:
XPath 3.0 (and XQuery 3.0), 84 bytes

```<code>codepoints-to-string((0 to 25)!(subsequence(((1 to 26)!(65 to 90)),.*.+1,2*.+1),10))
</code>```

Explanation:

(1 to 26)!(65 to 90) is the alphabet 26 times

(0 to 25)!(subsequence(XX, start, len),10) takes 26 subsequences of this, each followed by newline

subsequence(X, .*.+1, 2*.+1) takes successive subsequences with start position and length: (1, 1), (2, 3), (5, 5), (10, 9) etc.

codepoints-to-string() turns Unicode codepoints into characters

Title: Alphabet triangle strikes again

Body:
Task

Your task is to print this exact text:

```<code>A
BCD
EFGHI
JKLMNOP
QRSTUVWXY
ZABCDEFGHIJ
KLMNOPQRSTUVW
XYZABCDEFGHIJKL
MNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLM
NOPQRSTUVWXYZABCDEFGHIJKLMN
OPQRSTUVWXYZABCDEFGHIJKLMNOPQ
RSTUVWXYZABCDEFGHIJKLMNOPQRSTUV
WXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC
DEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL
MNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW
XYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ
KLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXY
ZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOP
QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI
JKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCD
EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA
BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
</code>```

Specs

You may do it in all-lowercase instead of all-uppercase.

Trailing newlines at the end of the triangle is allowed.

Trailing spaces after each line is allowed.

You must print to STDOUT instead of outputting an array of strings.

Scoring

This is code-golf. Program with lowest byte-count wins.

Body:
XPath 3.0 (and XQuery 3.0), 84 bytes

codepoints-to-string((0 to 25)!(subsequence(((1 to 26)!(65 to 90)),.*.+1,2*.+1),10))

Explanation:

(1 to 26)!(65 to 90) is the alphabet 26 times

(0 to 25)!(subsequence(XX, start, len),10) takes 26 subsequences of this, each followed by newline

subsequence(X, .*.+1, 2*.+1) takes successive subsequences with start position and length: (1, 1), (2, 3), (5, 5), (10, 9) etc.

codepoints-to-string() turns Unicode codepoints into characters


问:
Square free Numbers
Given a number N, write the shortest complete program to find the number of square-free integers below N.

```<code>Sample Input
100000
Sample Output
60794
</code>```

Constraints:

Should work for all positive N below 1,000,000

Should not take more than 10 secs.

Please do not use built in functions, please.

ContentLicense: CC BY-SA 2.5

Title: Square free Numbers

Body:
J, 21 chars

+/(]=&#~.)@:q:"0>:i.N

Checks for each integer from 1 to N if any prime factor appears more than once.

eg:

+/(]=&#~.)@:q:"0>:i.10000
 6083
+/(]=&#~.)@:q:"0>:i.100000
 60794

Takes ~3secs for N=1,000,000 (@2GHz,1core)


答:
Python, 93 87 chars

Python makes formatting simple, because the required input/output matches its native format.

Only supports items which are Python literals (e.g. 1,2,'hello', not 1,2,hello).

Reads standard input, not parameters.

```<code>f=lambda x:x and f(x[1:])+[x[:1]+a for a in f(x[1:])]or[()]
for l in f(input()):print l
</code>```

Title: Shortest power set implementation

Body:
Problem definition

Print out the powerset of a given set. For example:

```<code>[1, 2, 3] => [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
</code>```

Each element is to be printed on a separate line, so the above example would be printed as:

```<code>[]
[1]
[2]
...
[1, 2, 3]
</code>```

Example code (in D, python example here):

```<code>import std.stdio;

string[][] powerset(string[] set) {
    if (set.length == 1) {
        return [set, []];
    }

    string[][] ret;
    foreach (item; powerset(set[1 .. $])) {
        ret ~= set[0]~item;
        ret ~= item;
    }

    return ret;
}

void main(string[] argv) {
    foreach (set; powerset(argv[1 .. $]))
        writeln(set);
}
</code>```

Input

Elements will be passed as arguments. For example, the example provided above would be passed to a program called powerset as:

```<code>powerset 1 2 3
</code>```

Arguments will be alphanumeric.

Rules

No libraries besides io

Output does not have to be ordered

Powerset does not have to be stored, only printed

Elements in the set must be delimited (e.g. 1,2,3, [1,2,3] and ['1','2','3'] are acceptable, but 123 is not

Trailing delimiters are fine (e.g. 1,2,3, == 1,2,3)

Best is determined based on number of bytes

The best solution will be decided no less than 10 days after the first submission.

Body:
Python, 93 87 chars

Python makes formatting simple, because the required input/output matches its native format.

Only supports items which are Python literals (e.g. 1,2,'hello', not 1,2,hello).

Reads standard input, not parameters.

f=lambda x:x and f(x[1:])+[x[:1]+a for a in f(x[1:])]or[()]
for l in f(input()):print l