答:
PHP, 113 bytes

```<code>for($n=$argv[1];$n!=$c;$n=($a=$n>>.5+$e)|($b=$n&$c=(1<<$e/=2)-1))if($a&$b||($e=1+log($n,2))&!(1&$n>>$e/2))die(1);
</code>```

exits with error (code 1) if argument is not super-folding, code 0 else. Run with -r.

Input 0 will return true (code 0).

breakdown

```<code>for($n=$argv[1];
    $n!=$c;                 // loop while $n is != mask
                            // (first iteration: $c is null)
    $n=                     // add left half and right half to new number
        ($a=$n>>.5+$e)      // 7. $a=left half
        |
        ($b=$n&             // 6. $b=right half
            $c=(1<<$e/=2)-1 // 5. $c=mask for right half
        )
)
    if($a&$b                // 1. if any bit is set in both halves
                            // (first iteration: $a and $b are null -> no bits set)
        ||                  // or
        ($e=1+log($n,2))    // 2. get length of number
        &
        !(1&$n>>$e/2)       // 3. if the middle bit is not set -> 1
                            // 4. tests bit 0 in length --> and if length is odd
    )
    die(1);                 // -- exit with error
</code>```

Title: Super Folding Numbers

Body:
We have already defined a folding number here.

But now we are going to define a Super Folding Number.  A Super Folding number is a number that if folded enough times it will eventually reach one less than a power of two.  The method of folding is slightly different than in the folding number question.

The folding algorithm goes as follows:

Take the binary representation

e.g. 5882

```<code>1011011111010
</code>```

Spilt it into three partitions.  First half, last half and middle digit (iff it has a odd number of digits)

```<code>101101 1 111010
</code>```

If the middle digit is zero this number cannot be folded

Reverse the second half and superimposed on the first half

```<code>010111
101101
</code>```

Add the digits in place

```<code>111212
</code>```

Iff there are any 2s in the result the number cannot be folded otherwise the new number is the result of the folding algorithm.

A number is a Super Folding number if it can be folded to a continuous string of ones. (All Folding numbers are also Super Folding Numbers)

Your task is to write code that takes in a number and outputs a truthy value if the number is a Super Folding number and falsy otherwise.  You will be scored on the size of your program.

Examples

5200

Convert to binary:

```<code>1010001010000
</code>```

Split in half:

```<code>101000 1 010000
</code>```

The middle is one so we continue
Superimpose the halves:

```<code>000010
101000
</code>```

Added them:

```<code>101010
</code>```

No twos so we continue
Split in half:

```<code>101 010
</code>```

Fold:

```<code>010
101

111
</code>```

The result is 111 (7 in decimal) so this is a Super Folding Number.

Test Cases

The first 100 Super Folding Numbers are:

```<code>101101 1 111010
</code>```0

Body:
PHP, 113 bytes

for($n=$argv[1];$n!=$c;$n=($a=$n>>.5+$e)|($b=$n&$c=(1<<$e/=2)-1))if($a&$b||($e=1+log($n,2))&!(1&$n>>$e/2))die(1);

exits with error (code 1) if argument is not super-folding, code 0 else. Run with -r.

Input 0 will return true (code 0).

breakdown

for($n=$argv[1];
    $n!=$c;                 // loop while $n is != mask
                            // (first iteration: $c is null)
    $n=                     // add left half and right half to new number
        ($a=$n>>.5+$e)      // 7. $a=left half
        |
        ($b=$n&             // 6. $b=right half
            $c=(1<<$e/=2)-1 // 5. $c=mask for right half
        )
)
    if($a&$b                // 1. if any bit is set in both halves
                            // (first iteration: $a and $b are null -> no bits set)
        ||                  // or
        ($e=1+log($n,2))    // 2. get length of number
        &
        !(1&$n>>$e/2)       // 3. if the middle bit is not set -> 1
                            // 4. tests bit 0 in length --> and if length is odd
    )
    die(1);                 // -- exit with error


问:
Determine whether strings are anagrams

Challenge

Given two strings, work out if they both have exactly the same characters in them.

Example

Input

word, wrdo

This returns true because they are the same but just scrambled.

Input

word, wwro

This returns false.

Input

boat, toba

This returns true

Rules

Here are the rules!

Assume input will be at least 1 char long, and no longer than 8 chars.

No special characters, only a–z

All inputs can be assumed to be lowercase

Test Cases

```<code>boat, boat = true
toab, boat = true
oabt, toab = true
a, aa = false
zzz, zzzzzzzz = false
zyyyzzzz, yyzzzzzy = true
sleepy, pyels = false
p,p = true
</code>```

答:
Perl, 41 bytes

40 bytes code + 1 for -p.

Since this uses a slightly different trick to the other Perl answers I thought I'd share it. Input is separated by newlines.

