答:
Scala, 73 70 bytes

```<code>def g(s:String):String=if(s=="")""else(0 to 9 flatMap(s+_))++g(s.init)
</code>```

Call it like f("INVALID").
Returns a Sequence of Chars.

Explanation

```<code>def g(s:String):String= //defines a method g taking a String as a parameter
                        //and returning a String
if(s=="")""             //guard to prevent infinite recursion
else
    (0 to 9             //create a Range from 0 to 9 (inclusive)
    flatMap(            //map:
        s+_                 //append each number to the string
    ))                  //and flatten
    ++ g(s.init)        //concatenate with g applied to everything but the last element of s
</code>```

Alternative solution, 73 bytes

```<code>(s:String)=>s.scanLeft("")(_+_).tail.reverse.flatMap(x=>(0 to 9)map(x+_))
</code>```

defines an anonymous function. To call it, write

```<code>val f = ...
</code>```

and call it like this

```<code>f("INVALID")
</code>```

It returns a sequence of strings, which will look like this when printed:

```<code>Vector(INVALID0, INVALID1, INVALID2, INVALID3, INVALID4, INVALID5, INVALID6, INVALID7, INVALID8, INVALID9, INVALI0, INVALI1, INVALI2, INVALI3, INVALI4, INVALI5, INVALI6, INVALI7, INVALI8, INVALI9, INVAL0, INVAL1, INVAL2, INVAL3, INVAL4, INVAL5, INVAL6, INVAL7, INVAL8, INVAL9, INVA0, INVA1, INVA2, INVA3, INVA4, INVA5, INVA6, INVA7, INVA8, INVA9, INV0, INV1, INV2, INV3, INV4, INV5, INV6, INV7, INV8, INV9, IN0, IN1, IN2, IN3, IN4, IN5, IN6, IN7, IN8, IN9, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9)
</code>```

Explanation

```<code>s.scanLeft("")(_+_)    //accumulate letters from left to right -> Vector("", "I", "IN", "INV", "INVA", "INVAL", "INVALI", "INVALID")
.tail                  //drop the first element
.reverse               //reverse it
.flatMap(x =>          //map each element called x
    (0 to 9)           //create a Range from 0 to 9 (inclusive)
    map(x+_)           //append each number to x
)                      //and flatten
</code>```

Title: Invalid Invali Inval

Body:
This idea is loosely based upon @TùxCräftîñg's chat message.

Take a look at the below example sequence:

INVALID0, INVALID1, INVALID2 INVALID3, INVALID4... INVALID9

After INVALID9, it goes on like this:

INVALI0, INVALI1, INVALI2, INVALI3... INVALI9

And after INVALI9, it's like this:

INVAL0,INVAL1, INVAL2, INVAL3... INVAL9

After, INVAL9, it's like this:

INVA0, INVA1, INVA2, INVA3, ... INVA9

Notice how we we kept removing a letter from the word INVALID each time.

You'll keep repeating this until you reach a single letter, that is, the letter I:

I0, I1, I2, I3, I4 ... I9

Now, your task is, to take an input of a word, and produce a sequence from it like the above example. Your code must also work with single letters, and in that case the resulting sequence will be shorter.

You may choose any input and output format that you prefer (with or without a separator, as you wish), but you must specify which one you have chosen.

The sequence needs to be in the exact specified order.

The shortest code, in bytes, that successfully completes this challenge, wins the challenge.

Full sequence in the above example:

```<code>INVALID0, INVALID1, INVALID2, INVALID3, INVALID4, INVALID5, INVALID6, INVALID7, INVALID8, INVALID9, INVALI0, INVALI1, INVALI2, INVALI3, INVALI4, INVALI5, INVALI6, INVALI7, INVALI8, INVALI9, INVAL0, INVAL1, INVAL2, INVAL3, INVAL4, INVAL5, INVAL6, INVAL7, INVAL8, INVAL9, INVA0, INVA1, INVA2, INVA3, INVA4, INVA5, INVA6, INVA7, INVA8, INVA9, INV0, INV1, INV2, INV3, INV4, INV5, INV6, INV7, INV8, INV9, IN0, IN1, IN2, IN3, IN4, IN5, IN6, IN7, IN8, IN9, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9
</code>```

Other examples:

Input: MAYBE (Uppercase and lowercase don't matter)

Output:

```<code>MAYBE0, MAYBE1, MAYBE2, MAYBE3, MAYBE4, MAYBE5, MAYBE6, MAYBE7, MAYBE8, MAYBE9, MAYB0, MAYB1, MAYB2, MAYB3, MAYB4, MAYB5, MAYB6, MAYB7, MAYB8, MAYB9, MAY0, MAY1, MAY2, MAY3, MAY4, MAY5, MAY6, MAY7, MAY8, MAY9, MA0, MA1, MA2, MA3, MA4, MA5, MA6, MA7, MA8, MA9, M0, M1, M2, M3, M4, M5, M6, M7, M8, M9
</code>```

Input: AFTER

Output:

```<code>AFTER0, AFTER1, AFTER2, AFTER3, AFTER4, AFTER5, AFTER6, AFTER7, AFTER8, AFTER9, AFTE0, AFTE1, AFTE2, AFTE3, AFTE4, AFTE5, AFTE6, AFTE7, AFTE8, AFTE9, AFT0, AFT1, AFT2, AFT3, AFT4, AFT5, AFT6, AFT7, AFT8, AFT9, AF0, AF1, AF2, AF3, AF4, AF5, AF6, AF7, AF8, AF9, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9
</code>```

Input: WHAT ARE YOU DOING

```<code>WHAT ARE YOU DOING0, WHAT ARE YOU DOING1, WHAT ARE YOU DOING2, WHAT ARE YOU DOING3, WHAT ARE YOU DOING4, WHAT ARE YOU DOING5, WHAT ARE YOU DOING6, WHAT ARE YOU DOING7, WHAT ARE YOU DOING8, WHAT ARE YOU DOING9, WHAT ARE YOU DOIN0, WHAT ARE YOU DOIN1, WHAT ARE YOU DOIN2, WHAT ARE YOU DOIN3, WHAT ARE YOU DOIN4, WHAT ARE YOU DOIN5, WHAT ARE YOU DOIN6, WHAT ARE YOU DOIN7, WHAT ARE YOU DOIN8, WHAT ARE YOU DOIN9, WHAT ARE YOU DOI0, WHAT ARE YOU DOI1, WHAT ARE YOU DOI2, WHAT ARE YOU DOI3, WHAT ARE YOU DOI4, WHAT ARE YOU DOI5, WHAT ARE YOU DOI6, WHAT ARE YOU DOI7, WHAT ARE YOU DOI8, WHAT ARE YOU DOI9, WHAT ARE YOU DO0, WHAT ARE YOU DO1, WHAT ARE YOU DO2, WHAT ARE YOU DO3, WHAT ARE YOU DO4, WHAT ARE YOU DO5, WHAT ARE YOU DO6, WHAT ARE YOU DO7, WHAT ARE YOU DO8, WHAT ARE YOU DO9, WHAT ARE YOU D0, WHAT ARE YOU D1, WHAT ARE YOU D2, WHAT ARE YOU D3, WHAT ARE YOU D4, WHAT ARE YOU D5, WHAT ARE YOU D6, WHAT ARE YOU D7, WHAT ARE YOU D8, WHAT ARE YOU D9, WHAT ARE YOU 0, WHAT ARE YOU 1, WHAT ARE YOU 2, WHAT ARE YOU 3, WHAT ARE YOU 4, WHAT ARE YOU 5, WHAT ARE YOU 6, WHAT ARE YOU 7, WHAT ARE YOU 8, WHAT ARE YOU 9, WHAT ARE YOU0, WHAT ARE YOU1, WHAT ARE YOU2, WHAT ARE YOU3, WHAT ARE YOU4, WHAT ARE YOU5, WHAT ARE YOU6, WHAT ARE YOU7, WHAT ARE YOU8, WHAT ARE YOU9, WHAT ARE YO0, WHAT ARE YO1, WHAT ARE YO2, WHAT ARE YO3, WHAT ARE YO4, WHAT ARE YO5, WHAT ARE YO6, WHAT ARE YO7, WHAT ARE YO8, WHAT ARE YO9, WHAT ARE Y0, WHAT ARE Y1, WHAT ARE Y2, WHAT ARE Y3, WHAT ARE Y4, WHAT ARE Y5, WHAT ARE Y6, WHAT ARE Y7, WHAT ARE Y8, WHAT ARE Y9, WHAT ARE 0, WHAT ARE 1, WHAT ARE 2, WHAT ARE 3, WHAT ARE 4, WHAT ARE 5, WHAT ARE 6, WHAT ARE 7, WHAT ARE 8, WHAT ARE 9, WHAT ARE0, WHAT ARE1, WHAT ARE2, WHAT ARE3, WHAT ARE4, WHAT ARE5, WHAT ARE6, WHAT ARE7, WHAT ARE8, WHAT ARE9, WHAT AR0, WHAT AR1, WHAT AR2, WHAT AR3, WHAT AR4, WHAT AR5, WHAT AR6, WHAT AR7, WHAT AR8, WHAT AR9, WHAT A0, WHAT A1, WHAT A2, WHAT A3, WHAT A4, WHAT A5, WHAT A6, WHAT A7, WHAT A8, WHAT A9, WHAT 0, WHAT 1, WHAT 2, WHAT 3, WHAT 4, WHAT 5, WHAT 6, WHAT 7, WHAT 8, WHAT 9, WHAT0, WHAT1, WHAT2, WHAT3, WHAT4, WHAT5, WHAT6, WHAT7, WHAT8, WHAT9, WHA0, WHA1, WHA2, WHA3, WHA4, WHA5, WHA6, WHA7, WHA8, WHA9, WH0, WH1, WH2, WH3, WH4, WH5, WH6, WH7, WH8, WH9, W0, W1, W2, W3, W4, W5, W6, W7, W8, W9
</code>```

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Scala, 73 70 bytes

def g(s:String):String=if(s=="")""else(0 to 9 flatMap(s+_))++g(s.init)

Call it like f("INVALID").
Returns a Sequence of Chars.

Explanation

def g(s:String):String= //defines a method g taking a String as a parameter
                        //and returning a String
if(s=="")""             //guard to prevent infinite recursion
else
    (0 to 9             //create a Range from 0 to 9 (inclusive)
    flatMap(            //map:
        s+_                 //append each number to the string
    ))                  //and flatten
    ++ g(s.init)        //concatenate with g applied to everything but the last element of s

Alternative solution, 73 bytes

(s:String)=>s.scanLeft("")(_+_).tail.reverse.flatMap(x=>(0 to 9)map(x+_))

defines an anonymous function. To call it, write

val f = ...

and call it like this

f("INVALID")

It returns a sequence of strings, which will look like this when printed:

Vector(INVALID0, INVALID1, INVALID2, INVALID3, INVALID4, INVALID5, INVALID6, INVALID7, INVALID8, INVALID9, INVALI0, INVALI1, INVALI2, INVALI3, INVALI4, INVALI5, INVALI6, INVALI7, INVALI8, INVALI9, INVAL0, INVAL1, INVAL2, INVAL3, INVAL4, INVAL5, INVAL6, INVAL7, INVAL8, INVAL9, INVA0, INVA1, INVA2, INVA3, INVA4, INVA5, INVA6, INVA7, INVA8, INVA9, INV0, INV1, INV2, INV3, INV4, INV5, INV6, INV7, INV8, INV9, IN0, IN1, IN2, IN3, IN4, IN5, IN6, IN7, IN8, IN9, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9)

Explanation

s.scanLeft("")(_+_)    //accumulate letters from left to right -> Vector("", "I", "IN", "INV", "INVA", "INVAL", "INVALI", "INVALID")
.tail                  //drop the first element
.reverse               //reverse it
.flatMap(x =>          //map each element called x
    (0 to 9)           //create a Range from 0 to 9 (inclusive)
    map(x+_)           //append each number to x
)                      //and flatten


问:
Invalid Invali Inval
This idea is loosely based upon @TùxCräftîñg's chat message.

Take a look at the below example sequence:

INVALID0, INVALID1, INVALID2 INVALID3, INVALID4... INVALID9

After INVALID9, it goes on like this:

INVALI0, INVALI1, INVALI2, INVALI3... INVALI9

And after INVALI9, it's like this:

INVAL0,INVAL1, INVAL2, INVAL3... INVAL9

After, INVAL9, it's like this:

INVA0, INVA1, INVA2, INVA3, ... INVA9

Notice how we we kept removing a letter from the word INVALID each time.

You'll keep repeating this until you reach a single letter, that is, the letter I:

I0, I1, I2, I3, I4 ... I9

Now, your task is, to take an input of a word, and produce a sequence from it like the above example. Your code must also work with single letters, and in that case the resulting sequence will be shorter.

You may choose any input and output format that you prefer (with or without a separator, as you wish), but you must specify which one you have chosen.

The sequence needs to be in the exact specified order.

The shortest code, in bytes, that successfully completes this challenge, wins the challenge.

Full sequence in the above example:

```<code>INVALID0, INVALID1, INVALID2, INVALID3, INVALID4, INVALID5, INVALID6, INVALID7, INVALID8, INVALID9, INVALI0, INVALI1, INVALI2, INVALI3, INVALI4, INVALI5, INVALI6, INVALI7, INVALI8, INVALI9, INVAL0, INVAL1, INVAL2, INVAL3, INVAL4, INVAL5, INVAL6, INVAL7, INVAL8, INVAL9, INVA0, INVA1, INVA2, INVA3, INVA4, INVA5, INVA6, INVA7, INVA8, INVA9, INV0, INV1, INV2, INV3, INV4, INV5, INV6, INV7, INV8, INV9, IN0, IN1, IN2, IN3, IN4, IN5, IN6, IN7, IN8, IN9, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9
</code>```

Other examples:

Input: MAYBE (Uppercase and lowercase don't matter)

Output:

```<code>MAYBE0, MAYBE1, MAYBE2, MAYBE3, MAYBE4, MAYBE5, MAYBE6, MAYBE7, MAYBE8, MAYBE9, MAYB0, MAYB1, MAYB2, MAYB3, MAYB4, MAYB5, MAYB6, MAYB7, MAYB8, MAYB9, MAY0, MAY1, MAY2, MAY3, MAY4, MAY5, MAY6, MAY7, MAY8, MAY9, MA0, MA1, MA2, MA3, MA4, MA5, MA6, MA7, MA8, MA9, M0, M1, M2, M3, M4, M5, M6, M7, M8, M9
</code>```

Input: AFTER

Output:

```<code>AFTER0, AFTER1, AFTER2, AFTER3, AFTER4, AFTER5, AFTER6, AFTER7, AFTER8, AFTER9, AFTE0, AFTE1, AFTE2, AFTE3, AFTE4, AFTE5, AFTE6, AFTE7, AFTE8, AFTE9, AFT0, AFT1, AFT2, AFT3, AFT4, AFT5, AFT6, AFT7, AFT8, AFT9, AF0, AF1, AF2, AF3, AF4, AF5, AF6, AF7, AF8, AF9, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9
</code>```

Input: WHAT ARE YOU DOING

```<code>WHAT ARE YOU DOING0, WHAT ARE YOU DOING1, WHAT ARE YOU DOING2, WHAT ARE YOU DOING3, WHAT ARE YOU DOING4, WHAT ARE YOU DOING5, WHAT ARE YOU DOING6, WHAT ARE YOU DOING7, WHAT ARE YOU DOING8, WHAT ARE YOU DOING9, WHAT ARE YOU DOIN0, WHAT ARE YOU DOIN1, WHAT ARE YOU DOIN2, WHAT ARE YOU DOIN3, WHAT ARE YOU DOIN4, WHAT ARE YOU DOIN5, WHAT ARE YOU DOIN6, WHAT ARE YOU DOIN7, WHAT ARE YOU DOIN8, WHAT ARE YOU DOIN9, WHAT ARE YOU DOI0, WHAT ARE YOU DOI1, WHAT ARE YOU DOI2, WHAT ARE YOU DOI3, WHAT ARE YOU DOI4, WHAT ARE YOU DOI5, WHAT ARE YOU DOI6, WHAT ARE YOU DOI7, WHAT ARE YOU DOI8, WHAT ARE YOU DOI9, WHAT ARE YOU DO0, WHAT ARE YOU DO1, WHAT ARE YOU DO2, WHAT ARE YOU DO3, WHAT ARE YOU DO4, WHAT ARE YOU DO5, WHAT ARE YOU DO6, WHAT ARE YOU DO7, WHAT ARE YOU DO8, WHAT ARE YOU DO9, WHAT ARE YOU D0, WHAT ARE YOU D1, WHAT ARE YOU D2, WHAT ARE YOU D3, WHAT ARE YOU D4, WHAT ARE YOU D5, WHAT ARE YOU D6, WHAT ARE YOU D7, WHAT ARE YOU D8, WHAT ARE YOU D9, WHAT ARE YOU 0, WHAT ARE YOU 1, WHAT ARE YOU 2, WHAT ARE YOU 3, WHAT ARE YOU 4, WHAT ARE YOU 5, WHAT ARE YOU 6, WHAT ARE YOU 7, WHAT ARE YOU 8, WHAT ARE YOU 9, WHAT ARE YOU0, WHAT ARE YOU1, WHAT ARE YOU2, WHAT ARE YOU3, WHAT ARE YOU4, WHAT ARE YOU5, WHAT ARE YOU6, WHAT ARE YOU7, WHAT ARE YOU8, WHAT ARE YOU9, WHAT ARE YO0, WHAT ARE YO1, WHAT ARE YO2, WHAT ARE YO3, WHAT ARE YO4, WHAT ARE YO5, WHAT ARE YO6, WHAT ARE YO7, WHAT ARE YO8, WHAT ARE YO9, WHAT ARE Y0, WHAT ARE Y1, WHAT ARE Y2, WHAT ARE Y3, WHAT ARE Y4, WHAT ARE Y5, WHAT ARE Y6, WHAT ARE Y7, WHAT ARE Y8, WHAT ARE Y9, WHAT ARE 0, WHAT ARE 1, WHAT ARE 2, WHAT ARE 3, WHAT ARE 4, WHAT ARE 5, WHAT ARE 6, WHAT ARE 7, WHAT ARE 8, WHAT ARE 9, WHAT ARE0, WHAT ARE1, WHAT ARE2, WHAT ARE3, WHAT ARE4, WHAT ARE5, WHAT ARE6, WHAT ARE7, WHAT ARE8, WHAT ARE9, WHAT AR0, WHAT AR1, WHAT AR2, WHAT AR3, WHAT AR4, WHAT AR5, WHAT AR6, WHAT AR7, WHAT AR8, WHAT AR9, WHAT A0, WHAT A1, WHAT A2, WHAT A3, WHAT A4, WHAT A5, WHAT A6, WHAT A7, WHAT A8, WHAT A9, WHAT 0, WHAT 1, WHAT 2, WHAT 3, WHAT 4, WHAT 5, WHAT 6, WHAT 7, WHAT 8, WHAT 9, WHAT0, WHAT1, WHAT2, WHAT3, WHAT4, WHAT5, WHAT6, WHAT7, WHAT8, WHAT9, WHA0, WHA1, WHA2, WHA3, WHA4, WHA5, WHA6, WHA7, WHA8, WHA9, WH0, WH1, WH2, WH3, WH4, WH5, WH6, WH7, WH8, WH9, W0, W1, W2, W3, W4, W5, W6, W7, W8, W9
</code>```

Leaderboard

var QUESTION_ID=92156,OVERRIDE_USER=58717;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+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

```

答:
Ruby, <s>90</s> 85 bytes

```<code>f=->s{if s=="";return[];end;(0..9).map{|i|s+i.to_s}+f[s.chars.take(s.length-1).join]}
</code>```

If the string is empty, return a empty array. Otherwise, generate the string + the number in each number from 0 to 9, and call f with the string without the last character.

Saved 5 bytes thanks to @LevelRiverSt

ContentLicense: CC BY-SA 3.0

Title: Invalid Invali Inval

Body:
Ruby, <s>90</s> 85 bytes

f=->s{if s=="";return[];end;(0..9).map{|i|s+i.to_s}+f[s.chars.take(s.length-1).join]}

If the string is empty, return a empty array. Otherwise, generate the string + the number in each number from 0 to 9, and call f with the string without the last character.

Saved 5 bytes thanks to @LevelRiverSt


问:
Convert the Binary Champernowne Constant to Decimal
The Champernowne constant is a transcendental decimal number whose digits are the concatination of all positive integers.

C10 =  0.12345678910111213141516...10

The binary version of this is

C2 = 0.1101110010111011110001...2

Write a program that prints C2 in decimal.  The program should never halt.  It should continue printing digits such that given infinite time and memory, it will print an infinite number of correct digits.

To illustrate this, you must account for integer overflow, since integer overflow will either cause an error or print incorrect digits, even with infinite memory available.

To test your code, here are the first 150 digits of this number.

```<code>0.862240125868054571557790283249394578565764742768299094516071214557306740590516458042038441438618133400466718933678923129464456214392016383510596824661
</code>```

Shortest code wins.

答:
Mathematica 73 65 85

Edit:

```<code>s = {}; n = 1; While[n < 50, s = Join[s, IntegerDigits[n, 2]];
Print[N[FromDigits[{s, 0}, 2], n]]; n++]
</code>```

Explanation:

s holds the base-2 digits of 1, 2, 3,...n, as a list of digits, {1,1,0,1,1,1,0,0,...}. Then  FromDigits inserts the decimal point (with the 2 indicating the position), treating the input as a base-2 decimal and generating a base-10 decimal as output.

Using the built-in function: 51 chars

```<code>n=1;While[True,Print@N[ChampernowneNumber@2,n];n++]
</code>```

Body:
Mathematica 73 65 85

Edit:

s = {}; n = 1; While[n < 50, s = Join[s, IntegerDigits[n, 2]];
Print[N[FromDigits[{s, 0}, 2], n]]; n++]

Explanation:

s holds the base-2 digits of 1, 2, 3,...n, as a list of digits, {1,1,0,1,1,1,0,0,...}. Then  FromDigits inserts the decimal point (with the 2 indicating the position), treating the input as a base-2 decimal and generating a base-10 decimal as output.

Using the built-in function: 51 chars

n=1;While[True,Print@N[ChampernowneNumber@2,n];n++]


问:
Slowly turn a string into another

The Challenge

Given two strings/an array of strings, output the first string slowly shrinking and expanding back into the second string.

You can assume the strings will always start with the same character.

Example

```<code>Input:
"Test", "Testing"

Output:
Test
Tes
Te
T
Te
Tes
Test
Testi
Testin
Testing
</code>```

First you output the first word:

```<code>Test
</code>```

Then you keep removing one letter until the string is one character long:

```<code>Tes
Te
T
</code>```

Then keep adding one letter of the second word until it's done:

```<code>Te
Tes
Test
Testi
Testin
Testing
</code>```

(if both strings are one character long, then just output one of them once.)

Test Cases

```<code>"Hello!", "Hi."
Hello!
Hello
Hell
Hel
He
H
Hi
Hi.

"O", "O"

O

"z", "zz"

z
zz

".vimrc", ".minecraft"

.vimrc
.vimr
.vim
.vi
.v
.
.m
.mi
.min
.mine
.minec
.minecr
.minecra
.minecraf
.minecraft

"     ", "   "

SSSSS
SSSS
SSS
SS
S
SS
SSS

"0123456789", "02468"

0123456789
012345678
01234567
0123456
012345
01234
0123
012
01
0
02
024
0246
02468
</code>```

(note: on the space/fourth test case, replace the S with spaces)

Rules

This is code-golf, so shortest answer in bytes wins! Tiebreaker is most upvoted post. Winner will be chosen on 09/10/2016.

Standard loopholes are forbidden.

答:
05AB1E, 9 bytes

```<code>.pRI.p¦«»
</code>```

Explanation

```<code>.pR           # prefixes of first word
     I.p       # prefixes of second word
         ¦       # remove first prefix
          «     # concatenate
           »    # join with newlines
</code>```

Try it online!

Title: Slowly turn a string into another

Body:
05AB1E, 9 bytes

.pRI.p¦«»

Explanation

.pR           # prefixes of first word
     I.p       # prefixes of second word
         ¦       # remove first prefix
          «     # concatenate
           »    # join with newlines

Try it online!


答:
Perl, <s>34</s> 28 bytes

Includes +2 for -0n

Run with the strings on separate lines on STDIN:

```<code>perl -M5.010 -0n slow.pl
Test
Testing
^D
</code>```

slow.pl:

```<code>/(^..+|
\K.+?)(?{say$&})^/
</code>```

Let regex backtracking do the work...

Title: Slowly turn a string into another

Body:
The Challenge

Given two strings/an array of strings, output the first string slowly shrinking and expanding back into the second string.

You can assume the strings will always start with the same character.

Example

```<code>Input:
"Test", "Testing"

Output:
Test
Tes
Te
T
Te
Tes
Test
Testi
Testin
Testing
</code>```

First you output the first word:

```<code>Test
</code>```

Then you keep removing one letter until the string is one character long:

```<code>Tes
Te
T
</code>```

Then keep adding one letter of the second word until it's done:

```<code>Te
Tes
Test
Testi
Testin
Testing
</code>```

(if both strings are one character long, then just output one of them once.)

Test Cases

```<code>"Hello!", "Hi."
Hello!
Hello
Hell
Hel
He
H
Hi
Hi.

"O", "O"

O

"z", "zz"

z
zz

".vimrc", ".minecraft"

.vimrc
.vimr
.vim
.vi
.v
.
.m
.mi
.min
.mine
.minec
.minecr
.minecra
.minecraf
.minecraft

"     ", "   "

SSSSS
SSSS
SSS
SS
S
SS
SSS

"0123456789", "02468"

0123456789
012345678
01234567
0123456
012345
01234
0123
012
01
0
02
024
0246
02468
</code>```

(note: on the space/fourth test case, replace the S with spaces)

Rules

This is code-golf, so shortest answer in bytes wins! Tiebreaker is most upvoted post. Winner will be chosen on 09/10/2016.

Standard loopholes are forbidden.

Body:
Perl, <s>34</s> 28 bytes

Includes +2 for -0n

Run with the strings on separate lines on STDIN:

perl -M5.010 -0n slow.pl
Test
Testing
^D

slow.pl:

/(^..+|
\K.+?)(?{say$&})^/

Let regex backtracking do the work...


答:
C, 142 bytes

```<code>#define _(x,y) while(y)printf("%.*s\n",d,x-c);
f(char*a,char*b){int c=1,d=strlen(a)+1;while(*++a==*++b)c++;_(a,--d>=c)d++;_(b,d++<strlen(b-c))}
</code>```

Provide f(char* str1, char* str2).

Title: Slowly turn a string into another

Body:
C, 142 bytes

#define _(x,y) while(y)printf("%.*s\n",d,x-c);
f(char*a,char*b){int c=1,d=strlen(a)+1;while(*++a==*++b)c++;_(a,--d>=c)d++;_(b,d++<strlen(b-c))}

Provide f(char* str1, char* str2).


问:
Draw an Empty Scrabble Board
A standard Scrabble board is a 15×15 grid of spaces to place letter tiles. Most of the spaces are blank but some are double word scores (pink), triple word scores (red), double letter scores (light blue), and triple letter scores (blue). There is usually a star in the very center (which counts as a double word score).

Write a program or function that outputs a standard, empty Scrabble board in ASCII form where:

. represents an empty space

D represents a double word score

T represents a triple word score

d represents a double letter score

t represents a triple letter score

X represents the center star

That is, your exact output must be

```<code>T..d...T...d..T
.D...t...t...D.
..D...d.d...D..
d..D...d...D..d
....D.....D....
.t...t...t...t.
..d...d.d...d..
T..d...X...d..T
..d...d.d...d..
.t...t...t...t.
....D.....D....
d..D...d...D..d
..D...d.d...D..
.D...t...t...D.
T..d...T...d..T
</code>```

optionally followed by a trailing newline.

The shortest code in bytes wins.

答:
C <s>230</s> 228 Bytes

```<code>char *s="T.D..Dd..D....D.t...t..d...dT..d...X";
int x,y,a,b;
#define X(N) {putchar(s[a]);N y<=x?1:y;}
#define P for(y=1;y<8;y++)X(a+=)for(y--;y+1;y--)X(a-=)puts("");
main(){for(;x<8;x++){a=b+=x;P}for(x=6;x+1;x--){a=b-=(x+1);P}}
</code>```

try it on ideone

This is an attempt at improving the original C version posted that had quarter of board stored in a C array. Not as short as I was hoping for.  This version only has one eighth of the board stored.

Ungolfed:

```<code>char *s="T.D..Dd..D....D.t...t..d...dT..d...X";
int x,y,a,b;
main(){
    for(x = 0; x < 8; x++){
        a=b+=x;
        for(y = 1; y < 8; y++){
            putchar(s[a]);
            a += y<=x ? 1 : y;
        }
        for(y--; y >= 0; y--){
            putchar(s[a]);
            a -= y<=x ? 1 : y;
        }
        puts("");
    }
    for(x=6; x >= 0; x--){
        a=b-=(x+1);
        for(y = 1; y < 8; y++){
            putchar(s[a]);
            a += y<=x ? 1 : y;
        }
        for(y--; y >= 0; y--){
            putchar(s[a]);
            a-= y<=x ? 1 : y;
        }
        puts("");
    }
}
</code>```

Title: Draw an Empty Scrabble Board

Body:
C <s>230</s> 228 Bytes

char *s="T.D..Dd..D....D.t...t..d...dT..d...X";
int x,y,a,b;
#define X(N) {putchar(s[a]);N y<=x?1:y;}
#define P for(y=1;y<8;y++)X(a+=)for(y--;y+1;y--)X(a-=)puts("");
main(){for(;x<8;x++){a=b+=x;P}for(x=6;x+1;x--){a=b-=(x+1);P}}

try it on ideone

This is an attempt at improving the original C version posted that had quarter of board stored in a C array. Not as short as I was hoping for.  This version only has one eighth of the board stored.

Ungolfed:

char *s="T.D..Dd..D....D.t...t..d...dT..d...X";
int x,y,a,b;
main(){
    for(x = 0; x < 8; x++){
        a=b+=x;
        for(y = 1; y < 8; y++){
            putchar(s[a]);
            a += y<=x ? 1 : y;
        }
        for(y--; y >= 0; y--){
            putchar(s[a]);
            a -= y<=x ? 1 : y;
        }
        puts("");
    }
    for(x=6; x >= 0; x--){
        a=b-=(x+1);
        for(y = 1; y < 8; y++){
            putchar(s[a]);
            a += y<=x ? 1 : y;
        }
        for(y--; y >= 0; y--){
            putchar(s[a]);
            a-= y<=x ? 1 : y;
        }
        puts("");
    }
}


答:
Pyke, 14 bytes

```<code>VDO)KKQlFh<)_X
</code>```

Try it here!

And 17 bytes just because it's an awesome solution:

```<code>mVDO)Fto!I_O(RKsX
</code>```

Try it here!

Title: Slowly turn a string into another

Body:
Pyke, 14 bytes

VDO)KKQlFh<)_X

Try it here!

And 17 bytes just because it's an awesome solution:

mVDO)Fto!I_O(RKsX

Try it here!


答:
Java, <s>188</s> 179 bytes

```<code>interface E{static void main(String[]a){int i=a[0].length();while(i>1)System.out.println(a[0].substring(0,i--));while(i<=a[1].length())System.out.println(a[1].substring(0,i++));}}
</code>```

Update

Removed s variable, saved 9 bytes

Ungolfed:

```<code>interface E {

    static void main(String[] a) {
        int i = a[0].length();
        while (i > 1) {
            System.out.println(a[0].substring(0, i--));
        }
        while (i <= a[1].length()) {
            System.out.println(a[1].substring(0, i++));
        }
    }
}
</code>```

Usage:

```<code>$ java E 'test' 'testing'
test
tes
te
t
te
tes
test
testi
testin
testing
</code>```

Title: Slowly turn a string into another

Body:
Java, <s>188</s> 179 bytes

interface E{static void main(String[]a){int i=a[0].length();while(i>1)System.out.println(a[0].substring(0,i--));while(i<=a[1].length())System.out.println(a[1].substring(0,i++));}}

Update

Removed s variable, saved 9 bytes

Ungolfed:

interface E {

    static void main(String[] a) {
        int i = a[0].length();
        while (i > 1) {
            System.out.println(a[0].substring(0, i--));
        }
        while (i <= a[1].length()) {
            System.out.println(a[1].substring(0, i++));
        }
    }
}

Usage:

$ java E 'test' 'testing'
test
tes
te
t
te
tes
test
testi
testin
testing


问:
Wave-Particle Duality Laterally Programmatically
Write a program or function that takes in a nonempty single-line string. The string will either be zero or more spaces followed by one period (a particle), such as . or          ., or the string will be a sequence of one or more alternating forward and back slashes (a wave) that could start with either one, such as \ or /\/ or \/\/\/\/\/\/.

In either case, propagate the particle/wave to the right by one unit.

Specifically, in the particle case, insert a space before the ., moving it one place to the right, then output the resulting string. For example:

. →  .

 . →   .

  . →    .

   . →     .

    . →      .

     . →       .

      . →        .

       . →         .

In the wave case, append either / or \ appropriately so the wave keeps alternating and it's length increases by one, then output the resulting string. For example:

/ → /\

\ → \/

/\ → /\/

\/ → \/\

/\/ → /\/\

\/\ → \/\/

/\/\ → /\/\/

\/\/ → \/\/\

In either case, the output may not have trailing spaces but an optional trailing newline is allowed.

The shortest code in bytes wins.

Body:
R, 119 bytes

a=scan(,"");if((q=strsplit(a,"")[[1]][nchar(a)])=="."){cat(" ",a,sep="")}else{s=switch(q,"/"="\\","/");cat(a,s,sep="")}

Ungolfed :

a=scan(,"")
if((q=strsplit(a,"")[[1]][nchar(a)])==".")
    cat(" ",a,sep="")

else
s=switch(q,"/"="\\","/")
cat(a,s,sep="")


答:
Haskell, <s>54</s> <s>53</s> 47 bytes

```<code>t[]=[]
t x=x:t(init x)
(.reverse.t).(++).init.t
</code>```

Usage example: ((.reverse.t).(++).init.t) "Hello" "Hi!" -> ["Hello","Hell","Hel","He","H","Hi","Hi!"].

Some pointfree magic. It's the same as f x y = (init(t x))++reverse (t y) where t makes a list of all initial substrings e.g. t "HI!" -> ["H","HI","HI!"].

Title: Slowly turn a string into another

Body:
Haskell, <s>54</s> <s>53</s> 47 bytes

t[]=[]
t x=x:t(init x)
(.reverse.t).(++).init.t

Usage example: ((.reverse.t).(++).init.t) "Hello" "Hi!" -> ["Hello","Hell","Hel","He","H","Hi","Hi!"].

Some pointfree magic. It's the same as f x y = (init(t x))++reverse (t y) where t makes a list of all initial substrings e.g. t "HI!" -> ["H","HI","HI!"].


问:
Steps of Permutation
Write a function which takes a set of integers and prints every permutation of the set, and the swap performed in between each step

Input

a set of integers, for example (0, 1, 2)

Output

the list of permutations and swaps in the format
(set)
(swap)
(set)
...

Test case

```<code>Input:
(3, 1, 5)

Output:
(3, 1, 5)
(3, 1)
(1, 3, 5)
(3, 5)
(1, 5, 3)
(1, 3)
(3, 5, 1)
(3, 5)
(5, 3, 1)
(3, 1)
(5, 1, 3)
</code>```

Rules

You can format the set of numbers however you want.

You can do the swaps in any order

You can repeat permutations and swaps in order to get a new one

Your code doesn't have to actually perform the swaps, the output just needs to show what swap was made between your last output and your current one

Your code only needs to function for sets with 2 or more elements

The set you're given will have no repeating elements (e.g. (0, 1, 1, 2) is invalid)

This is code-golf, so shortest code wins!

答:
Ruby, 86 bytes

```<code>puts (2..(a=gets.scan(/\d+/).uniq).size).map{|i|a.permutation(i).map{|e|?(+e*", "+?)}}
</code>```

Title: Steps of Permutation

Body:
Ruby, 86 bytes

puts (2..(a=gets.scan(/\d+/).uniq).size).map{|i|a.permutation(i).map{|e|?(+e*", "+?)}}


问:
Dimensional countdown
Write a function f(n,k) that displays the k-dimensional countdown from n.

A 1-dimensional countdown from 5 looks like

```<code> 54321
</code>```

A 2-dimensional countdown from 5 looks like

```<code> 54321
 4321
 321
 21
 1
</code>```

Finally, a 3-dimensional countdown from 5 looks like

```<code> 54321
 4321
 321
 21
 1
 4321
 321
 21
 1
 321
 21
 1
 21
 1
 1
</code>```

Formal definition

The 1-dimensional countdown from any n is a single line with the digits n, n-1,...,1 concatenated (followed by a newline).

For any k, the k-dimensional countdown from 1 is the single line

```<code> 1
</code>```

For n > 1 and k > 1, a k-dimensional countdown from n is a (k-1)-dimensional countdown from n followed by a k-dimensional countdown from n-1.

Input

Two positive integers k and n <= 9, in any format you choose.

Output

The k-dimensional countdown from n, with a newline after each 1-dimensional countdown. Extra newlines are permitted in the output.

Scoring

Standard golf scoring.

Bonus example

Here's an example with k > n, a 4-dimensional countdown from 3 (with extra comments that are not to be included in actual solutions):

```<code> -- 3-dimensional countdown from 3
 321
 21
 1
 21
 1
 1
 -- 4-dimensional countdown from 2:
 ---- 3-dimensional countdown from 2:
 21
 1
 1
 ---- 4-dimensional countdown from 1:
 1
</code>```

Clarifications:

Digits on a line do not need to be adjacent, but they must be evenly-spaced.

You may write a full program instead of just a function, if you prefer.

Title: Dimensional countdown

Body:
Haskell, 57 bytes

n#1='\n':(show=<<[n,n-1..1])
1#_=1#1
n#k=n#(k-1)++(n-1)#k

Usage example: 5 # 3 -> "\n54321\n4321\n321\n21\n1\n4321\n321\n21\n1\n321\n21\n1\n21\n1\n1".

A direct implementation of the definition.


问:
Showcase of Languages

Notes

This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.

This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

All answers should include the name of the programming language at the top of the post, prefixed by a #.

Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

The snippets do not need to be related. In fact, snippets that are too related may be redundant.

Since this is not a contest, all programming languages are welcome, whenever they were created.

Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('
' + temp.innerText || temp.textContent + '');}}})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul></code>```

答:
Racket

Factoid : A programmable programming language: Racket is a full-spectrum programming language. It goes beyond Lisp and Scheme with dialects that support objects, types, laziness, and more. (https://racket-lang.org/)

(I am surprised no one has added Racket till now).

Functions or procedures need to be in parentheses. First term in parentheses is procedure name, rest are its arguments. If an argument is a procedure, it has to be in its own brackets. Values (non-procedures) are written without brackets.

Main syntax difference between Java and Racket is f(a, b) vs (f a b), x+y+z vs (+ x y z), x == y vs (eq? x y) and x=2 vs (define x 2), or if already defined, (set! x 2). There is no need to declare types like public static void or int char string etc.

Length 1

```<code>i
</code>```

Prints value of i.

Also: + - / * are functions:

```<code>(+ 1 2 3 4)
</code>```

Output: 10 (all numbers are added together)

```<code>(* 1 2 3 4)
</code>```

Output: 24 (product of all numbers)

```<code>(/ 20 5 2)
</code>```

Output: 2 (20 is divided by 5 as well as 2)

```<code>(- 10 5 2)
</code>```

Output: 3 (5 and 2 are subtracted from 10)

Length 2

```<code>pi
</code>```

Prints value of pi:

```<code>3.141592653589793
</code>```

Length 3

```<code>let
</code>```

For local binding as in:

```<code>(let ( (x 5)   (y 10) )
  (println  (* x y))
)
; x and y are not visible here;
</code>```

Also:

```<code>map
</code>```

Subjects each item of a list to the sent function, e.g. to double every item of the list:

```<code>(+ 1 2 3 4)
</code>```0

Output:

```<code>(+ 1 2 3 4)
</code>```1

Also:

```<code>(+ 1 2 3 4)
</code>```2

Standard for loop as well as its extensions:

```<code>(+ 1 2 3 4)
</code>```3

There are more extensions https://docs.racket-lang.org/reference/for.html !

Length 4

Conditionals:

```<code>(+ 1 2 3 4)
</code>```4

For example (from https://docs.racket-lang.org/racket-cheat/index.html):

```<code>(+ 1 2 3 4)
</code>```5

Also

```<code>(+ 1 2 3 4)
</code>```6

Being derived from Lisp & Scheme, list is very important data structure here:

```<code>(+ 1 2 3 4)
</code>```7

Length 5

```<code>(+ 1 2 3 4)
</code>```8

Match is like case-switch:

```<code>(+ 1 2 3 4)
</code>```9

Also:

```<code>(* 1 2 3 4)
</code>```0

This opens a list and provides all elements to the function, for example:

```<code>(* 1 2 3 4)
</code>```1

becomes:

```<code>(* 1 2 3 4)
</code>```2

Length 6

Define: a very basic function- to assign value to a variable:

```<code>(define s "A string")
(define n 10)
</code>```

Also:

printf - the print function:

```<code>(printf "~a ; ~a ~n" s n)
</code>```

Output:

```<code>A string ; 10
</code>```

Also: Filter - a function that filters a list for items which give true value to the specified function (sent as an argument):

```<code>> (filter string? (list "a" "b" 6))
'("a" "b")
> (filter positive? (list 1 -2 6 7 0))
'(1 6 7)
</code>```

The test function can be specified:

```<code>> (filter
    (lambda(x) (> x 2))    ; function to test each element
    '(1 2 3 4 5))          ; full input list to be filtered
</code>```

Output:

```<code>'(3 4 5)                   ; output list of elements greater than 2
</code>```

Length 7

println : one of most commonly used function. Prints out the sent string with a newline character at end:

```<code>(println "String to be printed")
</code>```

(Note: examples are from various sources on the net).

Title: Showcase of Languages

Body:
Racket

Factoid : A programmable programming language: Racket is a full-spectrum programming language. It goes beyond Lisp and Scheme with dialects that support objects, types, laziness, and more. (https://racket-lang.org/)

(I am surprised no one has added Racket till now).

Functions or procedures need to be in parentheses. First term in parentheses is procedure name, rest are its arguments. If an argument is a procedure, it has to be in its own brackets. Values (non-procedures) are written without brackets.

Main syntax difference between Java and Racket is f(a, b) vs (f a b), x+y+z vs (+ x y z), x == y vs (eq? x y) and x=2 vs (define x 2), or if already defined, (set! x 2). There is no need to declare types like public static void or int char string etc.

Length 1

i

Prints value of i.

Also: + - / * are functions:

(+ 1 2 3 4)

Output: 10 (all numbers are added together)

(* 1 2 3 4)

Output: 24 (product of all numbers)

(/ 20 5 2)

Output: 2 (20 is divided by 5 as well as 2)

(- 10 5 2)

Output: 3 (5 and 2 are subtracted from 10)

Length 2

pi

Prints value of pi:

3.141592653589793

Length 3

let

For local binding as in:

(let ( (x 5)   (y 10) )
  (println  (* x y))
)
; x and y are not visible here;

Also:

map

Subjects each item of a list to the sent function, e.g. to double every item of the list:

(map    (lambda(x) (* 2 x))    (list 1 2 3) )

Output:

'(2 4 6)

Also:

for

Standard for loop as well as its extensions:

for* for/list for/sum for/product for/first for/last for/and for/or

There are more extensions https://docs.racket-lang.org/reference/for.html !

Length 4

Conditionals:

cond

For example (from https://docs.racket-lang.org/racket-cheat/index.html):

(cond
  [(even? x) 0]
  [(odd? x) 1]
  [else "impossible!"])

Also

list

Being derived from Lisp & Scheme, list is very important data structure here:

(list 1 "a" #\a (list 1 2 3))

Length 5

match

Match is like case-switch:

(match x
  [3 (displayln "x is 3")]
  [4 (displayln "x is 4")]
  [5 (displayln "x is 5")]
  [default (displayln "none of the above")])

Also:

apply

This opens a list and provides all elements to the function, for example:

(apply + (list 1 2 3 4 5))

becomes:

(+ 1 2 3 4 5) ; => 15

Length 6

Define: a very basic function- to assign value to a variable:

(define s "A string")
(define n 10)

Also:

printf - the print function:

(printf "~a ; ~a ~n" s n)

Output:

A string ; 10

Also: Filter - a function that filters a list for items which give true value to the specified function (sent as an argument):

> (filter string? (list "a" "b" 6))
'("a" "b")
> (filter positive? (list 1 -2 6 7 0))
'(1 6 7)

The test function can be specified:

> (filter
    (lambda(x) (> x 2))    ; function to test each element
    '(1 2 3 4 5))          ; full input list to be filtered

Output:

'(3 4 5)                   ; output list of elements greater than 2

Length 7

println : one of most commonly used function. Prints out the sent string with a newline character at end:

(println "String to be printed")

(Note: examples are from various sources on the net).


问:
Counting Cunningham chains
Prime numbers have always fascinated people. 2300 years ago Euclid wrote in his "Elements"

A prime number is that which is measured by a unit alone.

which means that a prime is only divisible by 1 (or by itself).

People have always looked for relations between prime numbers, and have come up with some pretty weird (as in "interesting") stuff.

For example a Sophie Germain prime is a prime p for which 2*p+1 is also prime.

A safe prime is a prime p for which (p-1)/2 is also prime, which is exactly the backwards condition of a Sophie Germain prime.

These are related to what we are looking for in this challenge.

A Cunningham chain of type I is a series of primes, where every element except the last one is a Sophie Germain prime, and every element except the first one is a safe prime. The number of elements in this chain is called it's length.

This means that we start with a prime p and calculate q=2*p+1. If q is prime too, we have a Cunnigham chain of type I of length 2. Then we test 2*q+1 and so on, until the next generated number is composite.

Cunningham chains of type II are constructed following almost the same principle, the only difference being that we check 2*p-1 at each stage.

Cunningham chains can have a length of 1, which means that neither 2*p+1 nor 2*p-1 are prime. We're not interested in these.

Some examples of Cunningham chains

2 starts a chain of type I of length 5.

2, 5, 11, 23, 47

The next constructed number would be 95 which isn't prime.

This also tells us, that 5, 11, 23 and 47 don't start any chain of type I, because it would have preceeding elements.

2 also starts a chain of type II of length 3.

2, 3, 5

Next would be 9, which isn't prime.

Let's try 11 for type II (we excluded it from type I earlier).

Well, 21 would be next, which isn't prime, so we would have length 1 for that "chain", which we don't count in this challenge.

Challenge

Write a program or function that, given a number n as input, writes/returns the starting number of the nth Cunningham chain of type I or II of at least length 2, followed by a space, followed by the type of chain it starts (I or II), followed by a colon, followed by the length of that type of chain.
  In case a prime starts both types of chains (type I and type II) the chain of type I is counted first.

Example: 2 I:5

Bear in mind, that n might be part of a previously started chain of any type, in which case it shouldn't be considered a starting number of a chain of that type.

Let's look into how this begins

We start with 2. Since it is the first prime at all we can be sure that there is no chain starting with a lower prime that contains 2.

The next number in a chain of type I would be 2*2+1 == 5. 5 is prime, so we have a chain of at least length 2 already.

We count that as the first chain.
What about type II?
Next number would be 2*2-1 == 3. 3 is prime, so a chain of at least length 2 for type II too.

We count that as the second chain. And we're done for 2.

Next prime is 3. Here we should check if it is in a chain that a lower prime started.

Check for type I: (3-1)/2 == 1. 1 isn't prime, so 3 could be a starting point for a chain of type I.

Let's check that. Next would be 3*2+1 == 7. 7 is prime, so we have a chain of type I of at least length 2. We count that as the third chain.

Now we check if 3 appears in a type II chain that a lower prime started.
(3+1)/2 == 2. 2 is prime, so 3 can't be considered as a starting number for a chain of type II. So this is not counted, even if the next number after 3 in this chain, which would be 5, is prime.
(Of course we already knew that, and you can and should of course think about your own method how to do these checks.)

And so we check on for 5, 7, 11 and so on, counting until we find the nth Cunningham chain of at least length 2.

Then (or maybe some time earlier ;) ) we need to determine the complete length of the chain we found and print the result in the previously mentioned format.

By the way: in my tests I haven't found any prime besides 2 that started both types of chains with a length greater than 1.

Input/Output examples

Input

1

Output

2 I:5

Input

10

Output

79 II:3

Input

99

Output

2129 I:2

The outputs for the inputs 1..20

```
2 I:5
2 II:3
3 I:2
7 II:2
19 II:3
29 I:2
31 II:2
41 I:3
53 I:2
79 II:3
89 I:6
97 II:2
113 I:2
131 I:2
139 II:2
173 I:2
191 I:2
199 II:2
211 II:2
229 II:2
```

A list of the first 5000 outputs can be found here.

This is code golf. Arbitrary whitespace is allowed in the output, but the type and numbers should be seperated by a single space and a colon as seen in the examples. Using any loopholes is not allowed, especially getting the results from the web is not allowed.

Good luck :)

答:
Javascript, <s>236</s> 208 bytes

Saved 28 bytes:

```<code>p=(n,i=n)=>n%--i?p(n,i):i==1;f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:`+eval(`for(j=1;p(k=2*k+l);j++);j`))}
</code>```

Saved 9 bytes on p function with: p=(n,i=n)=>n%--i?p(n,i):i==1

The t function was replaced by the eval(...) statement directly in the f function.

Previous solution:

```<code>p=n=>{for(i=n;n%--i&&i;);return 1==i};t=(n,m)=>{for(j=1;p(n=2*n+m);j++);return j};f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:${t(k,l)}`)}
</code>```

Example: f(6)

Output: 29 I:2

Explanation

I'm using 3 functions

1 p: to know if n is prime :
p=n=>{for(i=n;n%--i&&i;);return 1==i}

2 t: to know the length of the Cunningham chain starting with n of type I or II depending on the m parameter which will be 1 or -1 :
t=(n,m)=>{for(j=1;p(n=2*n+m);j++);return j}

3 f: counts the chains (for loop) then display the result

```<code>f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:${t(k,l)}`)}
</code>```

for loop: for each number the Cunningham chain (I then II if needed) is valid if

the number is prime

the predecessor is not prime

the successor is prime

Title: Counting Cunningham chains

Body:
Javascript, <s>236</s> 208 bytes

Saved 28 bytes:

p=(n,i=n)=>n%--i?p(n,i):i==1;f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:`+eval(`for(j=1;p(k=2*k+l);j++);j`))}