@{$.}=sort/./g}{$_="@1"eq"@2"?true:false
```

<p>Uses the magic variable <code>$.</code> which tracks the line number to store the words, as character lists, in <code>@1</code> and <code>@2</code> which are then compared.</p>

<h3>Usage</h3>

<pre class="lang-sh prettyprint-override"><code>perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'wrdo
word'
true

perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'word
wwro'
false

perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'boat
toba'
true
</code>```

Try it online.

ContentLicense: CC BY-SA 3.0

Title: Determine whether strings are anagrams

Body:
Perl, 41 bytes

40 bytes code + 1 for -p.

Since this uses a slightly different trick to the other Perl answers I thought I'd share it. Input is separated by newlines.

@{$.}=sort/./g}{$_="@1"eq"@2"?true:false

Uses the magic variable $. which tracks the line number to store the words, as character lists, in @1 and @2 which are then compared.

Usage

perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'wrdo
word'
true

perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'word
wwro'
false

perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'boat
toba'
true

Try it online.


问:
Movie Title Styled String
Challenge

Ever seen those movie trailer titles (namely Martian, Interstellar, etc) where they have huge gaps in between letters slowly spreading out?

The challenge is to recreate this effect given a string, gap multiplier and direction, by inserting appropriate amount of spaces in between the letters.

Example

Input: 'INTERSTELLAR', Gap multiplier: 1.0, Direction: Increasing Inward

```<code>Output: I N  T   E    R     S      T     E    L   L  A R
</code>```

The spacing is: [1, 2, 3, ... , 3, 2, 1]; replacing the spaces with '.' to better demonstrate the spacing:

```<code>I.N..T...E....R.....S......T.....E....L...L..A.R
</code>```

Input: 'INTERSTELLAR', Gap multiplier: 0.5, Direction: Increasing Inward

```<code>Output: IN T E  R  S   T  E  L L AR
</code>```

The spacing is multiplied by 0.5, therefore we get [0, 1, 1, 2, ... 2, 1, 1, 0] from integer division; using '.':

```<code>IN.T.E..R..S...T..E..L.L.AR
</code>```

Input: 'CODEGOLF', Gap multiplier: 2.0, Direction: Increasing Outward

```<code>Output: C        O      D    E  G    O      L        F
</code>```

The spacing is multiplied by 2, increasing outward, therefore we get [8,6,4,2,4,6,8]; replacing with '.':

```<code>C........O......D....E..G....O......L........F
</code>```

Input: 'CODEGOLF', Gap multiplier: 0.4, Direction: Increasing Outward

```<code>Output: C O DEGO L F
</code>```

The spacing is multiplied by 0.4, increasing outward, therefore we get [1,1,0,0,0,1,1]; replacing with '.':

```<code>C.O.DEGO.L.F
</code>```

Rules

Takes 3 input: string, gap multiplier and direction

If input string is odd in length (even in # of gaps) e.g. 'HELLO', the spacing of the inner most 2 gaps should be the same H E  L  L O

The direction and gap multiplier can be parsed however you want, e.g. you could use -2 as 'increasing inward with a multiplier of 2', 1 as 'increasing outward with a multiplier of 1', etc.

It is only required to use spaces, however it is a bonus if the character filling is customizable.

Reference Animation

Have fun golfing!

答:
JavaScript (ES6), <s>86</s> <s>82</s> <s>81</s> 80 bytes

Input is expected in currying syntax f(s)(r), with:

s = string

r = ratio + direction: a negative float for inward or a positive float for outward

let f =

s=>r=>s.replace(/./g,(c,i)=>c+' '.repeat(n+=i<l?-r:r),l=s.length/2,n=r>0&&l*r+r)

console.log(f("INTERSTELLAR")(-1));
console.log(f("INTERSTELLAR")(-0.5));
console.log(f("CODEGOLF")(2));
console.log(f("CODEGOLF")(0.4));```

Title: Movie Title Styled String


问:
Simple cat program
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and concatenate) several files read from disc.

Task

You should write a full program which reads the contents of the standard input stream and writes them verbatim to the standard output stream. If and only if your language does not support standard input and/or output streams (as understood in most languages), you may instead take these terms to mean their closest equivalent in your language (e.g. JavaScript's prompt and alert). These are the only admissible forms of I/O, as any other interface would largely change the nature of the task and make answers much less comparable.

The output should contain exactly the input and nothing else. The only exception to this rule is constant output of your language's interpreter that cannot be suppressed, such as a greeting, ANSI color codes or indentation. This also applies to trailing newlines. If the input does not contain a trailing newline, the output shouldn't include one either! (The only exception being if your language absolutely always prints a trailing newline after execution.)

Output to the standard error stream is ignored, so long as the standard output stream contains the expected output. In particular, this means your program can terminate with an error upon hitting the end of the stream (EOF), provided that doesn't pollute the standard output stream. If you do this, I encourage you to add an error-free version to your answer as well (for reference).

As this is intended as a challenge within each language and not between languages, there are a few language specific rules:

If it is at all possible in your language to distinguish null bytes in the standard input stream from the EOF, your program must support null bytes like any other bytes (that is, they have to be written to the standard output stream as well).

If it is at all possible in your language to support an arbitrary infinite input stream (i.e. if you can start printing bytes to the output before you hit EOF in the input), your program has to work correctly in this case. As an example yes | tr -d \\n | ./my_cat should print an infinite stream of ys. It is up to you how often you print and flush the standard output stream, but it must be guaranteed to happen after a finite amount of time, regardless of the stream (this means, in particular, that you cannot wait for a specific character like a linefeed before printing).

Please add a note to your answer about the exact behaviour regarding null-bytes, infinite streams, and extraneous output.

Additional rules

This is not about finding the language with the shortest solution for this (there are some where the empty program does the trick) - this is about finding the shortest solution in every language. Therefore, no answer will be marked as accepted.

Submissions in most languages will be scored in bytes in an appropriate preexisting encoding, usually (but not necessarily) UTF-8.

Some languages, like Folders, are a bit tricky to score. If in doubt, please ask on Meta.

Feel free to use a language (or language version) even if it's newer than this challenge. Languages specifically written to submit a 0-byte answer to this challenge are fair game but not particularly interesting.

Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language.

Also note that languages do have to fulfil our usual criteria for programming languages.

If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainfuck derivatives like Headsecks or Unary), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.

Unless they have been overruled earlier, all standard code-golf rules apply, including the http://meta.codegolf.stackexchange.com/q/1061.

As a side note, please don't downvote boring (but valid) answers in languages where there is not much to golf; these are still useful to this question as it tries to compile a catalogue as complete as possible. However, do primarily upvote answers in languages where the author actually had to put effort into golfing the code.

Catalogue

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

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

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

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

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

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

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

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

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
05AB1E, <s>4</s> 2 bytes (not working)

```<code>|»
</code>```

Try it online!

Golfed from 4 to 2 bytes thanks to @daHugLenny!

Explanation

```<code>|       Takes input as array separated by breaks
 »      Join input array by newline
        Implicitly print
</code>```

Title: Simple cat program

Body:
05AB1E, <s>4</s> 2 bytes (not working)

|»

Try it online!

Golfed from 4 to 2 bytes thanks to @daHugLenny!

Explanation

|       Takes input as array separated by breaks
 »      Join input array by newline
        Implicitly print


问:
Let's do the Wave!
Input:

A string (the wave-snippet) with a length >= 2.

A positive integer n >= 1.

Output:

We output a single-line wave. We do this by repeating the input string n times.

Challenge rules:

If the first and last character of the input string matches, we only output it once in the total output (i.e. ^_^ of length 2 becomes ^_^_^ and not ^_^^_^).

The input string won't contain any whitespaces/tabs/new-lines/etc.

If your language doesn't support non-ASCII characters, then that's fine. As long as it still complies to the challenge with ASCII-only wave-input.

General rules:

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

Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>_.~"(              length 12
_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(

'°º¤o,¸¸,o¤º°'     length 3
'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'

-__                length 1
-__

-__                length 8
-__-__-__-__-__-__-__-__

-__-               length 8
-__-__-__-__-__-__-__-__-

¯`·.¸¸.·´¯         length 24
¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯

**                 length 6
*******

String & length of your own choice (be creative!)
</code>```

答:
Java (117 bytes)

```<code>String w(String a,int b){String c=a;for(;b>0;b--)c+=b+a.substring(a.charAt(a.length()-1)==a.charAt(0)?1:0);return c;}
</code>```

Title: Let's do the Wave!

Body:
Java (117 bytes)

String w(String a,int b){String c=a;for(;b>0;b--)c+=b+a.substring(a.charAt(a.length()-1)==a.charAt(0)?1:0);return c;}


问:
Folding Numbers
Given a number determine if it is a folding number.

A folding number is a number such that if you take it binary representation and "fold" it in half,  That is take the result of XNOR multiplication of the first half of the number and the second half with it digits in reverse, you will get zero.

If the number has a odd number of digits in binary its middle digit must be 1 and is ignored when folding.

Since that might be a bit confusing I will give some examples:

178

The binary representation of 178 is

```<code>10110010
</code>```

To fold this we first split it in half

```<code>1011 0010
</code>```

We reverse the second half

```<code>1011
0100
</code>```

And we XNOR the two halves:

```<code>0000
</code>```

This is zero so this is a folding number.

1644

The binary representation of 1644 is

```<code>11001101100
</code>```

To fold this we first split it in half

```<code>11001 1 01100
</code>```

The middle bit is 1 so we throw it out.

```<code>11001 01100
</code>```

We reverse the second half

```<code>11001
00110
</code>```

And we XNOR the two halves:

```<code>00000
</code>```

This is zero so this is a folding number.

4254

The binary representation of 4254 is

```<code>1000010011110
</code>```

To fold this we first split it in half

```<code>100001 0 011110
</code>```

The middle bit is 0 so this is not a folding number.

Task

Your task is to take in a positive number and return a truthy if the number is folding and falsy if it is not.  This is code golf so try to keep the byte count down.

Test Cases

Here are the first 99 folding numbers:

```<code>[1, 2, 6, 10, 12, 22, 28, 38, 42, 52, 56, 78, 90, 108, 120, 142, 150, 170, 178, 204, 212, 232, 240, 286, 310, 346, 370, 412, 436, 472, 496, 542, 558, 598, 614, 666, 682, 722, 738, 796, 812, 852, 868, 920, 936, 976, 992, 1086, 1134, 1206, 1254, 1338, 1386, 1458, 1506, 1596, 1644, 1716, 1764, 1848, 1896, 1968, 2016, 2110, 2142, 2222, 2254, 2358, 2390, 2470, 2502, 2618, 2650, 2730, 2762, 2866, 2898, 2978, 3010, 3132, 3164, 3244, 3276, 3380, 3412, 3492, 3524, 3640, 3672, 3752, 3784, 3888, 3920, 4000, 4032, 4222, 4318, 4462, 4558]
</code>```

答:
CJam, 13 bytes

```<code>ri2b_W%.+:*3&
</code>```

Try it online! or generate a list of folding numbers up to a given number.

```<code>ri2b   e# convert input to binary
_W%.+  e# flip and sum (if folding all bits are 1 except middle)
:*     e# product is 0 or power of 2 (2 if middle folds)
3&     e# keep only 1 or 2, everything else becomes 0 (false)
</code>```

Title: Folding Numbers

Body:
CJam, 13 bytes

ri2b_W%.+:*3&

Try it online! or generate a list of folding numbers up to a given number.

ri2b   e# convert input to binary
_W%.+  e# flip and sum (if folding all bits are 1 except middle)
:*     e# product is 0 or power of 2 (2 if middle folds)
3&     e# keep only 1 or 2, everything else becomes 0 (false)


问:
Find the Swirling Words!
Don't ask me how or why but while coding on a project I noticed that the characters of a couple of words had a particular pattern referred to the alphabet, I connected each character of the words with the pencil on the alphabet and I obtained two spirals, then I noticed that the first spiral was clockwise and the other was counterclockwise, and other characteristics... so I named them Swirling Words!

A Swirling Word can be:

clockwise or counterclockwise

centripetal or centrifugal

Here there are some examples of Swirling Words:

Task 1:

Write a full program or function that will take a word from standard input and will output if is a Swirling Word and it's characteristics, in a readable format, extended text, 3 characters, flags, etc.

Test cases and example outputs for different words (but you can decide how to represent the results):

```<code>EARTH, GROUP            > NO        // NOT A SWIRLING WORD
OPERA, STAY, IRIS       > SW,CF,CW  // SWIRLING WORD, CENTRIFUGAL, CLOCKWISE
MINER, TAX, PLUG, META  > SW,CF,CC  // SWIRLING WORD, CENTRIFUGAL, COUNTERCLOCKWISE
AXIOM, AXIS, COOK       > SW,CP,CW  // SWIRLING WORD, CENTRIPETAL, CLOCKWISE
WATCH, YETI, PILL       > SW,CP,CC  // SWIRLING WORD, CENTRIPETAL, COUNTERCLOCKWISE

MORE EXAMPLES OF FALSE TEST CASES (NOT SWIRLING WORDS):
EARTH, GROUP, OUTPUT, WORD, CONNECTION, ODD, MOM, DAD,
CHARACTER, EXAMPLE, QUESTION, NEWSLETTER, OTHER
</code>```

Rules:

The connection between the first two characters must be up (like in the graphics), all the even connection must be down, all the odd connections must be up.

You can ignore upper/lowercase or consider/convert all to upper case or all to lower case.

The input words are only characters in the alphabet range of A-Z, no spaces, no punctuation, etc.

If a word has double characters, like "GROOVE", you must collapse the doubles to one character: "GROOVE" > "GROVE".

The input words will contain at least 3 distinct characters. Words like "MOM", "DAD", "LOL" are not valid words.

It's possible to pass multiple times in the same character, like "IRIS".

Shortest code wins.

Task 2:

To obtain more reputation, find the longest Swirling Words, and it's characteristics, that you can find in the english dictionary, following the above rules. You can take for example as reference the complete list of the english words here.

Happy coding!

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

```<code>OIḟ0µAI©Ṡḟ0ṂṭḢṠ$µ®ḟ0ṠEṭ
</code>```

Try it online! Or see the test cases

All upper or all lower.

Returns a flag list [D, F, S]:

D: clockwise = 1 / anticlockwise = -1

F: centrifugal = 1 / centripetal = -1

S: spinning = 1 / not spinning = 0

- if S is 0 the other flags are still evaluated even though they carry no useful information.

How?

```<code>OIḟ0µAI©Ṡḟ0ṂṭṠḢ$µ®ḟ0ṠEṭ - Main link: s
O                       - ordinals
 I                      - deltas (i.e. [a,b,c,...] -> [b-a,c-b,...])
  ḟ0                    - filter out zeros
                        - (call this Z)
    µ                   - start a new monadic chain (i.e. f(Z))
     A                  - absolute values
      I                 - deltas
       ©                - copy to register
        Ṡ               - signs
         ḟ0             - filter out zeros
           Ṃ            - minimum
                        - (i.e. F = {centrifugal: 1; centripetal: -1})
               $        - last two links as a monad:
             Ḣ          -   head (Z)
              Ṡ         -   sign
                        - (i.e. D = {clockwise: 1; anticlockwise: -1})
            ṭ           - tack
                µ       - start a new monadic chain (i.e. f([D,F]))
                 ®      - recall from register
                  ḟ0    - filter out zeros
                    Ṡ   - signs
                     E  - all equal?
                        - (i.e. S = {spinning: 1; not spinning: 0})
                      ṭ - tack
                        - (i.e. [D,F,S])
</code>```

Title: Find the Swirling Words!

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

OIḟ0µAI©Ṡḟ0ṂṭḢṠ$µ®ḟ0ṠEṭ

Try it online! Or see the test cases

All upper or all lower.

Returns a flag list [D, F, S]:

D: clockwise = 1 / anticlockwise = -1

F: centrifugal = 1 / centripetal = -1

S: spinning = 1 / not spinning = 0

- if S is 0 the other flags are still evaluated even though they carry no useful information.

How?

OIḟ0µAI©Ṡḟ0ṂṭṠḢ$µ®ḟ0ṠEṭ - Main link: s
O                       - ordinals
 I                      - deltas (i.e. [a,b,c,...] -> [b-a,c-b,...])
  ḟ0                    - filter out zeros
                        - (call this Z)
    µ                   - start a new monadic chain (i.e. f(Z))
     A                  - absolute values
      I                 - deltas
       ©                - copy to register
        Ṡ               - signs
         ḟ0             - filter out zeros
           Ṃ            - minimum
                        - (i.e. F = {centrifugal: 1; centripetal: -1})
               $        - last two links as a monad:
             Ḣ          -   head (Z)
              Ṡ         -   sign
                        - (i.e. D = {clockwise: 1; anticlockwise: -1})
            ṭ           - tack
                µ       - start a new monadic chain (i.e. f([D,F]))
                 ®      - recall from register
                  ḟ0    - filter out zeros
                    Ṡ   - signs
                     E  - all equal?
                        - (i.e. S = {spinning: 1; not spinning: 0})
                      ṭ - tack
                        - (i.e. [D,F,S])

ContentLicense: CC BY-SA 4.0


答:
PowerShell v2+, 48 bytes

```<code>Param($s,$n)$s+$s.Substring($s[0]-eq$s[-1])*--$n
</code>```

Outputs the whole string once, followed by n-1 copies of the string or substring, depending on if the first and last characters match.

The .Substring() method outputs from the index supplied to the end of the string, so if $s[0]-eq$s[-1] evaluates to false (0), we get the whole string. If that statement is true (1), We get the substring starting at the second character.

Title: Let's do the Wave!

Body:
Input:

A string (the wave-snippet) with a length >= 2.

A positive integer n >= 1.

Output:

We output a single-line wave. We do this by repeating the input string n times.

Challenge rules:

If the first and last character of the input string matches, we only output it once in the total output (i.e. ^_^ of length 2 becomes ^_^_^ and not ^_^^_^).

The input string won't contain any whitespaces/tabs/new-lines/etc.

If your language doesn't support non-ASCII characters, then that's fine. As long as it still complies to the challenge with ASCII-only wave-input.

General rules:

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

Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>_.~"(              length 12
_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(

'°º¤o,¸¸,o¤º°'     length 3
'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'

-__                length 1
-__

-__                length 8
-__-__-__-__-__-__-__-__

-__-               length 8
-__-__-__-__-__-__-__-__-

¯`·.¸¸.·´¯         length 24
¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯

**                 length 6
*******

String & length of your own choice (be creative!)
</code>```

Body:
PowerShell v2+, 48 bytes

Param($s,$n)$s+$s.Substring($s[0]-eq$s[-1])*--$n

Outputs the whole string once, followed by n-1 copies of the string or substring, depending on if the first and last characters match.

The .Substring() method outputs from the index supplied to the end of the string, so if $s[0]-eq$s[-1] evaluates to false (0), we get the whole string. If that statement is true (1), We get the substring starting at the second character.


问:
KITT car ASCII art
The 80's TV series Knight Rider featured an intelligent, self-aware car called KITT. One distinctive aspect of the car was a front-mounted scanner bar that allowed KITT to "see" (and that looked suspiciously familiar to fans of another, earlier TV series).

The scanner had eight lights as seen in this picture:

The lights "moved" as shown in this animated image.

Your task, as you have guessed by now, it to recreate the scanner bar with the moving lights in ASCII art.

The challenge

Given an integer t, output the state of the scanner bar at that instant, defined as follows:

The scanner consists of eight lights.

At any instant one of the lights is active, and is shown as #. The lights that were active at times t-1 and t-2 are now dimmed, and are shown as +; unless they coincide with the current active one. The rest of the lights are off, and are shown as -.

The active light moves left to right, then right to left.

The exact output for each t is detailed below.

```<code>0  -->  #++-----   % The leftmost light is active, and it just came from the right.
                   % The two neighbouring lights are dimmed
1  -->  +#------   % The active light has bounced to the right, and it is covering
                   % one of the two lights that should be dimmed. So there is only
                   % one dimmed light
2  -->  ++#-----   % The active light has moved one more step to the right, and the
                   % two trailing dimmed lights are visible
3  -->  -++#----
7  -->  -----++#
8  -->  ------#+   % The active light has bounced to the left
9  -->  -----#++
10 -->  ----#++-
13 -->  -#++----
14 -->  #++-----   % Same as 0
15 -->  +#------   % Same as 1
</code>```

For negative values of t the cycle is simply extended:

```<code>-1 -->  -#++----   % Same as 13
-2 -->  --#++---   % Same as 12
</code>```

#Additional rules

You can write a program or function.

Output can contain trailing whitespace and a leading newline.

Shortest code in bytes wins.

答:
><>, 51+3 = 54 bytes

```<code><v{"------#++"%7&(7%*27:-1
}>:?!\1-$
{~&?r\~
l?!;o>
</code>```

Input is expected on the stack at program start, so +3 bytes for the -v flag.

Try it online!

Title: KITT car ASCII art

Body:
><>, 51+3 = 54 bytes

<v{"------#++"%7&(7%*27:-1
}>:?!\1-$
{~&?r\~
l?!;o>

Input is expected on the stack at program start, so +3 bytes for the -v flag.

Try it online!


问:
Remove leading and trailing zeroes
Given a non-empty list/array containing only non-negative integers like this:

```<code>[0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0]
</code>```

Output the list with trailing and leading zeroes removed.

The output for this would be:

```<code>[8, 1, 4, 3, 5, 6, 4, 1, 2]
</code>```

Some other test cases:

```<code>[0, 4, 1, 2, 0, 1, 2, 4, 0] > [4, 1, 2, 0, 1, 2, 4]
[0, 0, 0, 0, 0, 0] > nothing
[3, 4, 5, 0, 0] > [3, 4, 5]
[6] > [6]
</code>```

Shortest code wins

答:
PHP, 30 bytes

```<code><?=trim(join(' ',$argv),' 0');
</code>```

Needs to be saved in a file called '0' (or any number of 0s). Works with all test cases (which are <10 at time of submission) but if a test case with a final non 0 integer of 10 (or any other integer with a 0 units digit) gets added then it will no longer be valid.

use like:

```<code>php 0 0 4 1 2 0 1 2 4 0
</code>```

Where the first 0 is the file name and the rest is the input

A bunch of answers got added between me loading the challenge and submitting this. I'd delete it but I never finished the account sign up, would a mod do so please?

Title: Remove leading and trailing zeroes

Body:
PHP, 30 bytes

<?=trim(join(' ',$argv),' 0');

Needs to be saved in a file called '0' (or any number of 0s). Works with all test cases (which are <10 at time of submission) but if a test case with a final non 0 integer of 10 (or any other integer with a 0 units digit) gets added then it will no longer be valid.

use like:

php 0 0 4 1 2 0 1 2 4 0

Where the first 0 is the file name and the rest is the input

A bunch of answers got added between me loading the challenge and submitting this. I'd delete it but I never finished the account sign up, would a mod do so please?


问:
Add two numbers
Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list.

Output: Their sum. Use the same format for output integers as input integers. For example, the input 5 16 would lead to the output 21.

Restrictions: No standard loopholes please. This is code-golf, answer in lowest amount of bytes wins.

Notes: This should be fairly trivial, however I'm interested to see how it can be implemented. The answer can be a complete program or a function, but please identify which one it is.

Test cases:

```<code>1 2 -> 3
14 15 -> 29
7 9 -> 16
-1 8 -> 7
8 -9 -> -1
-8 -9 -> -17
</code>```

Or as CSV:

```<code>a,b,c
1,2,3
14,15,29
7,9,16
-1,8,7
8,-9,-1
-8,-9,-17
</code>```

Leaderboard

var QUESTION_ID=84260,OVERRIDE_USER=8478;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

答:
Elixir, 7 bytes

```<code>& &1+&2
</code>```

Anonymous function defined using the capture operator. Another version is &(&1+&2), however this approach saves 1 byte. The verbose version is fn a,b->a+b end - 15 bytes.

Full program with test case (yes, the . in the function call is mandatory!):

```<code>s=& &1+&2
IO.puts s.(1,6) #7
</code>```

Try it online on ElixirPlayground !

Title: Add two numbers

Body:
Elixir, 7 bytes

& &1+&2

Anonymous function defined using the capture operator. Another version is &(&1+&2), however this approach saves 1 byte. The verbose version is fn a,b->a+b end - 15 bytes.

Full program with test case (yes, the . in the function call is mandatory!):

s=& &1+&2
IO.puts s.(1,6) #7

Try it online on ElixirPlayground !


Title: KITT car ASCII art

Body:
The 80's TV series Knight Rider featured an intelligent, self-aware car called KITT. One distinctive aspect of the car was a front-mounted scanner bar that allowed KITT to "see" (and that looked suspiciously familiar to fans of another, earlier TV series).

The scanner had eight lights as seen in this picture:

The lights "moved" as shown in this animated image.

Your task, as you have guessed by now, it to recreate the scanner bar with the moving lights in ASCII art.

The challenge

Given an integer t, output the state of the scanner bar at that instant, defined as follows:

The scanner consists of eight lights.

At any instant one of the lights is active, and is shown as #. The lights that were active at times t-1 and t-2 are now dimmed, and are shown as +; unless they coincide with the current active one. The rest of the lights are off, and are shown as -.

The active light moves left to right, then right to left.

The exact output for each t is detailed below.

```<code>0  -->  #++-----   % The leftmost light is active, and it just came from the right.
                   % The two neighbouring lights are dimmed
1  -->  +#------   % The active light has bounced to the right, and it is covering
                   % one of the two lights that should be dimmed. So there is only
                   % one dimmed light
2  -->  ++#-----   % The active light has moved one more step to the right, and the
                   % two trailing dimmed lights are visible
3  -->  -++#----
7  -->  -----++#
8  -->  ------#+   % The active light has bounced to the left
9  -->  -----#++
10 -->  ----#++-
13 -->  -#++----
14 -->  #++-----   % Same as 0
15 -->  +#------   % Same as 1
</code>```

For negative values of t the cycle is simply extended:

```<code>-1 -->  -#++----   % Same as 13
-2 -->  --#++---   % Same as 12
</code>```

#Additional rules

You can write a program or function.

Output can contain trailing whitespace and a leading newline.

Shortest code in bytes wins.

Body:
JavaScript (ES6), 72

t=>`------${(t=(13+t%14)%14)>6?'#++':'++#'}------`.substr(t>6?t%7:7-t,8)

Less golfed

t=>(
  pad = '------',
  t = (13+(t%14))%14,
  u = t % 7,
  t > 6 ? (pad + '#++' + pad).substr(u, 8)
        : (pad + '++#' + pad).substr(7 - u, 8)
)

Test

f=
t=>`------${(t=(13+t%14)%14)>6?'#++':'++#'}------`.substr(t>6?t%7:7-t,8)

T=_=>(
  O.textContent=f(++N.textContent),
  setTimeout(T, 150)
)

T()

<input id=I type=number value=0 oninput='N.textContent=this.value'>
<pre id=N>-100</pre>
<pre id=O></pre>


答:
Haskell, 148 bytes

z f=tail>>=zipWith f
g c=and.z c.filter(/=0).map abs.z(-).map fromEnum
(a:b:r)%c|a==b=(b:r)%c|1<3=c a b
f s|a<-[g(>=)s,g(<=)s]=or a:a++[s%(<),s%(>)]
```

Try it on Ideone.

Input must be either al lower or all upper-case.

Output is a list of five booleans: [SW?, CF?, CP?, CW?, CC?].

f "positive" -> [True,True,False,False,True]

This turned out longer than expected, especially handing the collapsing of repeated characters takes about 40 bytes.

At first I compared just the first two characters to yield CW or CC before noticing that testcases like bba or bbc are valid too and defeat this approach.

Title: Find the Swirling Words!

Body:
Don't ask me how or why but while coding on a project I noticed that the characters of a couple of words had a particular pattern referred to the alphabet, I connected each character of the words with the pencil on the alphabet and I obtained two spirals, then I noticed that the first spiral was clockwise and the other was counterclockwise, and other characteristics... so I named them Swirling Words!

A Swirling Word can be:

clockwise or counterclockwise

centripetal or centrifugal

Here there are some examples of Swirling Words:

Task 1:

Write a full program or function that will take a word from standard input and will output if is a Swirling Word and it's characteristics, in a readable format, extended text, 3 characters, flags, etc.

Test cases and example outputs for different words (but you can decide how to represent the results):

```<code>EARTH, GROUP            > NO        // NOT A SWIRLING WORD
OPERA, STAY, IRIS       > SW,CF,CW  // SWIRLING WORD, CENTRIFUGAL, CLOCKWISE
MINER, TAX, PLUG, META  > SW,CF,CC  // SWIRLING WORD, CENTRIFUGAL, COUNTERCLOCKWISE
AXIOM, AXIS, COOK       > SW,CP,CW  // SWIRLING WORD, CENTRIPETAL, CLOCKWISE
WATCH, YETI, PILL       > SW,CP,CC  // SWIRLING WORD, CENTRIPETAL, COUNTERCLOCKWISE

MORE EXAMPLES OF FALSE TEST CASES (NOT SWIRLING WORDS):
EARTH, GROUP, OUTPUT, WORD, CONNECTION, ODD, MOM, DAD,
CHARACTER, EXAMPLE, QUESTION, NEWSLETTER, OTHER
</code>```

Rules:

The connection between the first two characters must be up (like in the graphics), all the even connection must be down, all the odd connections must be up.

You can ignore upper/lowercase or consider/convert all to upper case or all to lower case.

The input words are only characters in the alphabet range of A-Z, no spaces, no punctuation, etc.

If a word has double characters, like "GROOVE", you must collapse the doubles to one character: "GROOVE" > "GROVE".

The input words will contain at least 3 distinct characters. Words like "MOM", "DAD", "LOL" are not valid words.

It's possible to pass multiple times in the same character, like "IRIS".

Shortest code wins.

Task 2:

To obtain more reputation, find the longest Swirling Words, and it's characteristics, that you can find in the english dictionary, following the above rules. You can take for example as reference the complete list of the english words here.

Happy coding!

Body:
Haskell, 148 bytes

z f=tail>>=zipWith f
g c=and.z c.filter(/=0).map abs.z(-).map fromEnum
(a:b:r)%c|a==b=(b:r)%c|1<3=c a b
f s|a<-[g(>=)s,g(<=)s]=or a:a++[s%(<),s%(>)]

Try it on Ideone.

Input must be either al lower or all upper-case.

Output is a list of five booleans: [SW?, CF?, CP?, CW?, CC?].

f "positive" -> [True,True,False,False,True]

This turned out longer than expected, especially handing the collapsing of repeated characters takes about 40 bytes.

At first I compared just the first two characters to yield CW or CC before noticing that testcases like bba or bbc are valid too and defeat this approach.


答:
Retina, 92 bytes

Byte count assumes ISO 8859-1 encoding.

```<code>.+
$*
+`(1+)\1
${1}0
01
1
^((.)*?)1??((?<-2>.)*$.*)
$1¶$3
O$^`.(?=.*¶)

T`01`10`^.*
^(.*)¶\1
</code>```

Try it online

Convert to unary. Convert that to binary. Cut the number in half and remove a middle 1 if there is. Reverse the first half. Switch its ones and zeros. Match if both halves are equal.

Title: Folding Numbers

Body:
Given a number determine if it is a folding number.

A folding number is a number such that if you take it binary representation and "fold" it in half,  That is take the result of XNOR multiplication of the first half of the number and the second half with it digits in reverse, you will get zero.

If the number has a odd number of digits in binary its middle digit must be 1 and is ignored when folding.

Since that might be a bit confusing I will give some examples:

178

The binary representation of 178 is

```<code>10110010
</code>```

To fold this we first split it in half

```<code>1011 0010
</code>```

We reverse the second half

```<code>1011
0100
</code>```

And we XNOR the two halves:

```<code>0000
</code>```

This is zero so this is a folding number.

1644

The binary representation of 1644 is

```<code>11001101100
</code>```

To fold this we first split it in half

```<code>11001 1 01100
</code>```

The middle bit is 1 so we throw it out.

```<code>11001 01100
</code>```

We reverse the second half

```<code>11001
00110
</code>```

And we XNOR the two halves:

```<code>00000
</code>```

This is zero so this is a folding number.

4254

The binary representation of 4254 is

```<code>1000010011110
</code>```

To fold this we first split it in half

```<code>100001 0 011110
</code>```

The middle bit is 0 so this is not a folding number.

Task

Your task is to take in a positive number and return a truthy if the number is folding and falsy if it is not.  This is code golf so try to keep the byte count down.

Test Cases

Here are the first 99 folding numbers:

```<code>[1, 2, 6, 10, 12, 22, 28, 38, 42, 52, 56, 78, 90, 108, 120, 142, 150, 170, 178, 204, 212, 232, 240, 286, 310, 346, 370, 412, 436, 472, 496, 542, 558, 598, 614, 666, 682, 722, 738, 796, 812, 852, 868, 920, 936, 976, 992, 1086, 1134, 1206, 1254, 1338, 1386, 1458, 1506, 1596, 1644, 1716, 1764, 1848, 1896, 1968, 2016, 2110, 2142, 2222, 2254, 2358, 2390, 2470, 2502, 2618, 2650, 2730, 2762, 2866, 2898, 2978, 3010, 3132, 3164, 3244, 3276, 3380, 3412, 3492, 3524, 3640, 3672, 3752, 3784, 3888, 3920, 4000, 4032, 4222, 4318, 4462, 4558]
</code>```

Body:
Retina, 92 bytes

Byte count assumes ISO 8859-1 encoding.

.+
$*
+`(1+)\1
${1}0
01
1
^((.)*?)1??((?<-2>.)*$.*)
$1¶$3
O$^`.(?=.*¶)

T`01`10`^.*
^(.*)¶\1

Try it online

Convert to unary. Convert that to binary. Cut the number in half and remove a middle 1 if there is. Reverse the first half. Switch its ones and zeros. Match if both halves are equal.


答:
PHP, 129 Bytes

12 Bytes saved by @Titus Thank You

string = $argv[1],ratio = $argv[2],
direction =  $argv[3] inward = 0 ,Outward =1

```<code>for($i=0;$i+1<2*$l=strlen($t=($x=$argv)[1]);)echo$i%2?str_pad("",$x[2]*abs($x[3]*(0^$l/2+1)-($i++>=$l?$l-$i/2:$i/2))):$t[$i++/2];
</code>```

Title: Movie Title Styled String

Body:
Challenge

Ever seen those movie trailer titles (namely Martian, Interstellar, etc) where they have huge gaps in between letters slowly spreading out?

The challenge is to recreate this effect given a string, gap multiplier and direction, by inserting appropriate amount of spaces in between the letters.

Example

Input: 'INTERSTELLAR', Gap multiplier: 1.0, Direction: Increasing Inward

```<code>Output: I N  T   E    R     S      T     E    L   L  A R
</code>```

The spacing is: [1, 2, 3, ... , 3, 2, 1]; replacing the spaces with '.' to better demonstrate the spacing:

```<code>I.N..T...E....R.....S......T.....E....L...L..A.R
</code>```

Input: 'INTERSTELLAR', Gap multiplier: 0.5, Direction: Increasing Inward

```<code>Output: IN T E  R  S   T  E  L L AR
</code>```

The spacing is multiplied by 0.5, therefore we get [0, 1, 1, 2, ... 2, 1, 1, 0] from integer division; using '.':

```<code>IN.T.E..R..S...T..E..L.L.AR
</code>```

Input: 'CODEGOLF', Gap multiplier: 2.0, Direction: Increasing Outward

```<code>Output: C        O      D    E  G    O      L        F
</code>```

The spacing is multiplied by 2, increasing outward, therefore we get [8,6,4,2,4,6,8]; replacing with '.':

```<code>C........O......D....E..G....O......L........F
</code>```

Input: 'CODEGOLF', Gap multiplier: 0.4, Direction: Increasing Outward

```<code>Output: C O DEGO L F
</code>```

The spacing is multiplied by 0.4, increasing outward, therefore we get [1,1,0,0,0,1,1]; replacing with '.':

```<code>C.O.DEGO.L.F
</code>```

Rules

Takes 3 input: string, gap multiplier and direction

If input string is odd in length (even in # of gaps) e.g. 'HELLO', the spacing of the inner most 2 gaps should be the same H E  L  L O

The direction and gap multiplier can be parsed however you want, e.g. you could use -2 as 'increasing inward with a multiplier of 2', 1 as 'increasing outward with a multiplier of 1', etc.

It is only required to use spaces, however it is a bonus if the character filling is customizable.

Reference Animation

Have fun golfing!

Body:
PHP, 129 Bytes

12 Bytes saved by @Titus Thank You

string = $argv[1],ratio = $argv[2],
direction =  $argv[3] inward = 0 ,Outward =1

for($i=0;$i+1<2*$l=strlen($t=($x=$argv)[1]);)echo$i%2?str_pad("",$x[2]*abs($x[3]*(0^$l/2+1)-($i++>=$l?$l-$i/2:$i/2))):$t[$i++/2];


问:
Binary representation of a number is palindrome or not?
Write a full program  to find whether the binary representation of a number is palindrome or not?

```<code>Sample Input
5

Sample Output
YES
</code>```

Print YES if binary representation is palindrome and NO otherwise.

答:
Retina, <s>80</s> 78 bytes

Byte count assumes ISO 8859-1 encoding.

```<code>.+
$*
+`(1+)\1
${1}0
01
1
^((.)*?).??((?<-2>.)*$)
$1¶$3
O$^`.(?=.*¶)

^(.*)¶\1
</code>```

Try it online

Convert to unary. Convert that to binary. Cut the number in half and remove a middle digit if there is one. Reverse the first half. Match if both halves are equal.

Body:
Retina, <s>80</s> 78 bytes

Byte count assumes ISO 8859-1 encoding.

.+
$*
+`(1+)\1
${1}0
01
1
^((.)*?).??((?<-2>.)*$)
$1¶$3
O$^`.(?=.*¶)

^(.*)¶\1

Try it online

Convert to unary. Convert that to binary. Cut the number in half and remove a middle digit if there is one. Reverse the first half. Match if both halves are equal.


答:
APL, 40 bytes

```<code>{⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}
</code>```

This takes the string as its right argument, the ratio as its left argument and the direction as its left operand (0 for inward and 1 for outward).

```<code>      1 (0 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'INTERSTELLAR'
I N  T   E    R     S      T     E    L   L  A R
      0.5 (0 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'INTERSTELLAR'
IN T E  R  S   T  E  L L AR
      2 (1 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'CODEGOLF'
C        O      D    E  G    O      L        F
      0.4 (1 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'CODEGOLF'
C O DEGO L F
</code>```

Explanation:

⍳⍴1↓⍵: get a list of numbers from 1 to N-1, where N is the length of the string

(⌽⌊+): invert the list, and at each position, get the lowest number of both lists (this gives the sizes of the gaps if increasing inwards)

(1+⌈/-+)⍣⍺⍺: subtract each number in the list from the highest number in the list, and add 1. Do this ⍺⍺ times. (If ⍺⍺=0, nothing will happen, and if ⍺⍺=1, this will give the sizes of the gaps if increasing outwards.)

-⌊⍺×: multiply each gap by ⍺, round it downwards, and negate it.

∊1,⍨1,¨: add a 1 in front of each gap, and a 1 at the very end of the list.

0~⍨: remove any zeroes.

⍵\⍨: use the resulting list to expand ⍵. Expand (\) works in the following manner: for each positive number, the current character is replicated that many times, and for each negative number, that many spaces are inserted, with the caveat that 0 and ¯1 do the same thing, which is why all the zeroes had to be removed earlier.

Title: Movie Title Styled String

Body:
APL, 40 bytes

{⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}

This takes the string as its right argument, the ratio as its left argument and the direction as its left operand (0 for inward and 1 for outward).

      1 (0 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'INTERSTELLAR'
I N  T   E    R     S      T     E    L   L  A R
      0.5 (0 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'INTERSTELLAR'
IN T E  R  S   T  E  L L AR
      2 (1 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'CODEGOLF'
C        O      D    E  G    O      L        F
      0.4 (1 {⍵\⍨0~⍨∊1,⍨1,¨-⌊⍺×(1+⌈/-+)⍣⍺⍺(⌽⌊+)⍳⍴1↓⍵}) 'CODEGOLF'
C O DEGO L F

Explanation:

⍳⍴1↓⍵: get a list of numbers from 1 to N-1, where N is the length of the string

(⌽⌊+): invert the list, and at each position, get the lowest number of both lists (this gives the sizes of the gaps if increasing inwards)

(1+⌈/-+)⍣⍺⍺: subtract each number in the list from the highest number in the list, and add 1. Do this ⍺⍺ times. (If ⍺⍺=0, nothing will happen, and if ⍺⍺=1, this will give the sizes of the gaps if increasing outwards.)

-⌊⍺×: multiply each gap by ⍺, round it downwards, and negate it.

∊1,⍨1,¨: add a 1 in front of each gap, and a 1 at the very end of the list.

0~⍨: remove any zeroes.

⍵\⍨: use the resulting list to expand ⍵. Expand (\) works in the following manner: for each positive number, the current character is replicated that many times, and for each negative number, that many spaces are inserted, with the caveat that 0 and ¯1 do the same thing, which is why all the zeroes had to be removed earlier.


问:
Divisibility test

Task

Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.

You may write a program or a function and use any of the our standard methods of receiving input and providing output.

The output should be a truthy or a falsy value; truthy if n is divisible by d, and falsy otherwise.

Your code only has to handle integers it can represent natively, as long as it works for all signed 8-bit integers. However, your algorithm has to work for arbitrarily large integers.

You may use any programming language, but note that these loopholes are forbidden by default.

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

Test cases

```<code> n,  d    output

 1,  1    truthy
 2,  1    truthy
 6,  3    truthy
17, 17    truthy
22,  2    truthy
 1,  2    falsy
 2,  3    falsy
 2,  4    falsy
 3,  9    falsy
15, 16    falsy
</code>```

Leaderboard

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

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

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

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

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

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

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

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

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

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

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

```

答:
05AB1E, <s>2</s> 1 byte

```<code>Ö
</code>```

Try it online!

Was sÖ (Test here) but arguments switched (suggested by @Mego). This allowed me to golf down to 1 byte.

Explanation (old):

```<code>s    Reverses input e.g. 6, 3 -> 3,6 so that input is in correct order
 Ö   Checks if (top of stack % second top of stack) == 0 e.g. 6 % 3 == 0
     Implicitly prints (1 because 6 % 3 = 0)
</code>```

Title: Divisibility test

Body:
05AB1E, <s>2</s> 1 byte

Ö

Try it online!

Was sÖ (Test here) but arguments switched (suggested by @Mego). This allowed me to golf down to 1 byte.

Explanation (old):

s    Reverses input e.g. 6, 3 -> 3,6 so that input is in correct order
 Ö   Checks if (top of stack % second top of stack) == 0 e.g. 6 % 3 == 0
     Implicitly prints (1 because 6 % 3 = 0)


问:
Sum the unique numbers in a list
For this challenge, the objective is to take a list of integers, and output the sum of every unique integer in that list, i.e. count multiples of the same integer only once.

Your input will be a string in the format "{1,2,3,4}" with any amount of elements. The string will never have whitespace or be in a format that does not match the example above. A list with 0 elements should return 0.

Examples

```<code>"{1,2,3,4}" -> 10
"{5,2,5}" -> 7
"{13,13,13}" -> 13
"{-5,5,5}" -> 0
"{12,12,13,13,14,14}" -> 39
"{}" -> 0
"{3}" -> 3
</code>```

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

Good luck!

答:
Python 2, <s>21</s> 18 bytes:

```<code>print sum(input())
</code>```

Title: Sum the unique numbers in a list

Body:
Python 2, <s>21</s> 18 bytes:

print sum(input())


答:
PHP, 34 Bytes

```<code><?=array_sum(array_unique($argv));
</code>```

Title: Sum the unique numbers in a list

Body:
For this challenge, the objective is to take a list of integers, and output the sum of every unique integer in that list, i.e. count multiples of the same integer only once.

Your input will be a string in the format "{1,2,3,4}" with any amount of elements. The string will never have whitespace or be in a format that does not match the example above. A list with 0 elements should return 0.

Examples

```<code>"{1,2,3,4}" -> 10
"{5,2,5}" -> 7
"{13,13,13}" -> 13
"{-5,5,5}" -> 0
"{12,12,13,13,14,14}" -> 39
"{}" -> 0
"{3}" -> 3
</code>```

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

Good luck!

Body:
PHP, 34 Bytes

<?=array_sum(array_unique($argv));


答:
JavaScript (ES6), 61 bytes

```<code>s=>[...new Set(s.slice(1,-1).split`,`)].reduce((s,n)=>+n+s,0)
</code>```

Without the unreasonable input format it's only 39 bytes:

```<code>f=a=>[...new Set(a)].reduce((s,n)=>s+n,0)
</code>```

The ,0 is necessary to work with an empty array.

Title: Sum the unique numbers in a list

Body:
JavaScript (ES6), 61 bytes

s=>[...new Set(s.slice(1,-1).split`,`)].reduce((s,n)=>+n+s,0)

Without the unreasonable input format it's only 39 bytes:

f=a=>[...new Set(a)].reduce((s,n)=>s+n,0)

The ,0 is necessary to work with an empty array.


Title: KITT car ASCII art

Body:
JavaScript, 204 bytes

function g(i){var a=(i%16+16)%16
if(!a)return g(2)
if(1==a%14)return(g(2)+'-').substr(1)
if((1<a)&&(a<8))return Array(a-1).join('-')+'++#'+Array(8-a).join('-')
return g(a-7).split("").reverse().join("")}

Test

function g(i){var a=(i%16+16)%16
if(!a)return g(2)
if(1==a%14)return(g(2)+'-').substr(1)
if((1<a)&&(a<8))return Array(a-1).join('-')+'++#'+Array(8-a).join('-')
return g(a-7).split("").reverse().join("")}

for (var i = 0; i < 16; ++i) {
    console.log(i + '-->' + g(i));
}


答:
Actually, 2 bytes

```<code>≡Σ
</code>```

Try it online!

≡ (eval) evaluates the input, which is thankfully specified in Python's set literal syntax. Σ then sums the set elements.

Title: Sum the unique numbers in a list

Body:
Actually, 2 bytes

≡Σ

Try it online!

≡ (eval) evaluates the input, which is thankfully specified in Python's set literal syntax. Σ then sums the set elements.


答:
MATL, 4 bytes

```<code>Ugus
</code>```

String delimiter in MATL is '.

Try it online!

Explanation

```<code>U    % Implicitly input string and evaluate it. Gives a cell array
g    % Convert to vector
u    % Unique
s    % Sum. Implicitly display
</code>```

Title: Sum the unique numbers in a list

Body:
MATL, 4 bytes

Ugus

String delimiter in MATL is '.

Try it online!

Explanation

U    % Implicitly input string and evaluate it. Gives a cell array
g    % Convert to vector
u    % Unique
s    % Sum. Implicitly display


答:
05AB1E, 9 bytes

```<code>0E¦¨',¡ÙO
</code>```

Try it online!

Explanation

```<code>0          # push 0
 E         # push evaluated input
  ¦¨       # remove brackets
    ',¡    # split on ","
       Ù   # remove duplicates
        O  # sum
</code>```

0E is needed as sum doesn't work on an empty list.

Title: Sum the unique numbers in a list

Body:
05AB1E, 9 bytes

0E¦¨',¡ÙO

Try it online!

Explanation

0          # push 0
 E         # push evaluated input
  ¦¨       # remove brackets
    ',¡    # split on ","
       Ù   # remove duplicates
        O  # sum

0E is needed as sum doesn't work on an empty list.


答:
Jelly, 1 byte

```<code>S
</code>```

TryItOnline

Since command line arguments are passed as a string to Python, it evaluates as a set*.

S then sums the resulting list Jelly will receive.

* except in the empty case (as pointed out by @Dennis) when "{}" evaluates to an empty dictionary, but this gets cast to a list of it's keys, which is an empty list.

Title: Sum the unique numbers in a list

Body:
Jelly, 1 byte

S

TryItOnline

Since command line arguments are passed as a string to Python, it evaluates as a set*.

S then sums the resulting list Jelly will receive.

* except in the empty case (as pointed out by @Dennis) when "{}" evaluates to an empty dictionary, but this gets cast to a list of it's keys, which is an empty list.


问:
Print Triangle Wave of Numbers
Given the amplitude and period for a wave, print the wave. See sample output for more details. The total number of wave forms equals the period, and the height of each wave equals the amplitude. Amplitude and Period are less than 10. You can ignore the trailing spaces but not the leading spaces.</p>

```<code>Sample Input
3 2

Sample Output
  3           3
 232         232
12321 12321 12321 12321
       232         232
        3           3
</code>```

答:
Python - 135 chars

```<code>A,F=map(int,raw_input().split());R=range
for y in R(-A+1,A):print"".join((" %s"%x)[-x<s*y<1]for s in(1,-1)for x in R(1,A)+R(A,-1,-1))*F
</code>```

This version with a leading space is 132 chars

```<code>A,F=map(int,raw_input().split());R=range
for y in R(-A+1,A):print"".join((" %s"%x)[-x<s*y<1]for s in(1,-1)for x in R(A)+R(A,0,-1))*F
</code>```

It also can be considerably shorter if not required to read from stdin or even if the input is comma separated

For comma separated input, the first line becomes

```<code>A,F=input();R=range
</code>```

ContentLicense: CC BY-SA 2.5

Title: Print Triangle Wave of Numbers

Body:
Python - 135 chars

A,F=map(int,raw_input().split());R=range
for y in R(-A+1,A):print"".join((" %s"%x)[-x<s*y<1]for s in(1,-1)for x in R(1,A)+R(A,-1,-1))*F

This version with a leading space is 132 chars

A,F=map(int,raw_input().split());R=range
for y in R(-A+1,A):print"".join((" %s"%x)[-x<s*y<1]for s in(1,-1)for x in R(A)+R(A,0,-1))*F

It also can be considerably shorter if not required to read from stdin or even if the input is comma separated

For comma separated input, the first line becomes

A,F=input();R=range


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

```<code>F )s
</code>```

Try it here!

Yes, I have to spend 3 bytes converting a set to a list because Pyke's sum function errors out on sets.

The space is required because the default behavior for a for-loop in Pyke is to print out the arguments

Title: Sum the unique numbers in a list

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

F )s

Try it here!

Yes, I have to spend 3 bytes converting a set to a list because Pyke's sum function errors out on sets.

The space is required because the default behavior for a for-loop in Pyke is to print out the arguments


答:
Groovy (81 Bytes)

```<code>z={x->Eval.me(x.replaceAll("\\{","\\[").replaceAll("\\}","\\]")).unique().sum()}
</code>```

Try it online:
https://groovyconsole.appspot.com/edit/5074458091978752

28 Bytes if you Use [] as brackets...
z={Eval.me(it).unique().sum()}

Title: Sum the unique numbers in a list

Body:
Groovy (81 Bytes)

z={x->Eval.me(x.replaceAll("\\{","\\[").replaceAll("\\}","\\]")).unique().sum()}

Try it online:
https://groovyconsole.appspot.com/edit/5074458091978752

28 Bytes if you Use [] as brackets...
z={Eval.me(it).unique().sum()}


答:
CJam, <s>16</s> 15 bytes

```<code>l]li*{(s@)@|@}*
</code>```

Try it online

Explanation:

```<code>l]li*            Create a list of n-times the input string.
{(s@)@|@}*       Fold this list by taking out the last character of the first
                 argument and the first character of the second argument and
                 replacing them by their unique set union.
                 e.g.: "aba" "aba" -> "ab" 'a"a"| "ba" -> "ab" "a" "ba"
                       "abc" "abc" -> "ab" 'c"a"| "bc" -> "ab" "ca" "bc
</code>```

Title: Let's do the Wave!

Body:
Input:

A string (the wave-snippet) with a length >= 2.

A positive integer n >= 1.

Output:

We output a single-line wave. We do this by repeating the input string n times.

Challenge rules:

If the first and last character of the input string matches, we only output it once in the total output (i.e. ^_^ of length 2 becomes ^_^_^ and not ^_^^_^).

The input string won't contain any whitespaces/tabs/new-lines/etc.

If your language doesn't support non-ASCII characters, then that's fine. As long as it still complies to the challenge with ASCII-only wave-input.

General rules:

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

Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>_.~"(              length 12
_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(

'°º¤o,¸¸,o¤º°'     length 3
'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'

-__                length 1
-__

-__                length 8
-__-__-__-__-__-__-__-__

-__-               length 8
-__-__-__-__-__-__-__-__-

¯`·.¸¸.·´¯         length 24
¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯

**                 length 6
*******

String & length of your own choice (be creative!)
</code>```

Body:
CJam, <s>16</s> 15 bytes

l]li*{(s@)@|@}*

Try it online

Explanation:

l]li*            Create a list of n-times the input string.
{(s@)@|@}*       Fold this list by taking out the last character of the first
                 argument and the first character of the second argument and
                 replacing them by their unique set union.
                 e.g.: "aba" "aba" -> "ab" 'a"a"| "ba" -> "ab" "a" "ba"
                       "abc" "abc" -> "ab" 'c"a"| "bc" -> "ab" "ca" "bc


答:
Octave, 29 bytes

```<code>@(x)sum(unique([eval(x){:}]))
</code>```

This creates an anonymous function named ans can be called using ans('{1, 2, 3}').

Online demo

Explanation

The eval(x) converts the input string into a cell array of numbers. The [x{:}] converts the cell array of numbers into a normal array of numbers. Then we compute the unique elements and sum the result.

Title: Sum the unique numbers in a list

Body:
Octave, 29 bytes

@(x)sum(unique([eval(x){:}]))

This creates an anonymous function named ans can be called using ans('{1, 2, 3}').

Online demo

Explanation

The eval(x) converts the input string into a cell array of numbers. The [x{:}] converts the cell array of numbers into a normal array of numbers. Then we compute the unique elements and sum the result.


Title: Sum the unique numbers in a list

Body:
R, 51 bytes

s=scan;sum(unique(s(t=gsub("\\{|}|,"," ",s(,"")))))


问:
Let's draw some Atari ST bombs!

Introduction

The Atari ST was a rather popular personal computer from the mid 80's to early 90's era, powered by a Motorola 68000 microprocessor. On this machine, the default behavior of the operating system for uncaught CPU exceptions was to display a row of bombs on the screen, as shown in the following picture:

Source: https://commons.wikimedia.org/wiki/File:Row_of_bombs.png

NB: Depending on the OS version, the bomb graphics may vary slightly. But let's take this one as reference.

The number of bombs depends on the exception vector, the most common ones being:

($008) Bus Error : 2 bombs

($00c) Address Error : 3 bombs

($010) Illegal Instruction : 4 bombs

Goal

Your goal is to write a program or function that prints or outputs an ASCII art of such Atari ST bombs.

Input

An integer representing the number of bombs to display. Your code must support the most common values: 2, 3 and 4. Supporting less and/or more bombs is fine, but it is neither required nor subject to a bonus.

Output

The original bomb consists of a 16x16 pixel tile, represented here in both ASCII and binary:

```<code>....##..........    0000110000000000
.#.#..#.........    0101001000000000
.......#........    0000000100000000
#..#....#.......    1001000010000000
..#...#####.....    0010001111100000
......#####.....    0000001111100000
....#########...    0000111111111000
...###########..    0001111111111100
...###########..    0001111111111100
..#############.    0011111111111110
..########.####.    0011111111011110
...#######.###..    0001111111011100
...######.####..    0001111110111100
....#########...    0000111111111000
.....#######....    0000011111110000
.......###......    0000000111000000
</code>```

In this challenge, each ASCII bomb must be stretched to twice its original width for a better rendering. Therefore, it will consist of 16 rows of 32 characters, using ## for 'ON' pixels and two spaces for 'OFF' pixels. All bomb tiles must be put side by side. Leading spaces are forbidden. Trailing spaces are also forbidden, except the ones that are actually part of the bomb tile (i.e. the 31st and 32nd columns) which must be present. You may include no more than one leading line-break and no more than one trailing line-break.

Example

Below is the reference output for two bombs, where mandatory line-breaks are marked as \n and tolerated extra line-breaks are marked as (\n):

```<code>(\n)
        ####                            ####                    \n
  ##  ##    ##                    ##  ##    ##                  \n
              ##                              ##                \n
##    ##        ##              ##    ##        ##              \n
    ##      ##########              ##      ##########          \n
            ##########                      ##########          \n
        ##################              ##################      \n
      ######################          ######################    \n
      ######################          ######################    \n
    ##########################      ##########################  \n
    ################  ########      ################  ########  \n
      ##############  ######          ##############  ######    \n
      ############  ########          ############  ########    \n
        ##################              ##################      \n
          ##############                  ##############        \n
              ######                          ######            (\n)
</code>```

(Of course, other line-break formats such as \r or \r\n may be used just as well.)

Rules

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

答:
GCC C 129 bytes

ISO8859/ASCII

```<code>f(r,i,d){
    for(;i<32;i+=2,puts(""))
        for(d=15*r;--d;)
             printf((*(int*)&("ÿóÿÿþoÜüðààÀ!ÀCÀCàðø?þ"[i]))&(1<<d%15)?"  ":"##");
}
</code>```

In one line:

```<code>f(r,i,d){for(;i<32;i+=2,puts(""))for(d=15*r;--d;)printf((*(int*)&("ÿóÿÿþoÜüðààÀ!ÀCÀCàðø?þ"[i]))&(1<<d%15)?"  ":"##");}
</code>```

Run with:

```<code>main(c,v)char**v;{f(atoi(v[1]),0)}
</code>```

Compile source as ISO8859-x (ASCII).

NB óÿÿþÿoÜüðààÀÀ!ÀCàCðøþ? should contain the invisible ASCII Codes but it has been broken due to the way StackExchange presents its content.
Please see the ideaone link for proper test encoding
Alternatively the original ASCII String is at :
https://github.com/claydonkey/AtariBombs/blob/master/ISO8859_REPR2.txt

Explanation

First a conversion of the hex representation of bombs
[f3 ff ad ff fe ff 6f 7f dc 1f fc 1f f0 07 e0 03 e0 03 c0 01 c0 21 c0 43 e0 43 f0 07 f8 0f fe 3f] to UTF-8 (in the UTF-8 version the compiler stores the string as Wide Char Array - 2 or 4 bytes for each character at runtime but this is academic). Whereas UTF-8 characters would be stored as 2-4 bytes, these values are all within  ISO-8859-1 (ASCII) and thus only require 1 byte. Also it is safe to be stored as ISO-8859-x (there are no 0x8_ or 0x9_ values). Therefore the text consumes 32 bytes in ISO-8859 and the routine consumes 135 bytes in total.

(NB wide chars are stored as a 16 bit integer in windows and 32bit in linux but again this is irrelevant to the task at hand)

Caveat:  Not all the characters are displayable (the control characters below 0x20) .They are, however still present . Most web pages are utf-8/ 8859/1253 (https://w3techs.com/technologies/overview/character_encoding/all) so I reckon this is legit<s>(shifting all values below 0x20 to printable ASCII should fix that).
</s>

UTF-8

Here is the version closer to the original posting with UTF-8 encoded source.
This consumes 173 bytes. The string itself being 50 bytes of the source.
The routine is also longer as the ASCII bytes are now stored with padding 0's for the 16bit/32bit Wide Chars and have to be shifted instead of casted to uint16_t as above. I have kept this up as it can be verified with ideone which uses UTF-8 encoding.

```<code>*w=L"óÿÿþÿoÜüðààÀÀ!ÀCàCðøþ?";
f(r,i,j,m){
    for(i;i<32;i+=2,puts(""))
        for(j=r;j--;)
            for(m=65536;m>1;(m\=2,printf(((w[i]<<8)+w[i+1]&m)?"  ":"##")));}
</code>```

Run with:

```<code>main(c,v)char**v;{f(atoi(v[1]),0)}
</code>```

If you can set the implicit value to a 16bit integer in your complier you can omit the wchar_t type declaration of the Wide Char. Ideone doesn't complain so I reckon it's good to go.

Try it out on ideone

Title: Let's draw some Atari ST bombs!

Body:
GCC C 129 bytes

ISO8859/ASCII

f(r,i,d){
    for(;i<32;i+=2,puts(""))
        for(d=15*r;--d;)
             printf((*(int*)&("ÿóÿÿþoÜüðààÀ!ÀCÀCàðø?þ"[i]))&(1<<d%15)?"  ":"##");
}

In one line:

f(r,i,d){for(;i<32;i+=2,puts(""))for(d=15*r;--d;)printf((*(int*)&("ÿóÿÿþoÜüðààÀ!ÀCÀCàðø?þ"[i]))&(1<<d%15)?"  ":"##");}

Run with:

main(c,v)char**v;{f(atoi(v[1]),0)}

Compile source as ISO8859-x (ASCII).

NB óÿÿþÿoÜüðààÀÀ!ÀCàCðøþ? should contain the invisible ASCII Codes but it has been broken due to the way StackExchange presents its content.
Please see the ideaone link for proper test encoding
Alternatively the original ASCII String is at :
https://github.com/claydonkey/AtariBombs/blob/master/ISO8859_REPR2.txt

Explanation

First a conversion of the hex representation of bombs
[f3 ff ad ff fe ff 6f 7f dc 1f fc 1f f0 07 e0 03 e0 03 c0 01 c0 21 c0 43 e0 43 f0 07 f8 0f fe 3f] to UTF-8 (in the UTF-8 version the compiler stores the string as Wide Char Array - 2 or 4 bytes for each character at runtime but this is academic). Whereas UTF-8 characters would be stored as 2-4 bytes, these values are all within  ISO-8859-1 (ASCII) and thus only require 1 byte. Also it is safe to be stored as ISO-8859-x (there are no 0x8_ or 0x9_ values). Therefore the text consumes 32 bytes in ISO-8859 and the routine consumes 135 bytes in total.

(NB wide chars are stored as a 16 bit integer in windows and 32bit in linux but again this is irrelevant to the task at hand)

Caveat:  Not all the characters are displayable (the control characters below 0x20) .They are, however still present . Most web pages are utf-8/ 8859/1253 (https://w3techs.com/technologies/overview/character_encoding/all) so I reckon this is legit<s>(shifting all values below 0x20 to printable ASCII should fix that).
</s>

UTF-8

Here is the version closer to the original posting with UTF-8 encoded source.
This consumes 173 bytes. The string itself being 50 bytes of the source.
The routine is also longer as the ASCII bytes are now stored with padding 0's for the 16bit/32bit Wide Chars and have to be shifted instead of casted to uint16_t as above. I have kept this up as it can be verified with ideone which uses UTF-8 encoding.

*w=L"óÿÿþÿoÜüðààÀÀ!ÀCàCðøþ?";
f(r,i,j,m){
    for(i;i<32;i+=2,puts(""))
        for(j=r;j--;)
            for(m=65536;m>1;(m\=2,printf(((w[i]<<8)+w[i+1]&m)?"  ":"##")));}

Run with:

main(c,v)char**v;{f(atoi(v[1]),0)}

If you can set the implicit value to a 16bit integer in your complier you can omit the wchar_t type declaration of the Wide Char. Ideone doesn't complain so I reckon it's good to go.

Try it out on ideone


答:
05AB1E, 33 bytes

Uses CP-1252 encoding.

Gap multiplier is taken as negative when outwards increasing.

```<code>g;>Î.S<_²**ÄU¹vyð²¹g<;N.S*X+DUï×J
</code>```

Try it online!

Title: Movie Title Styled String

Body:
Challenge

Ever seen those movie trailer titles (namely Martian, Interstellar, etc) where they have huge gaps in between letters slowly spreading out?

The challenge is to recreate this effect given a string, gap multiplier and direction, by inserting appropriate amount of spaces in between the letters.

Example

Input: 'INTERSTELLAR', Gap multiplier: 1.0, Direction: Increasing Inward

```<code>Output: I N  T   E    R     S      T     E    L   L  A R
</code>```

The spacing is: [1, 2, 3, ... , 3, 2, 1]; replacing the spaces with '.' to better demonstrate the spacing:

```<code>I.N..T...E....R.....S......T.....E....L...L..A.R
</code>```

Input: 'INTERSTELLAR', Gap multiplier: 0.5, Direction: Increasing Inward

```<code>Output: IN T E  R  S   T  E  L L AR
</code>```

The spacing is multiplied by 0.5, therefore we get [0, 1, 1, 2, ... 2, 1, 1, 0] from integer division; using '.':

```<code>IN.T.E..R..S...T..E..L.L.AR
</code>```

Input: 'CODEGOLF', Gap multiplier: 2.0, Direction: Increasing Outward

```<code>Output: C        O      D    E  G    O      L        F
</code>```

The spacing is multiplied by 2, increasing outward, therefore we get [8,6,4,2,4,6,8]; replacing with '.':

```<code>C........O......D....E..G....O......L........F
</code>```

Input: 'CODEGOLF', Gap multiplier: 0.4, Direction: Increasing Outward

```<code>Output: C O DEGO L F
</code>```

The spacing is multiplied by 0.4, increasing outward, therefore we get [1,1,0,0,0,1,1]; replacing with '.':

```<code>C.O.DEGO.L.F
</code>```

Rules

Takes 3 input: string, gap multiplier and direction

If input string is odd in length (even in # of gaps) e.g. 'HELLO', the spacing of the inner most 2 gaps should be the same H E  L  L O

The direction and gap multiplier can be parsed however you want, e.g. you could use -2 as 'increasing inward with a multiplier of 2', 1 as 'increasing outward with a multiplier of 1', etc.

It is only required to use spaces, however it is a bonus if the character filling is customizable.

Reference Animation

Have fun golfing!

Body:
05AB1E, 33 bytes

Uses CP-1252 encoding.

Gap multiplier is taken as negative when outwards increasing.

g;>Î.S<_²**ÄU¹vyð²¹g<;N.S*X+DUï×J

Try it online!


答:
Ruby, 36 bytes

```<code>$><<eval(gets.scan(/-?\d+/).uniq*?+)
</code>```

Search for all unique "integer-looking" strings in the input and join this list on the string +, then evaluate the resulting string and print the result.

Title: Sum the unique numbers in a list

Body:
For this challenge, the objective is to take a list of integers, and output the sum of every unique integer in that list, i.e. count multiples of the same integer only once.

Your input will be a string in the format "{1,2,3,4}" with any amount of elements. The string will never have whitespace or be in a format that does not match the example above. A list with 0 elements should return 0.

Examples

```<code>"{1,2,3,4}" -> 10
"{5,2,5}" -> 7
"{13,13,13}" -> 13
"{-5,5,5}" -> 0
"{12,12,13,13,14,14}" -> 39
"{}" -> 0
"{3}" -> 3
</code>```

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

Good luck!

Body:
Ruby, 36 bytes

$><<eval(gets.scan(/-?\d+/).uniq*?+)

Search for all unique "integer-looking" strings in the input and join this list on the string +, then evaluate the resulting string and print the result.


答:
BASH + CoreUtils + sed + bc 75 68 50 bytes

Saved a bunch thanks to Digital Trauma and seshoumara

```<code>sed '/{}/c0
s:[}{,]:\n:g'|sort -u|xargs|tr \  +|bc
</code>```

Title: Sum the unique numbers in a list

Body:
BASH + CoreUtils + sed + bc 75 68 50 bytes

Saved a bunch thanks to Digital Trauma and seshoumara

sed '/{}/c0
s:[}{,]:\n:g'|sort -u|xargs|tr \  +|bc


答:
Mathematica, <s>8</s> 9 bytes

```<code>Tr@*Union
</code>```

Union deletes duplicates (and sorts), and Tr totals a list. A rare case when Mathematica can actually compete with golfing languages!

Title: Sum the unique numbers in a list

Body:
Mathematica, <s>8</s> 9 bytes

Tr@*Union

Union deletes duplicates (and sorts), and Tr totals a list. A rare case when Mathematica can actually compete with golfing languages!


答:
Bash + GNU utilities, 54

```<code>eval printf '0%s\\n' $1|tr -d {}|sort -u|paste -sd+|bc
</code>```

Input is given as a command-line parameter.  Note that the input must be quoted to prevent expansion by the calling shell (this would be handy, and save some bytes, but I feel like that would be cheating a bit).

The input format is mostly a bash brace expansion, but it doesn't expand as we want it to for a 0 or 1 element list, so a bit more preprocessing is required before piping to sort -u.

Ideone.

Title: Sum the unique numbers in a list

Body:
Bash + GNU utilities, 54

eval printf '0%s\\n' $1|tr -d {}|sort -u|paste -sd+|bc

Input is given as a command-line parameter.  Note that the input must be quoted to prevent expansion by the calling shell (this would be handy, and save some bytes, but I feel like that would be cheating a bit).

The input format is mostly a bash brace expansion, but it doesn't expand as we want it to for a 0 or 1 element list, so a bit more preprocessing is required before piping to sort -u.

Ideone.


答:
Pyth, 3 bytes

Unfortunately, the sum builtin doesn't work in Pyth with sets.  I have to convert to a list first...

```<code>s[F
</code>```

Explanation:

```<code> [   Construct list
  F  By splatting in the elements of the input
s    Sum up
</code>```

Taking input as a list-type form would actually be a byte shorter:

```<code>s{
</code>```

Which is the sum of the {de-duplicated input.

Title: Sum the unique numbers in a list

Body:
Pyth, 3 bytes

Unfortunately, the sum builtin doesn't work in Pyth with sets.  I have to convert to a list first...

s[F

Explanation:

 [   Construct list
  F  By splatting in the elements of the input
s    Sum up

Taking input as a list-type form would actually be a byte shorter:

s{

Which is the sum of the {de-duplicated input.


答:
Perl, 23 bytes

Includes +1 for -p

Give input string followed by number on separate lines on STDIN

```<code>wave.pl <<< "'°º¤o,¸¸,o¤º°'
3"
</code>```

wave.pl:

```<code>#!/usr/bin/perl -p
$_ x=<>;s/(.)\K
\1?//g
</code>```

If the first character in the word is not a regex special character this 22 bytes version works too:

```<code>#!/usr/bin/perl -p
$_ x=<>;/./;s/
$&?//g
</code>```

Title: Let's do the Wave!

Body:
Perl, 23 bytes

Includes +1 for -p

Give input string followed by number on separate lines on STDIN

wave.pl <<< "'°º¤o,¸¸,o¤º°'
3"

wave.pl:

#!/usr/bin/perl -p
$_ x=<>;s/(.)\K
\1?//g

If the first character in the word is not a regex special character this 22 bytes version works too:

#!/usr/bin/perl -p
$_ x=<>;/./;s/
$&?//g


答:
Pip, 18 bytes

Regex solution, taking advantage of the "no spaces in input" rule. Takes the string from stdin and the number as a command-line argument.

```<code>(q.s)XaR`(.) \1?`B
</code>```

Try it online!

Explanation:

```<code> q.s                Read from stdin and append a space
(   )Xa             String-multiply by first cmdline arg
       R            Replace
        `(.) \1?`     Regex: char followed by space followed by (optional) same char again
                 B    Callback function, short for {b}: return 1st capturing group
</code>```

Thus, a b turns into ab, a a turns into a, and the space at the end of the string is removed. Then the result is autoprinted.

Title: Let's do the Wave!

Body:
Pip, 18 bytes

Regex solution, taking advantage of the "no spaces in input" rule. Takes the string from stdin and the number as a command-line argument.

(q.s)XaR`(.) \1?`B

Try it online!

Explanation:

 q.s                Read from stdin and append a space
(   )Xa             String-multiply by first cmdline arg
       R            Replace
        `(.) \1?`     Regex: char followed by space followed by (optional) same char again
                 B    Callback function, short for {b}: return 1st capturing group

Thus, a b turns into ab, a a turns into a, and the space at the end of the string is removed. Then the result is autoprinted.


Title: Let's do the Wave!

Body:
VBA 119 bytes

New to this game and vba wins with the highest bytes :P

PS: can't believe vba stands close to JAVA HAHA

Function l(s,x)
l=s: s=IIf(Left(s,1)=Right(s,1),Mid(s,2,Len(s)),s)
z: x=x-1: If x>0 Then l=l & s: GoTo z:
End Function

Explanation:

+------------------------------------------------------------+-----------------------------------------------------------------------------------+
|                            code                            |                                     function                                      |
+------------------------------------------------------------+-----------------------------------------------------------------------------------+
| l=s                                                        | input string s is saved to base                                                   |
| s = IIf(Left(s, 1) = Right(s, 1), Right(s, Len(s) - 1), s) | checks whether 1 and last char is equal,                                          |
|                                                            | if yes removes the first char from s and that s will be used to for further joins |
| z:                                                         | z: is a label                                                                     |
| x = x - 1:                                                 | decreases looping round                                                           |
| If x > 0 Then l = l & s: GoTo z:                           | join strings until no more rounds to do                                           |
+------------------------------------------------------------+-----------------------------------------------------------------------------------+


问:
Reverse and Invert a String

Reverse and Invert a String

Challenge

In this challenge. You'll be writing a program which will output or return the input, reversed and inverted.

First, each character should be converted to its character code. Then, that should be converted to base-2. Following, that string should be reversed. After, the string should be inverted (1 -> 0 and 0 -> 1). Finally, that should be converted back to base 2 and then converted back to a character. If an character results to be an unprintable, you may optionally output it but they do not have to be removed.

```<code>H -> 72  -> 1001000 -> 0001001 -> 1110110 -> 118 -> v
e -> 101 -> 1100101 -> 1010011 -> 0101100 -> 44  -> ,
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
, -> 44  -> 101100  -> 001101  -> 110010  -> 50  -> 2
  -> 32  -> 100000  -> 000001  -> 111110  -> 62  -> >
W -> 87  -> 1010111 -> 1110101 -> 0001010 -> 10  -> (newline)
o -> 111 -> 1101111 -> 1111011 -> 0000100 -> 4   -> (unprintable)
r -> 114 -> 1110010 -> 0100111 -> 1011000 -> 88  -> X
l -> 108 -> 1101100 -> 0011011 -> 1100100 -> 100 -> d
d -> 100 -> 1100100 -> 0010011 -> 1101100 -> 108 -> l
! -> 33  -> 100001  -> 100001  -> 011110  -> 30  -> (unprintable)
</code>```

Scoring

Shortest code in bytes wins.

-15% Bonus: if your program removes un-printables from the output. This must be at least all characters below 32 except newlines (char 10)

答:
Retina, <s>1107</s> 629 bytes - 15% = 534.65 (non-competing)

Uses features added after challenge date. (Implicit behavior of $*, ¶, Sorting)

Retina doesn't have a built-in to convert a character to its ASCII ordinal or back... so behold its lustrous length. This handles printable ASCII, and removes unprintables as well as newlines. Byte count assumes ISO 8859-1 encoding.

The code contains unprintable characters.

```<code>
¶
±
S_`
%(S`±
{2`
$`
}T01`-`_o
)Ms`.
\d+
$*
+`(1+)\1
${1}0
01
1
%O$^`.

T`01`10
1
01
+`10
011
0

m`^1{1,31}$

M%`1
m`^0¶?

126
~
125
}
124
|
123
{
122
z
121
y
120
x
119
w
118
v
117
u
116
t
115
s
114
r
113
q
112
p
111
o
110
n
109
m
108
l
107
k
106
j
105
i
104
h
103
g
102
f
101
e
100
d
99
c
98
b
97
a
96
`
95
_
94
^
93
]
92
\
91
[
90
Z
89
Y
88
X
87
W
86
V
85
U
84
T
83
S
82
R
81
Q
80
P
79
O
78
N
77
M
76
L
75
K
74
J
73
I
72
H
71
G
70
F
69
E
68
D
67
C
66
B
65
A
64
@
63
?
62
>
61
=
60
<
59
;
58
:
57
9
56
8
55
7
54
6
32

33
!
34
"
35
#
36
$
37
%
38
&
39
'
40
(
41
)
42
*
43
+
44
,
45
-
46
.
47
/
48
0
49
1
50
2
51
3
52
4
53
5
¶

</code>```

Try it online

If you check out the Retina tutorial for unary arithmetic, you'll recognize several different pieces of my code as coming from there.

Thanks to Martin for golfing off hundred of bytes

Title: Reverse and Invert a String

Body:
Retina, <s>1107</s> 629 bytes - 15% = 534.65 (non-competing)

Uses features added after challenge date. (Implicit behavior of $*, ¶, Sorting)

Retina doesn't have a built-in to convert a character to its ASCII ordinal or back... so behold its lustrous length. This handles printable ASCII, and removes unprintables as well as newlines. Byte count assumes ISO 8859-1 encoding.

The code contains unprintable characters.

¶
±
S_`
%(S`±
{2`
$`
}T01`-`_o
)Ms`.
\d+
$*
+`(1+)\1
${1}0
01
1
%O$^`.

T`01`10
1
01
+`10
011
0

m`^1{1,31}$

M%`1
m`^0¶?

126
~
125
}
124
|
123
{
122
z
121
y
120
x
119
w
118
v
117
u
116
t
115
s
114
r
113
q
112
p
111
o
110
n
109
m
108
l
107
k
106
j
105
i
104
h
103
g
102
f
101
e
100
d
99
c
98
b
97
a
96
`
95
_
94
^
93
]
92
\
91
[
90
Z
89
Y
88
X
87
W
86
V
85
U
84
T
83
S
82
R
81
Q
80
P
79
O
78
N
77
M
76
L
75
K
74
J
73
I
72
H
71
G
70
F
69
E
68
D
67
C
66
B
65
A
64
@
63
?
62
>
61
=
60
<
59
;
58
:
57
9
56
8
55
7
54
6
32

33
!
34
"
35
#
36
$
37
%
38
&
39
'
40
(
41
)
42
*
43
+
44
,
45
-
46
.
47
/
48
0
49
1
50
2
51
3
52
4
53
5
¶

<a href="http://retina.tryitonline.net/#code=wrYKwrEKU19gCiUoU2DCsQp7MmAKJGAKfVQwMWABLX9gX28KKU1zYC4KXGQrCiQqCitgKDErKVwxCiR7MX0wCjAxCjEKJU8kXmAuCgpUYDAxYDEwCjEKMDEKK2AxMAowMTEKMAoKbWBeMXsxLDMxfSQKCk0lYDEKbWBeMMK2PwoKMTI2Cn4KMTI1Cn0KMTI0CnwKMTIzCnsKMTIyCnoKMTIxCnkKMTIwCngKMTE5CncKMTE4CnYKMTE3CnUKMTE2CnQKMTE1CnMKMTE0CnIKMTEzCnEKMTEyCnAKMTExCm8KMTEwCm4KMTA5Cm0KMTA4CmwKMTA3CmsKMTA2CmoKMTA1CmkKMTA0CmgKMTAzCmcKMTAyCmYKMTAxCmUKMTAwCmQKOTkKYwo5OApiCjk3CmEKOTYKYAo5NQpfCjk0Cl4KOTMKXQo5MgpcCjkxClsKOTAKWgo4OQpZCjg4ClgKODcKVwo4NgpWCjg1ClUKODQKVAo4MwpTCjgyClIKODEKUQo4MApQCjc5Ck8KNzgKTgo3NwpNCjc2CkwKNzUKSwo3NApKCjczCkkKNzIKSAo3MQpHCjcwCkYKNjkKRQo2OApECjY3CkMKNjYKQgo2NQpBCjY0CkAKNjMKPwo2Mgo-CjYxCj0KNjAKPAo1OQo7CjU4CjoKNTcKOQo1Ngo4CjU1CjcKNTQKNgozMgogCjMzCiEKMzQKIgozNQojCjM2CiQKMzcKJQozOAomCjM5CicKNDAKKAo0MQopCjQyCioKNDMKKwo0NAosCjQ1Ci0KNDYKLgo0NwovCjQ4CjAKNDkKMQo1MAoyCjUxCjMKNTIKNAo1Mwo1CsK2Cg&input=SGVsbG8sIFdvcmxkIQ" rel="nofollow noreferrer">Try it online

If you check out the Retina tutorial for unary arithmetic, you'll recognize several different pieces of my code as coming from there.

Thanks to Martin for golfing off hundred of bytes


问:
Super Folding Numbers
We have already defined a folding number here.

But now we are going to define a Super Folding Number.  A Super Folding number is a number that if folded enough times it will eventually reach one less than a power of two.  The method of folding is slightly different than in the folding number question.

The folding algorithm goes as follows:

Take the binary representation

e.g. 5882

```<code>1011011111010
</code>```

Spilt it into three partitions.  First half, last half and middle digit (iff it has a odd number of digits)

```<code>101101 1 111010
</code>```

If the middle digit is zero this number cannot be folded

Reverse the second half and superimposed on the first half

```<code>010111
101101
</code>```

Add the digits in place

```<code>111212
</code>```

Iff there are any 2s in the result the number cannot be folded otherwise the new number is the result of the folding algorithm.

A number is a Super Folding number if it can be folded to a continuous string of ones. (All Folding numbers are also Super Folding Numbers)

Your task is to write code that takes in a number and outputs a truthy value if the number is a Super Folding number and falsy otherwise.  You will be scored on the size of your program.

Examples

5200

Convert to binary:

```<code>1010001010000
</code>```

Split in half:

```<code>101000 1 010000
</code>```

The middle is one so we continue
Superimpose the halves:

```<code>000010
101000
</code>```

Added them:

```<code>101010
</code>```

No twos so we continue
Split in half:

```<code>101 010
</code>```

Fold:

```<code>010
101

111
</code>```

The result is 111 (7 in decimal) so this is a Super Folding Number.

Test Cases

The first 100 Super Folding Numbers are:

```<code>101101 1 111010
</code>```0

Title: Super Folding Numbers

Body:
PHP, 197 Bytes

function f($b){if(!$b)return;if(!strpos($b,"0"))return 1;for($n="",$i=0;$i<($l=strlen($b))>>1;)$n.=$b[$i]+$b[$l-++$i];if($l%2&&!$b[$i]||strstr($n,"2"))return;return f($n);}echo f(decbin($argv[1]));

Expanded

function f($b){
    if(!$b)return; # remove 0
    if(!strpos($b,"0"))return 1; # say okay alternative preg_match("#^1+$#",$b)
    for($n="",$i=0;$i<($l=strlen($b))>>1;)$n.=$b[$i]+$b[$l-++$i]; #add first half and second reverse
    if($l%2&&!$b[$i]||strstr($n,"2"))return; #if middle == zero or in new string is a 2 then it's not a number that we search
    return f($n); #recursive beginning
}
echo f(decbin($argv[1]));

True values < 10000

1, 2, 3, 6, 7, 8, 10, 12, 15, 20, 22, 28, 31, 34, 38, 42, 48, 52, 56, 63, 74, 78, 90, 104, 108, 120, 127, 128, 130, 132, 142, 150, 160, 170, 178, 192, 204, 212, 232, 240, 255, 272, 274, 276, 286, 310, 336, 346, 370, 400, 412, 436, 472, 496, 511, 516, 518, 524, 542, 558, 580, 598, 614, 640, 642, 648, 666, 682, 704, 722, 738, 772, 796, 812, 852, 868, 896, 920, 936, 976, 992, 1023, 1060, 1062, 1068, 1086, 1134, 1188, 1206, 1254, 1312, 1314, 1320, 1338, 1386, 1440, 1458, 1506, 1572, 1596, 1644, 1716, 1764, 1824, 1848, 1896, 1968, 2016, 2047, 2050, 2054, 2058, 2064, 2068, 2072, 2110, 2142, 2176, 2180, 2184, 2222, 2254, 2306, 2320, 2358, 2390, 2432, 2470, 2502, 2562, 2576, 2618, 2650, 2688, 2730, 2762, 2866, 2898, 2978, 3010, 3072, 3076, 3080, 3132, 3164, 3244, 3276, 3328, 3380, 3412, 3492, 3524, 3584, 3640, 3672, 3752, 3784, 3888, 3920, 4000, 4032, 4095, 4162, 4166, 4170, 4176, 4180, 4184, 4222, 4318, 4416, 4420, 4424, 4462, 4558, 4674, 4688, 4726, 4822, 4928, 4966, 5062, 5186, 5200, 5242, 5338, 5440, 5482, 5578, 5746, 5842, 5986, 6082, 6208, 6212, 6216, 6268, 6364, 6508, 6604, 6720, 6772, 6868, 7012, 7108, 7232, 7288, 7384, 7528, 7624, 7792, 7888, 8032, 8128, 8191, 8202, 8206, 8218, 8232, 8236, 8248, 8318, 8382, 8456, 8460, 8472, 8542, 8606, 8714, 8744, 8814, 8878, 8968, 9038, 9102, 9218, 9222, 9234, 9248, 9252, 9264, 9334, 9398, 9472, 9476, 9488, 9558, 9622, 9730, 9760, 9830, 9894, 9984


答:
Javascript ES6, 49 chars

```<code>(s,n)=>s.replace(/(.).*?(?=\1?$)/,m=>m.repeat(n))
</code>```

Test:

f=(s,n)=>s.replace(/(.).*?(?=\1?$)/,m=>m.repeat(n))
console.log(document.querySelector("pre").textContent.split(`
`).map(s=>s.split` `).every(([s,n,k])=>f(s,n)==k))```
<pre class="snippet-code-html lang-html prettyprint-override"><code>```_.~"( 12 _.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(
'°º¤o,¸¸,o¤º°' 3 '°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'
-__ 1 -__
-__ 8 -__-__-__-__-__-__-__-__
-__- 8 -__-__-__-__-__-__-__-__-
¯`·.¸¸.·´¯ 24 ¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯
** 6 *******```</code>```

Title: Let's do the Wave!

Body:
Input:

A string (the wave-snippet) with a length >= 2.

A positive integer n >= 1.

Output:

We output a single-line wave. We do this by repeating the input string n times.

Challenge rules:

If the first and last character of the input string matches, we only output it once in the total output (i.e. ^_^ of length 2 becomes ^_^_^ and not ^_^^_^).

The input string won't contain any whitespaces/tabs/new-lines/etc.

If your language doesn't support non-ASCII characters, then that's fine. As long as it still complies to the challenge with ASCII-only wave-input.

General rules:

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

Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.

Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters, full programs. Your call.

Default Loopholes are forbidden.

If possible, please add a link with a test for your code.

Also, please add an explanation if necessary.

Test cases:

```<code>_.~"(              length 12
_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(

'°º¤o,¸¸,o¤º°'     length 3
'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'

-__                length 1
-__

-__                length 8
-__-__-__-__-__-__-__-__

-__-               length 8
-__-__-__-__-__-__-__-__-

¯`·.¸¸.·´¯         length 24
¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯

**                 length 6
*******

String & length of your own choice (be creative!)
</code>```

Body:
Javascript ES6, 49 chars

(s,n)=>s.replace(/(.).*?(?=\1?$)/,m=>m.repeat(n))

Test:

f=(s,n)=>s.replace(/(.).*?(?=\1?$)/,m=>m.repeat(n))
console.log(document.querySelector("pre").textContent.split(`
`).map(s=>s.split` `).every(([s,n,k])=>f(s,n)==k))

<pre>_.~"( 12 _.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(_.~"(
'°º¤o,¸¸,o¤º°' 3 '°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'°º¤o,¸¸,o¤º°'
-__ 1 -__
-__ 8 -__-__-__-__-__-__-__-__
-__- 8 -__-__-__-__-__-__-__-__-
¯`·.¸¸.·´¯ 24 ¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯
** 6 *******</pre>