Saved 9 bytes on p function with: p=(n,i=n)=>n%--i?p(n,i):i==1

The t function was replaced by the eval(...) statement directly in the f function.

Previous solution:

p=n=>{for(i=n;n%--i&&i;);return 1==i};t=(n,m)=>{for(j=1;p(n=2*n+m);j++);return j};f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:${t(k,l)}`)}

Example: f(6)

Output: 29 I:2

Explanation

I'm using 3 functions

1 p: to know if n is prime :
p=n=>{for(i=n;n%--i&&i;);return 1==i}

2 t: to know the length of the Cunningham chain starting with n of type I or II depending on the m parameter which will be 1 or -1 :
t=(n,m)=>{for(j=1;p(n=2*n+m);j++);return j}

3 f: counts the chains (for loop) then display the result

f=n=>{for(k=2,c=0;c<n;k++){p(k)&&!p((k-1)/2)&&p(2*k+1)&&(c++,l=1,r='');p(k)&&c-n&&!p((k+1)/2)&&p(2*k-1)&&(c++,l=-1,r='I');};alert(--k+` I${r}:${t(k,l)}`)}

for loop: for each number the Cunningham chain (I then II if needed) is valid if

the number is prime

the predecessor is not prime

the successor is prime


问:
Hexplosive ASCII-art challenge
In the strategy game "Hexplode", players take turns placing tokens on a hexagonal board. Once the number of tokens equals the number of adjacent tiles, that tile hexplodes, and moves all of the tokes on it to the surrounding neighbors. You can play the game online here.

I like this game, but sometimes it's hard to know exactly how many tokens go on a specific tile; I'm always counting the number of neighbors. It would really convenient if I had an ASCII-art to help me remember how many tokens go on each tile.

You need to write a program or function that takes a positive integer as input, and produces this ASCII representation of hexagon of size N. Each tile will be the number of neighbors that tile has. Since 1 is a weird corner case with zero neighbors, you only have to handle inputs larger than 1.

You may take this number in any reasonable format, such as STDIN, function arguments, command-line arguments, from a file, etc. The output may also be in any reasonable format, such as printing to STDOUT, writing to a file, returning a list of strings, a newline separated string, etc.

Here is some sample output for the first 5 inputs:

```<code>2)

 3 3
3 6 3
 3 3

3)

  3 4 3
 4 6 6 4
3 6 6 6 3
 4 6 6 4
  3 4 3

4)

   3 4 4 3
  4 6 6 6 4
 4 6 6 6 6 4
3 6 6 6 6 6 3
 4 6 6 6 6 4
  4 6 6 6 4
   3 4 4 3

5)

    3 4 4 4 3
   4 6 6 6 6 4
  4 6 6 6 6 6 4
 4 6 6 6 6 6 6 4
3 6 6 6 6 6 6 6 3
 4 6 6 6 6 6 6 4
  4 6 6 6 6 6 4
   4 6 6 6 6 4
    3 4 4 4 3

6)

     3 4 4 4 4 3
    4 6 6 6 6 6 4
   4 6 6 6 6 6 6 4
  4 6 6 6 6 6 6 6 4
 4 6 6 6 6 6 6 6 6 4
3 6 6 6 6 6 6 6 6 6 3
 4 6 6 6 6 6 6 6 6 4
  4 6 6 6 6 6 6 6 4
   4 6 6 6 6 6 6 4
    4 6 6 6 6 6 4
     3 4 4 4 4 3
</code>```

And the pattern continues in a similar manner. As usual, standard loopholes apply, and the answer with the lowest byte-count will be crowned the winner!

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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

```<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 leaderboard snippet:

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

var QUESTION_ID=92194,OVERRIDE_USER=31716;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

```

答:
Java, <s>375</s> <s>363</s> <s>361</s> <s>339</s> <s>329</s> <s>317</s> 293 bytes

```<code>interface J{static void main(String[]r){int i=0,k,h=Integer.decode(r[0]),a=1,l,n=0;for(;i++<h*2-1;n+=a){if(n==h-1)a=-1;String s="";for(k=0;k<n+h;k++,s+=" ")s+=n==0?k==0||k==n+h-1?3:4:k!=0&&k!=n+h-1?6:n==h-1?3:4;l=(h*4-3-s.trim().length())/2;System.out.printf((l==0?"%":"%"+l)+"s%s\n","",s);}}}
</code>```

Ungolfed

```<code>interface J {
    static void main(String[] r) {
        int i = 0, k, h = Integer.decode(r[0]), a = 1, l, n = 0;
        for (; i++ < h * 2 - 1; n += a) {
            if (n == h - 1) {
                a = -1;
            }
            String s = "";
            for (k = 0; k < n + h; k++, s += " ") {
                s += n == 0 ? k == 0 || k == n + h - 1 ? 3 : 4 : k != 0 && k != n + h - 1 ? 6 : n == h - 1 ? 3 : 4;
            }
            l = (h * 4 - 3 - s.trim().length()) / 2;
            System.out.printf((l == 0 ? "%" : "%" + l) + "s%s\n", "", s);
        }
    }
}
</code>```

Usage:

```<code>$ java J 5
    3 4 4 4 3
   4 6 6 6 6 4
  4 6 6 6 6 6 4
 4 6 6 6 6 6 6 4
3 6 6 6 6 6 6 6 3
 4 6 6 6 6 6 6 4
  4 6 6 6 6 6 4
   4 6 6 6 6 4
    3 4 4 4 3
</code>```

I am sure that the horrible nested if-else block can be rewritten to be smaller but I can't figure it out at the moment. Any suggestions are welcome :-)

Update

Followed Kevin Cruijssen's suggestion and used decode instead of parseInt.

Rewrote some ifs by using the ternary operator.

More ternary operators.

Moar ternary operators! I think I have created a monster!

Rewrote the if-else block regarding the printing.

Title: Hexplosive ASCII-art challenge

Body:
Java, <s>375</s> <s>363</s> <s>361</s> <s>339</s> <s>329</s> <s>317</s> 293 bytes

interface J{static void main(String[]r){int i=0,k,h=Integer.decode(r[0]),a=1,l,n=0;for(;i++<h*2-1;n+=a){if(n==h-1)a=-1;String s="";for(k=0;k<n+h;k++,s+=" ")s+=n==0?k==0||k==n+h-1?3:4:k!=0&&k!=n+h-1?6:n==h-1?3:4;l=(h*4-3-s.trim().length())/2;System.out.printf((l==0?"%":"%"+l)+"s%s\n","",s);}}}

Ungolfed

interface J {
    static void main(String[] r) {
        int i = 0, k, h = Integer.decode(r[0]), a = 1, l, n = 0;
        for (; i++ < h * 2 - 1; n += a) {
            if (n == h - 1) {
                a = -1;
            }
            String s = "";
            for (k = 0; k < n + h; k++, s += " ") {
                s += n == 0 ? k == 0 || k == n + h - 1 ? 3 : 4 : k != 0 && k != n + h - 1 ? 6 : n == h - 1 ? 3 : 4;
            }
            l = (h * 4 - 3 - s.trim().length()) / 2;
            System.out.printf((l == 0 ? "%" : "%" + l) + "s%s\n", "", s);
        }
    }
}

Usage:

$ java J 5
    3 4 4 4 3
   4 6 6 6 6 4
  4 6 6 6 6 6 4
 4 6 6 6 6 6 6 4
3 6 6 6 6 6 6 6 3
 4 6 6 6 6 6 6 4
  4 6 6 6 6 6 4
   4 6 6 6 6 4
    3 4 4 4 3

I am sure that the horrible nested if-else block can be rewritten to be smaller but I can't figure it out at the moment. Any suggestions are welcome :-)

Update

Followed Kevin Cruijssen's suggestion and used decode instead of parseInt.

Rewrote some ifs by using the ternary operator.

More ternary operators.

Moar ternary operators! I think I have created a monster!

Rewrote the if-else block regarding the printing.


答:
Perl, 29 bytes

Includes +1 for -n

Run with input on STDIN:

```<code>perl -nE '/^.+(?{map{say$&.$_}0..9})^/' <<< PERL
</code>```

Just the code:

```<code>/^.+(?{map{say$&.$_}0..9})^/
</code>```

Title: Invalid Invali Inval

Body:
This idea is loosely based upon @TùxCräftîñg's chat message.

Take a look at the below example sequence:

INVALID0, INVALID1, INVALID2 INVALID3, INVALID4... INVALID9

After INVALID9, it goes on like this:

INVALI0, INVALI1, INVALI2, INVALI3... INVALI9

And after INVALI9, it's like this:

INVAL0,INVAL1, INVAL2, INVAL3... INVAL9

After, INVAL9, it's like this:

INVA0, INVA1, INVA2, INVA3, ... INVA9

Notice how we we kept removing a letter from the word INVALID each time.

You'll keep repeating this until you reach a single letter, that is, the letter I:

I0, I1, I2, I3, I4 ... I9

Now, your task is, to take an input of a word, and produce a sequence from it like the above example. Your code must also work with single letters, and in that case the resulting sequence will be shorter.

You may choose any input and output format that you prefer (with or without a separator, as you wish), but you must specify which one you have chosen.

The sequence needs to be in the exact specified order.

The shortest code, in bytes, that successfully completes this challenge, wins the challenge.

Full sequence in the above example:

```<code>INVALID0, INVALID1, INVALID2, INVALID3, INVALID4, INVALID5, INVALID6, INVALID7, INVALID8, INVALID9, INVALI0, INVALI1, INVALI2, INVALI3, INVALI4, INVALI5, INVALI6, INVALI7, INVALI8, INVALI9, INVAL0, INVAL1, INVAL2, INVAL3, INVAL4, INVAL5, INVAL6, INVAL7, INVAL8, INVAL9, INVA0, INVA1, INVA2, INVA3, INVA4, INVA5, INVA6, INVA7, INVA8, INVA9, INV0, INV1, INV2, INV3, INV4, INV5, INV6, INV7, INV8, INV9, IN0, IN1, IN2, IN3, IN4, IN5, IN6, IN7, IN8, IN9, I0, I1, I2, I3, I4, I5, I6, I7, I8, I9
</code>```

Other examples:

Input: MAYBE (Uppercase and lowercase don't matter)

Output:

```<code>MAYBE0, MAYBE1, MAYBE2, MAYBE3, MAYBE4, MAYBE5, MAYBE6, MAYBE7, MAYBE8, MAYBE9, MAYB0, MAYB1, MAYB2, MAYB3, MAYB4, MAYB5, MAYB6, MAYB7, MAYB8, MAYB9, MAY0, MAY1, MAY2, MAY3, MAY4, MAY5, MAY6, MAY7, MAY8, MAY9, MA0, MA1, MA2, MA3, MA4, MA5, MA6, MA7, MA8, MA9, M0, M1, M2, M3, M4, M5, M6, M7, M8, M9
</code>```

Input: AFTER

Output:

```<code>AFTER0, AFTER1, AFTER2, AFTER3, AFTER4, AFTER5, AFTER6, AFTER7, AFTER8, AFTER9, AFTE0, AFTE1, AFTE2, AFTE3, AFTE4, AFTE5, AFTE6, AFTE7, AFTE8, AFTE9, AFT0, AFT1, AFT2, AFT3, AFT4, AFT5, AFT6, AFT7, AFT8, AFT9, AF0, AF1, AF2, AF3, AF4, AF5, AF6, AF7, AF8, AF9, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9
</code>```

Input: WHAT ARE YOU DOING

```<code>WHAT ARE YOU DOING0, WHAT ARE YOU DOING1, WHAT ARE YOU DOING2, WHAT ARE YOU DOING3, WHAT ARE YOU DOING4, WHAT ARE YOU DOING5, WHAT ARE YOU DOING6, WHAT ARE YOU DOING7, WHAT ARE YOU DOING8, WHAT ARE YOU DOING9, WHAT ARE YOU DOIN0, WHAT ARE YOU DOIN1, WHAT ARE YOU DOIN2, WHAT ARE YOU DOIN3, WHAT ARE YOU DOIN4, WHAT ARE YOU DOIN5, WHAT ARE YOU DOIN6, WHAT ARE YOU DOIN7, WHAT ARE YOU DOIN8, WHAT ARE YOU DOIN9, WHAT ARE YOU DOI0, WHAT ARE YOU DOI1, WHAT ARE YOU DOI2, WHAT ARE YOU DOI3, WHAT ARE YOU DOI4, WHAT ARE YOU DOI5, WHAT ARE YOU DOI6, WHAT ARE YOU DOI7, WHAT ARE YOU DOI8, WHAT ARE YOU DOI9, WHAT ARE YOU DO0, WHAT ARE YOU DO1, WHAT ARE YOU DO2, WHAT ARE YOU DO3, WHAT ARE YOU DO4, WHAT ARE YOU DO5, WHAT ARE YOU DO6, WHAT ARE YOU DO7, WHAT ARE YOU DO8, WHAT ARE YOU DO9, WHAT ARE YOU D0, WHAT ARE YOU D1, WHAT ARE YOU D2, WHAT ARE YOU D3, WHAT ARE YOU D4, WHAT ARE YOU D5, WHAT ARE YOU D6, WHAT ARE YOU D7, WHAT ARE YOU D8, WHAT ARE YOU D9, WHAT ARE YOU 0, WHAT ARE YOU 1, WHAT ARE YOU 2, WHAT ARE YOU 3, WHAT ARE YOU 4, WHAT ARE YOU 5, WHAT ARE YOU 6, WHAT ARE YOU 7, WHAT ARE YOU 8, WHAT ARE YOU 9, WHAT ARE YOU0, WHAT ARE YOU1, WHAT ARE YOU2, WHAT ARE YOU3, WHAT ARE YOU4, WHAT ARE YOU5, WHAT ARE YOU6, WHAT ARE YOU7, WHAT ARE YOU8, WHAT ARE YOU9, WHAT ARE YO0, WHAT ARE YO1, WHAT ARE YO2, WHAT ARE YO3, WHAT ARE YO4, WHAT ARE YO5, WHAT ARE YO6, WHAT ARE YO7, WHAT ARE YO8, WHAT ARE YO9, WHAT ARE Y0, WHAT ARE Y1, WHAT ARE Y2, WHAT ARE Y3, WHAT ARE Y4, WHAT ARE Y5, WHAT ARE Y6, WHAT ARE Y7, WHAT ARE Y8, WHAT ARE Y9, WHAT ARE 0, WHAT ARE 1, WHAT ARE 2, WHAT ARE 3, WHAT ARE 4, WHAT ARE 5, WHAT ARE 6, WHAT ARE 7, WHAT ARE 8, WHAT ARE 9, WHAT ARE0, WHAT ARE1, WHAT ARE2, WHAT ARE3, WHAT ARE4, WHAT ARE5, WHAT ARE6, WHAT ARE7, WHAT ARE8, WHAT ARE9, WHAT AR0, WHAT AR1, WHAT AR2, WHAT AR3, WHAT AR4, WHAT AR5, WHAT AR6, WHAT AR7, WHAT AR8, WHAT AR9, WHAT A0, WHAT A1, WHAT A2, WHAT A3, WHAT A4, WHAT A5, WHAT A6, WHAT A7, WHAT A8, WHAT A9, WHAT 0, WHAT 1, WHAT 2, WHAT 3, WHAT 4, WHAT 5, WHAT 6, WHAT 7, WHAT 8, WHAT 9, WHAT0, WHAT1, WHAT2, WHAT3, WHAT4, WHAT5, WHAT6, WHAT7, WHAT8, WHAT9, WHA0, WHA1, WHA2, WHA3, WHA4, WHA5, WHA6, WHA7, WHA8, WHA9, WH0, WH1, WH2, WH3, WH4, WH5, WH6, WH7, WH8, WH9, W0, W1, W2, W3, W4, W5, W6, W7, W8, W9
</code>```

Leaderboard

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
Perl, 29 bytes

Includes +1 for -n

Run with input on STDIN:

perl -nE '/^.+(?{map{say$&.$_}0..9})^/' <<< PERL

Just the code:

/^.+(?{map{say$&.$_}0..9})^/


答:
TI-Basic, 56 bytes

```<code>Prompt Str1,Str2
Str1
While 1<length(Ans
Disp Ans
sub(Ans,1,length(Ans)-1
End
For(I,1,length(Str2
Disp sub(Str2,1,I
End
</code>```

Example usage

```<code>Str1=?Test
Str2=?Testing
Test
Tes
Te
T
Te
Tes
Test
Testi
Testin
Testing

Str1=?O
Str2=?O
O

Str1=?z
Str2=?zz
z
zz
</code>```

Title: Slowly turn a string into another

Body:
TI-Basic, 56 bytes

Prompt Str1,Str2
Str1
While 1<length(Ans
Disp Ans
sub(Ans,1,length(Ans)-1
End
For(I,1,length(Str2
Disp sub(Str2,1,I
End

Example usage

Str1=?Test
Str2=?Testing
Test
Tes
Te
T
Te
Tes
Test
Testi
Testin
Testing

Str1=?O
Str2=?O
O

Str1=?z
Str2=?zz
z
zz


问:
Convert to Bibi-binary
Bibi-binary is a numeric system invented by Boby Lapointe in order to represent numbers in letters which pronunciation seems funny.

Your task is to convert decimal numbers into Bibi-binary!

Conversion

A number is converted to base 16 (hexadecimal) and each character is replaced by its Bibi-binary name:

```<code>0 = HO
1 = HA
2 = HE
3 = HI
4 = BO
5 = BA
6 = BE
7 = BI
8 = KO
9 = KA
A = KE
B = KI
C = DO
D = DA
E = DE
F = DI
</code>```

Let N be a positive integer (between 1 -> 2^31-1).
For every character in the hexadecimal representation of N, replace the character by its according Bibi-binary pair (the table above contains all the pairs).

Example

N = 156

H = (hexadecimal representation of N) --> 9C

9 --> KA, C --> DO

Thus the output is KADO.

Input & output

You will receive an positive 32-bit integer N, which you will have to turn into Bibi-binary.

You may (return, print, etc...) in any convenient format, but the pairs have to be connected! So KA DO wouldn't be okay, but KADO would.

Both, lowercase and uppercase are allowed.

Rules

No loopholes.

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

Testcases

```<code>2048 -> KOHOHO
156 -> KADO
10000 -> HEBIHAHO
12 -> DO
</code>```

答:
Perl, <s>52</s> 51 bytes

Includes +1 for -p

Run with the number on STDIN

```<code>bibi.pl <<< 156
</code>```

bibi.pl:

```<code>#!/usr/bin/perl -p
1while$\=(<{H,B,K,D}{O,A,E,I}>)[$_%16].$\,$_>>=4}{
</code>```

Title: Convert to Bibi-binary

Body:
Perl, <s>52</s> 51 bytes

Includes +1 for -p

Run with the number on STDIN

bibi.pl <<< 156

bibi.pl:

#!/usr/bin/perl -p
1while$\=(<{H,B,K,D}{O,A,E,I}>)[$_%16].$\,$_>>=4}{


答:
05AB1E, 44 bytes

```<code>FN_i4ë6}ð«¹ÍN+×ðìN_N¹<Q~i3ë4}.ø¹<N-ð×ì})Â¦«»
</code>```

Explanation

As the top and bottom of the hexagon are mirrored we only need to generate the upper part.

So for an input of X we need to generate X rows. That is what the main loop does.

```<code>F                                        }
</code>```

Then we do the center part of the rows.

This is 4 for the first row and 6 for the rest (as we're only doing the upper part).

We concatenate this number with a space as the pattern will require spacing between numbers.

```<code>N_i4ë6}ð«
</code>```

We then repeat this string X-2+N times, where N is the current row 0-indexed and prepend a space character on the left side.

```<code>¹ÍN+×ðì
</code>```

After this it's time for the corners. They will be 3 for the first and last row and 4 for the middle rows.

```<code>N_N¹<Q~i3ë4}.ø
</code>```

Now we need to make sure the rows are lined up correctly by adding spaces to the front of each row. The number of spaces added will be X-1-N.

```<code>¹<N-ð×ì
</code>```

Now that we have the upper part of the grid done, we add the rows to a list, create a reversed copy and remove the first item from that copy (as we only need the central row once), then merge these 2 lists together and print.

```<code>)Â¦«»
</code>```

Try it online!

Additional solution, also 44 bytes:

```<code>ÍÅ10.øvN_i4ë6}ð«¹ÍN+×ðìyi4ë3}.ø¹<N-ð×ì})Â¦«»
</code>```

Title: Hexplosive ASCII-art challenge

Body:
In the strategy game "Hexplode", players take turns placing tokens on a hexagonal board. Once the number of tokens equals the number of adjacent tiles, that tile hexplodes, and moves all of the tokes on it to the surrounding neighbors. You can play the game online here.

I like this game, but sometimes it's hard to know exactly how many tokens go on a specific tile; I'm always counting the number of neighbors. It would really convenient if I had an ASCII-art to help me remember how many tokens go on each tile.

You need to write a program or function that takes a positive integer as input, and produces this ASCII representation of hexagon of size N. Each tile will be the number of neighbors that tile has. Since 1 is a weird corner case with zero neighbors, you only have to handle inputs larger than 1.

You may take this number in any reasonable format, such as STDIN, function arguments, command-line arguments, from a file, etc. The output may also be in any reasonable format, such as printing to STDOUT, writing to a file, returning a list of strings, a newline separated string, etc.

Here is some sample output for the first 5 inputs:

```<code>2)

 3 3
3 6 3
 3 3

3)

  3 4 3
 4 6 6 4
3 6 6 6 3
 4 6 6 4
  3 4 3

4)

   3 4 4 3
  4 6 6 6 4
 4 6 6 6 6 4
3 6 6 6 6 6 3
 4 6 6 6 6 4
  4 6 6 6 4
   3 4 4 3

5)

    3 4 4 4 3
   4 6 6 6 6 4
  4 6 6 6 6 6 4
 4 6 6 6 6 6 6 4
3 6 6 6 6 6 6 6 3
 4 6 6 6 6 6 6 4
  4 6 6 6 6 6 4
   4 6 6 6 6 4
    3 4 4 4 3

6)

     3 4 4 4 4 3
    4 6 6 6 6 6 4
   4 6 6 6 6 6 6 4
  4 6 6 6 6 6 6 6 4
 4 6 6 6 6 6 6 6 6 4
3 6 6 6 6 6 6 6 6 6 3
 4 6 6 6 6 6 6 6 6 4
  4 6 6 6 6 6 6 6 4
   4 6 6 6 6 6 6 4
    4 6 6 6 6 6 4
     3 4 4 4 4 3
</code>```

And the pattern continues in a similar manner. As usual, standard loopholes apply, and the answer with the lowest byte-count will be crowned the winner!

Leaderboards

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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

```<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 leaderboard snippet:

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

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

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

```

Body:
05AB1E, 44 bytes

FN_i4ë6}ð«¹ÍN+×ðìN_N¹<Q~i3ë4}.ø¹<N-ð×ì})Â¦«»

Explanation

As the top and bottom of the hexagon are mirrored we only need to generate the upper part.

So for an input of X we need to generate X rows. That is what the main loop does.

F                                        }

Then we do the center part of the rows.

This is 4 for the first row and 6 for the rest (as we're only doing the upper part).

We concatenate this number with a space as the pattern will require spacing between numbers.

N_i4ë6}ð«

We then repeat this string X-2+N times, where N is the current row 0-indexed and prepend a space character on the left side.

¹ÍN+×ðì

After this it's time for the corners. They will be 3 for the first and last row and 4 for the middle rows.

N_N¹<Q~i3ë4}.ø

Now we need to make sure the rows are lined up correctly by adding spaces to the front of each row. The number of spaces added will be X-1-N.

¹<N-ð×ì

Now that we have the upper part of the grid done, we add the rows to a list, create a reversed copy and remove the first item from that copy (as we only need the central row once), then merge these 2 lists together and print.

)Â¦«»

Try it online!

Additional solution, also 44 bytes:

ÍÅ10.øvN_i4ë6}ð«¹ÍN+×ðìyi4ë3}.ø¹<N-ð×ì})Â¦«»


问:
Products of Consecutive Primes
As of time of submission to the sandbox, I had 17017 reputation, which you will all be able to factorise as 7×11×13×17, a product of 4 consecutive primes.

Please write a function or program to output all the products of two or more consecutive primes up to an input integer n. For example, given n=143 you should output 6, 15, 30, 35, 77, 105, 143 (or equivalent output format).

Normal restrictions on I/O and loopholes apply.

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

答:
Jelly, <s>14</s> 10 bytes

(no doubt there is golfing to do here! - yep...)

-4 bytes thanks to @Dennis - replace check for greater than n by using a range

```<code>ÆRẆP€ḟÆRfR
</code>```

Note - this is both extremely inefficient and the results are unsorted.

Test it at TryItOnline

How?

```<code>ÆRẆP€ḟÆRfR - main link takes an argument, n
ÆR    ÆR   - primes up to n
  Ẇ        - all sublists
   P€      - product for each
     ḟ     - filter out the primes (since the sublists include those of lnegth 1)
        fR - filter out any not in range [1,N]
             (yep, it's calculating all products of primes up to n - gross)
</code>```

Title: Products of Consecutive Primes

Body:
Jelly, <s>14</s> 10 bytes

(no doubt there is golfing to do here! - yep...)

-4 bytes thanks to @Dennis - replace check for greater than n by using a range

ÆRẆP€ḟÆRfR

Note - this is both extremely inefficient and the results are unsorted.

Test it at TryItOnline

How?

ÆRẆP€ḟÆRfR - main link takes an argument, n
ÆR    ÆR   - primes up to n
  Ẇ        - all sublists
   P€      - product for each
     ḟ     - filter out the primes (since the sublists include those of lnegth 1)
        fR - filter out any not in range [1,N]
             (yep, it's calculating all products of primes up to n - gross)


答:
Java, 224 bytes

```<code>class N{public static void main(String[]a){String x="0HO1HA2HE3HI4BO5BA6BE7BI8KO9KAaKEbKIcDOdDAeDEfDI";for(int c:Long.toHexString(Long.valueOf(a[0])).toCharArray()){c=x.indexOf(c)+1;System.out.print(x.substring(c++,++c));}}}
</code>```

Using some lookup table trickery
Usage of Long type was to shave off a few bytes compared to Integer

Title: Convert to Bibi-binary

Body:
Bibi-binary is a numeric system invented by Boby Lapointe in order to represent numbers in letters which pronunciation seems funny.

Your task is to convert decimal numbers into Bibi-binary!

Conversion

A number is converted to base 16 (hexadecimal) and each character is replaced by its Bibi-binary name:

```<code>0 = HO
1 = HA
2 = HE
3 = HI
4 = BO
5 = BA
6 = BE
7 = BI
8 = KO
9 = KA
A = KE
B = KI
C = DO
D = DA
E = DE
F = DI
</code>```

Let N be a positive integer (between 1 -> 2^31-1).
For every character in the hexadecimal representation of N, replace the character by its according Bibi-binary pair (the table above contains all the pairs).

Example

N = 156

H = (hexadecimal representation of N) --> 9C

9 --> KA, C --> DO

Thus the output is KADO.

Input & output

You will receive an positive 32-bit integer N, which you will have to turn into Bibi-binary.

You may (return, print, etc...) in any convenient format, but the pairs have to be connected! So KA DO wouldn't be okay, but KADO would.

Both, lowercase and uppercase are allowed.

Rules

No loopholes.

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

Testcases

```<code>2048 -> KOHOHO
156 -> KADO
10000 -> HEBIHAHO
12 -> DO
</code>```

Body:
Java, 224 bytes

class N{public static void main(String[]a){String x="0HO1HA2HE3HI4BO5BA6BE7BI8KO9KAaKEbKIcDOdDAeDEfDI";for(int c:Long.toHexString(Long.valueOf(a[0])).toCharArray()){c=x.indexOf(c)+1;System.out.print(x.substring(c++,++c));}}}

Using some lookup table trickery
Usage of Long type was to shave off a few bytes compared to Integer


问:
Count from 1 to 100... in Roman Numerals
Write a program that count from 1 to 100 in Roman Numerals and print these numbers by standard output. Each one of the numbers must be separated by spaces.

You cannot use any built in function to transform to roman numerals nor external application or library to do so.

The desired result is

```<code>I II III IV V VI VII VIII IX X XI XII XIII XIV XV XVI XVII XVIII XIX XX XXI XXII XXIII XXIV XXV XXVI XXVII XXVIII XXIX XXX XXXI XXXII XXXIII XXXIV XXXV XXXVI XXXVII XXXVIII XXXIX XL XLI XLII XLIII XLIV XLV XLVI XLVII XLVIII XLIX L LI LII LIII LIV LV LVI LVII LVIII LIX LX LXI LXII LXIII LXIV LXV LXVI LXVII LXVIII LXIX LXX LXXI LXXII LXXIII LXXIV LXXV LXXVI LXXVII LXXVIII LXXIX LXXX LXXXI LXXXII LXXXIII LXXXIV LXXXV LXXXVI LXXXVII LXXXVIII LXXXIX XC XCI XCII XCIII XCIV XCV XCVI XCVII XCVIII XCIX C
</code>```

As it is a code golf challenge, shortest code wins.

答:
Python 116

better golfed code of scleaver's answer:

```<code>r=lambda a,b,c:('',a,2*a,3*a,a+b,b,b+a,b+a+a,b+3*a,a+c);print' '.join(i+j for i in r(*'XLC')for j in r(*'IVX'))+' C'
</code>```

Body:
Python 116

better golfed code of scleaver's answer:

r=lambda a,b,c:('',a,2*a,3*a,a+b,b,b+a,b+a+a,b+3*a,a+c);print' '.join(i+j for i in r(*'XLC')for j in r(*'IVX'))+' C'


答:
MATL, <s>25</s> 20 bytes

```<code>Zq&Xf"@gnq?2MpG>~?6M
</code>```

Approach similar to that in Jonathan Allan's answer.

Try it online!

Old version, 25 bytes

```<code>:YF!"@2<@sq0@0hhdz2=v?X@D
</code>```

This obtains the exponents of prime factor decomposition for all numbers from 1 to the input. For each it checks:

If all exponents are less than 2.

If the sum of all exponents is greater than 1.

The array of exponents is extended with an additional zero on each end. The consecutive differences of the extended array are computed. There should be exactly 2 nonzero differences.

If the three conditions are fulfilled the number is displayed. Results are in incresing order.

Title: Products of Consecutive Primes

Body:
As of time of submission to the sandbox, I had 17017 reputation, which you will all be able to factorise as 7×11×13×17, a product of 4 consecutive primes.

Please write a function or program to output all the products of two or more consecutive primes up to an input integer n. For example, given n=143 you should output 6, 15, 30, 35, 77, 105, 143 (or equivalent output format).

Normal restrictions on I/O and loopholes apply.

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

Body:
MATL, <s>25</s> 20 bytes

Zq&Xf"@gnq?2MpG>~?6M

Approach similar to that in Jonathan Allan's answer.

Try it online!

Old version, 25 bytes

:YF!"@2<@sq0@0hhdz2=v?X@D

This obtains the exponents of prime factor decomposition for all numbers from 1 to the input. For each it checks:

If all exponents are less than 2.

If the sum of all exponents is greater than 1.

The array of exponents is extended with an additional zero on each end. The consecutive differences of the extended array are computed. There should be exactly 2 nonzero differences.

If the three conditions are fulfilled the number is displayed. Results are in incresing order.


答:
05AB1E, <s>17</s> 15 bytes

```<code>L<ØŒ€PD¹>‹ÏDp_Ï
</code>```

Explanation

```<code>L<Ø                 # get the first N primes, where N is the input
   Œ                # get all combinations of consecutive primes
    €P              # calculate the product of these sublists
      D¹>‹Ï         # keep only the products less than or equal to N
           Dp_Ï     # keep only those that aren't prime
</code>```

Try it online!

Title: Products of Consecutive Primes

Body:
05AB1E, <s>17</s> 15 bytes

L<ØŒ€PD¹>‹ÏDp_Ï

Explanation

L<Ø                 # get the first N primes, where N is the input
   Œ                # get all combinations of consecutive primes
    €P              # calculate the product of these sublists
      D¹>‹Ï         # keep only the products less than or equal to N
           Dp_Ï     # keep only those that aren't prime

Try it online!


Title: Products of Consecutive Primes

Body:
Javascript (ES6), <s>105</s> 104 bytes

n=>{for(i=1,P=[];i++<n;P[P.every(v=>i%v)?i:n]=i);P.map(i=>P.map(j=>j>i&&(p*=j)<=n&&console.log(p),p=i))}

Demo

var f =
n=>{for(i=1,P=[];i++<n;P[P.every(v=>i%v)?i:n]=i);P.map(i=>P.map(j=>j>i&&(p*=j)<=n&&console.log(p),p=i))}

f(143)


Title: Hexplosive ASCII-art challenge

Body:
V, 60 bytes

Àé x@aA4 xr3^.òhYpXa 6^òkyHç^/:m0
Pç 3.*6/^r4$.
òÍ6 4./6

Try it online!

This is really way too long. Here is a hexdump, since this contains unprintable characters:

0000000: c0e9 2078 4061 4134 201b 7872 335e 2ef2  .. x@aA4 .xr3^..
0000010: 6859 7058 6120 361b 5ef2 6b79 48e7 5e2f  hYpXa 6.^.kyH.^/
0000020: 3a6d 300a 50e7 2033 2e2a 362f 5e72 3424  :m0.P. 3.*6/^r4$
0000030: 2e0a f2cd 3620 9334 852e 2f36            ....6 .4../6


问:
Mirror, Mirror, in the Code
Two-dimensional programming languages often have mirror commands like / and \ to redirect the instruction pointer on the grid:

```<code>>>>>\
    v
    v
<<<</
</code>```

In this challenge, you're given an incoming direction and a mirror and you need to determine the outgoing direction.

Rules

The incoming direction will be given as one of the characters NESW and the mirror will be given as either / or \. You may receive these in any order. You must use uppercase letters.

You may take input in any convenient format, including a two-character string, a string using some separator between the characters, a pair of characters in a list, or even a pair of singleton strings. If you do use a string with separator, the separator cannot use any of the characters NWSE\/.

Output should be a character from NESW or single-character string.

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

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

There are only 8 possible inputs you need to handle, so there is no excuse for not testing your code on all of them:

```<code>N /   -->   W
N \   -->   E
E /   -->   S
E \   -->   N
S /   -->   E
S \   -->   W
W /   -->   N
W \   -->   S
</code>```

答:
C, 44, 35, 34 bytes

```<code>f(a,b){return"NWES"[a&a/2&3^b&3];}
</code>```

It requires two characters as two variables. It takes both lower and upper case. It uses a lot of bit manipulation. The fragment a&a/2 results in a value that has unique values for the lower two bits, &3 cuts off all higher bits. This used as an index into the string "NWES" for the \ mirror. Luckily, the lower two bits of the ASCII characters \ and / are 00 and 11 respectively, which is perfect to XOR with the aforementioned index to get the correct direction for the / mirror.

Title: Mirror, Mirror, in the Code

Body:
C, 44, 35, 34 bytes

f(a,b){return"NWES"[a&a/2&3^b&3];}

It requires two characters as two variables. It takes both lower and upper case. It uses a lot of bit manipulation. The fragment a&a/2 results in a value that has unique values for the lower two bits, &3 cuts off all higher bits. This used as an index into the string "NWES" for the \ mirror. Luckily, the lower two bits of the ASCII characters \ and / are 00 and 11 respectively, which is perfect to XOR with the aforementioned index to get the correct direction for the / mirror.


问:
Help: Aliens Programmers only speak ASCII

Setting the Scene:

It is an average afternoon, as you unwind after a long day by engaging in your favorite pastime: answering the plethora of captivating questions on PPCG. It hasn't been a good day for you; those damned Pyth programmers keep getting best answer and it's killing your vibe. Suddenly, you notice a new question has been posted! You make up your mind; not this time CJammers. Furiously, you begin to type, birthing a stream of characters; a fetus of the glorious BrainFuck loop that your end product will be. You type and type. Faster! Faster still! You're so focused you don't even notice the lights on your screen start to flicker on and off. Suddenly, the monitor glows green, an alien like symbol branded upon the desktop. Using your impeccable skills you cat ~/Desktop/aliensymbol and get presented with a bunch of numbers, a message! Being the shrewd PPCG programmer that you are, you notice that it looks like ASCII. No matter for you, you print(chr(i) for i in file) and decipher the message. Your first thought: "I need to share this with the community!".

...

Who would've thought it? That the first people to make contact with aliens would be the humble programmers of PPCG. Why us? Maybe it is because we are the epitome of human intelligence. Or maybe because BrainFuck is about as close as we have to an alien language. Nevertheless, the aliens - being the ultra-intelligent life forms that they are - want to test whether they should classify the human race as  intelligent or not. As a test of our mental prowess, the aliens have asked us to send them a few computer programs to demonstrate that we are technologically cultured. The issue is, the only human language they understand is numerical ASCII!

Help humankind show those creatures who the real intellectual alpha is. We need to send them a script that will convert our text based source codes into their numerical ASCII versions. Unfortunately, due to our underdeveloped technology (thanks Obama), we must send as small a translating program as possible. Good thing they chose to contact PPCG!

The Challenge:

The premise of this challenge is simple: you are to write a program that will take any program's source code (or any general text file for that matter), and output a space separated version of it with an ASCII translation below each line. That is, given an input of a text file, you need to output each line of that file followed by a line containing the ASCII representation of each character in the line above it (with each number lining up with the character it represents).

An example will greatly clarify this. Taking the source code of the infamous hello world as the input:

```<code>#include <stdio.h>

int main() {
    printf("hello, world\n");
    return 0;
}
</code>```

your program should output:

```<code>#   i   n   c   l   u   d   e       <   s   t   d   i   o   .   h   >
35  105 110 99  108 117 100 101 32  60  115 116 100 105 111 46  104 62  10

10
i   n   t       m   a   i   n   (   )       {
105 110 116 32  109 97  105 110 40  41  32  123 10
                p   r   i   n   t   f   (   "   h   e   l   l   o   ,       w   o   r   l   d   \   n   "   )   ;
32  32  32  32  112 114 105 110 116 102 40  34  104 101 108 108 111 44  32  119 111 114 108 100 92  110 34  41  59  10
                r   e   t   u   r   n       0   ;
32  32  32  32  114 101 116 117 114 110 32  48  59  10
}
125 10
</code>```

Implementation Details:

You may choose to take the input in whatever form you wish (opening file, command line pipe, function parameter etc.) and you should output to stdout or return the output from a function.

Things to note

Each character in the output is separated by a '\t' to allow for the space of 3 digits in the line below to line up (we are going to assume your tab is set to 4 spaces or more).

The newlines are displayed on the line that the return key was pressed (notice the 10's in the example)

The '\t' and '\n' printing requirements are lax. Your output must, in the general sense, look pleasing to the eye (need to show those aliens we have aesthetic sense as well), and if you can bend the previous two points while maintaining visual integrity, you will be forgiven.

You can choose to assume whether or not there is a newline at the end of the last line.

Scoring

This is code-golf so shortest program wins. Note, even if your program isn't the shortest, but uses really neat tricks relative to the language you are using, many +1's to you!

Good luck. The intergalactic intelligence ranking of humanity rests on your shoulders.

Note: Please forgive the plot holes. I'm not a writer :D

答:
Dyalog APL, 14 bytes

Takes list of strings that include newline sequences (10 or 13 10 etc.)

↑(⊢,[.5]⎕UCS)¨
```

↑ matrify the list of lists consisting of

(...)¨ for each line return...

 ⊢ the text itself

 ,[.5] followed in a new dimension before the first dimension by

 ⎕UCS the Unicode Character Set code points

TryAPL online!

Body:
Dyalog APL, 14 bytes

Takes list of strings that include newline sequences (10 or 13 10 etc.)

↑(⊢,[.5]⎕UCS)¨

↑ matrify the list of lists consisting of

(...)¨ for each line return...

 ⊢ the text itself

 ,[.5] followed in a new dimension before the first dimension by

 ⎕UCS the Unicode Character Set code points

TryAPL online!


答:
Pyth, 18 bytes

```<code>f}PTftlY.:fP_YSQ)S
</code>```

A program that takes input of an integer on STDIN and prints a list of integers.

Try it online

How it works

```<code>f}PTftlY.:fP_YSQ)S  Program. Input: Q
              SQ    Yield [1, 2, 3, ..., Q]
          fP_Y      Filter that by primality
        .:      )   Yield all sublists of that
    f               Filter the sublists by:
      lY             Length
     t               -1
                    removing sublists of length 1
f                S  Filter [1, 2, 3, ..., Q] (implicit input fill) by:
  PT                 Prime factorisation
 }                   is in the sublists
                    Implicitly print
</code>```

Title: Products of Consecutive Primes

Body:
Pyth, 18 bytes

f}PTftlY.:fP_YSQ)S

A program that takes input of an integer on STDIN and prints a list of integers.

Try it online

How it works

f}PTftlY.:fP_YSQ)S  Program. Input: Q
              SQ    Yield [1, 2, 3, ..., Q]
          fP_Y      Filter that by primality
        .:      )   Yield all sublists of that
    f               Filter the sublists by:
      lY             Length
     t               -1
                    removing sublists of length 1
f                S  Filter [1, 2, 3, ..., Q] (implicit input fill) by:
  PT                 Prime factorisation
 }                   is in the sublists
                    Implicitly print