[Question]
      [
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).
## Input:
* A positive integer `n >= 1`.
## Output:
* `n` lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.
## Test case (n=5):
```
    *
    **
    ***
    ****
    *****
```
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes wins.

[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 22 bytes
```
?(.;I:^;/-.@o;(!\>'*oN
```
[**Test it online!**](http://ethproductions.github.io/cubix/?code=PyguO0k6XjsvLS5AbzsoIVw+JypvTg==&input=NQ==) Outputs a trailing newline.
At first I wasn't sure I could get this to fit on a 2-cube, but in the end it worked out fine:
```
    ? (
    . ;
I : ^ ; / - . @
o ; ( ! \ > ' *
    o N
    . .
```
I'll add an explanation when I have time, hopefully later today.
[Answer]
# [CJam](http://sourceforge.net/projects/cjam/), ~~13~~ ~~11~~ 10 bytes
*Thanks to @MartinEnder for removing two bytes, and @Linus for removing one more!*
```
ri{)'**N}%
```
[Try it online!](http://cjam.tryitonline.net/#code=cml7KScqKk59JQ&input=NQ)
### Explanation
```
ri            e# Read input as an integer n
  {     }%    e# Run this block for each k in [0 1 ... n-1]
   )          e# Add 1 to the implicitly pushed k
    '*        e# Push asterisk character
      *       e# Repeat the character k+1 times
       N      e# Push newline
              e# Implicitly display
```
[Answer]
# [Pushy](https://github.com/FTcode/Pushy), 4 bytes
```
:42"
```
[**Try it online!**](https://tio.run/nexus/pushy#@29lYqT0//9/UwA)
This method takes advantages of Pushy's automatic int/char conversion:
```
        \ Implicit: Input on stack
:       \ Input times do: (this consumes input)
 42     \   Push 42 (char '*')
   "    \   Print whole stack
```
Because each iteration adds a new `*` char, this outputs a triangle. For example, with `n=4`:
```
*       \   Stack: [42]
**      \   Stack: [42, 42]
***     \   Stack: [42, 42, 42]
****    \   Stack: [42, 42, 42, 42]
```
[Answer]
# LaTeX, 171 bytes
I had to use LaTeX instead of plain TeX for the `\typein` macro...
Here it is, as golfed as I could:
```
\documentclass{book}\begin{document}\typein[\n]{}\newcount\i\newcount\a\i=0\loop{\a=0\loop*\advance\a by1\ifnum\i>\a\repeat}
\advance\i by1
\ifnum\n>\i\repeat\enddocument
```
Explanation:
```
\documentclass{book}% Book because it is shorter than article ;)
\begin{document}% Mandatory...
\typein[\n]{}% User inputs \n
\newcount\i% Create a line counter
\newcount\a% And an asterisk counter
\i=0% Initializes the line number to zero
\loop{% Line number loop
   \a=0% Sets the number of asterisks to zero
   \loop% Asterisk loop
   *% Prints the asterisk
   \advance \a by 1% Adds one to \a
   \ifnum\i>\a% If the line number is smaller than the number of asterisks
   \repeat% Then repeat
     }% Otherwise prints a new line
\advance\i by 1% And add 1 to the line counter
\ifnum\n>\i% If input number is less than the number of lines then
\repeat% Repeat
\enddocument% And finish LaTeX
```
[Answer]
# Java ~~7~~ 11, ~~88~~ ~~73~~ 58 bytes
```
String c(int n){return(n<2?"":c(n-1)+"\n")+"*".repeat(n);}
```
-15 bytes by converting to Java 11.
[Try it online](https://tio.run/##VZBBTwIxEIXv/IqXerCVBcSDBzHxrInxgDfgULqjW9xtSTsLIYTfvnbdJoZL0/bN@2bm7fRBT3blT2dqHSPetXXnERBZszXolhys@4aR1jGcOgfiNjjpnh9ehHgy0k3maizWTqhxoD1pluJOFE4tLh2wb7d1gmTWwdsSTeLLAbraQKu@F7A8RaZm6lue7pPE0shHpRZJu4zSMZvh8/UDpafobhmVPhDe0tyYz3EiLhA9uLIRDXHlSxwtV6CmrTUThmY3eboEV9AR@TmIxd/vlw@JQoi6IWxPTBPjW8f/YeQsrqxJC70duumL8z5DSnB0zCbZX02lw2qo26hpwtTakBTre1EkSl730v0C). (NOTE: `String#repeat(int)` is emulated as `repeat(String,int)` for the same byte-count, because TIO doesn't contain Java 11 yet.)
**Explanation:**
```
String c(int n){          // Recursive method with integer parameter and String return-type
  return(n<2?             //  If `n` is 1:
          ""              //   Start with an empty String
         :                //  Else:
          c(n-1)          //   Start with a recursive call with `n-1`
                +"\n")    //   and a trailing new-line
         +"*".repeat(n);} //  And append `n` amount of '*'
```
[Answer]
# [R](https://www.r-project.org/), 33 bytes
```
cat(strrep("*",1:scan()),sep="
")
```
[Try it online!](https://tio.run/##K/r/PzmxRKO4pKgotUBDSUtJx9CqODkxT0NTU6c4tcBWiUtJ87@h0X8A "R – Try It Online")
I hope it's not a dupe - I was able to find only one other R answer.
Leverages `strrep` and vectorization to build the vector `"*","**",...,"******"` and prints with `cat` using `newline` as a separator.
[Answer]
# [Dyalog APL](https://dyalog.com/), 8 [bytes](https://github.com/abrudz/SBCS)
```
'*'/⍤0⍨⍳
```
Explanation:
1. `'*'`: Literal character `*`.
2. `/⍤0⍨`: Select each 0-ranked vector (scalar) according to.
* `/`: Select from the right argument according to the left.
* `⍤0`: Apply the preceding function to each scalar in the left and right arguments.
* `⍨`: Apply the preceding function, but with the left and right arguments switched (so we select now from the left argument according to the right).
3. `⍳`: Generate integers from 1 to the argument (inclusive)
[Answer]
# [Rockstar](https://codewithrockstar.com/), 47 bytes
```
listen to N
X's0
while N-X
let X be+1
say "*"*X
```
[Try it here](https://codewithrockstar.com/online) (Code will need to be pasted in)
[Answer]
# [Regenerate](https://github.com/dloscutoff/Esolangs/tree/master/Regenerate), 3 bytes
```
\*+
```
You need to pass the input using `-l` flag.
Example run:
```
wasif@wasif:~/Downloads/Regenerate$ python3 regenerate.py -l 5 '\*+'
*
**
***
****
*****
wasif@wasif:~/Downloads/Regenerate$
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~7~~ 5 bytes
```
L'*×»
```
[Try it online!](https://tio.run/##yy9OTMpM/f/fR13r8PRDu///NwUA "05AB1E – Try It Online")
[Answer]
## Batch, 69 bytes
```
@set s=
@for /l %%i in (1,1,%1)do @call set s=*%%s%%&call echo %%s%%
```
[Answer]
# Ruby, 26 bytes
```
->n{s='';n.times{p s+=?*}}
```
[Answer]
# Brainfuck, 70 bytes
```
,>++++++[<-------->>>+++++++<<-]<[>+[->+>.<<]>[-<+>]++++++++++.[-]<<-]
```
I'm sure this could be golfed a little bit. This version only works for single-digit numbers; feel free to modify it to work on larger numbers too.
Edit: If it's allowed to use a single character's ASCII value as the input, the resulting code is below. Only 60 bytes.
```
,>++++++[>>+++++++<<-]>[>+[->+>.<<]>[-<+>]++++++++++.[-]<<-]
```
Explanation:
```
,>++++++[<-------->>>+++++++<<-]  [this gets a single character from
input into the first cell, subtracts 48 to convert it to an integer
representation, and puts 42 in the 3rd cell (ASCII '*').]
<[ while the first cell is not zero do
    >+   add 1 to 2nd cell (empty when we start)
    [->+>.<<]  [while 2nd cell is not empty subtract 1 and print an *.
                Make a copy in 3rd cell.]
    >[-<+>]  copy 3rd cell value back to 2nd cell
    ++++++++++.[-] [put '\n' in 3rd cell, print, clear]
    <<-
 ] loop
```
Edit: Here is a version that works for numbers up to 255, reading the *text* representation of the number followed by EOF. If your favorite interpreter has unbounded cells it will work up to 999.
```
>>,[----------
[
    >++++++[<------>-]<--
>],]
[
 Pointer is one past the end of a run of digits containing input.
 Assumption: input < 256.
 Add ten times most significant digit to second and ten times the
 second to the third to get it in one cell.
]
<<<[>++++++++++<-]>[>++++++++++<-]>
Store 42 '*' in the cell 3 to the right
>>++++++[>+++++++<-]<<
[ While first cell is not empty
    >+ Add 1 to 2nd cell
    [->+>.<<] [make a copy in 3rd cell, print '*']
    >[<+>-] copy 3rd back to 2nd
    ++++++++++.[-] print newline and clear 3rd
    <<- subtract 1 from 1st and continue
]
```
[Answer]
# [RProgN](https://github.com/TehFlaminTaco/Reverse-Programmer-Notation), 41 Bytes.
24 of these bytes are just assigning R and s, so that we can use a spaceless segment.
```
'rep' º 'R' = '*' 's' = ►]¿]s\R\1-]}[
```
## Explination
```
'rep' º 'R' =       # Get the function for 'rep' (Replace), associate 'R' with it.
'*' 's' =           # Associate 's' with the string literal '*'
►                   # Begin spaceless segment.
    ]               # Push a copy of the top of the stack (The input)
    ¿               # While truthy, popping the top of the stack.
        ]           # Push a copy...
        s \ R       # Push an *, swap the two top values giving "i, *, i", Repeat the *, i times, giving "i, ****", or whatever.
        \ 1 -       # Swap the top values, giving "****, i", decrement the top value by 1.
        ]           # Push a copy of the top value.
    }[              # End the while, after processing, pop the top value (Which would be 0). Implcititly print.
```
## Try it!
```
<style>
  #frame{
    width:60em;
    height:60em;
    border:none;
  }
</style>
<iframe id='frame' src="https://tehflamintaco.github.io/Reverse-Programmer-Notation/RProgN.html?rpn=%27rep%27%20%C2%BA%20%27R%27%20%3D%20%27*%27%20%27s%27%20%3D%20%E2%96%BA%5D%C2%BF%5Ds%5CR%5C1-%5D%7D%5B&input=5">Sorry, You need to support IFrame. Why don't you..?</iframe>
```
[Answer]
# Groovy, 27 characters
```
{1.upto(it){println"*"*it}}
```
Sample run:
```
groovy:000> ({1.upto(it){println"*"*it}})(5)
*
**
***
****
*****
===> null
```
[Answer]
# jq, 19 characters
(18 characters code + 1 character command line option.)
```
range(1;.+1)|"*"*.
```
Sample run:
```
bash-4.3$ jq -r 'range(1;.+1)|"*"*.' <<< 5
*
**
***
****
*****
```
[On-line test](https://jqplay.org/jq?q=range(1%3b.%2b1)|"*"*.&j=5) (Passing `-r` through URL is not supported – check Raw Output yourself.)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 5 bytes
```
Ｇ↓→Ｎ*
```
It's the same length as Jelly, which is really bad for an ASCII-art oriented language. At least it's readable, I guess
### Explanation
```
Ｇ      Polygon
 ↓→     Down, then right
   Ｎ   Input number
     *  Fill with '*'
```
[Answer]
# Lua, 36 bytes
```
for i=1,...do print(("*"):rep(i))end
```
Takes input from the command line.
[Answer]
## Haskell, 32 bytes
```
unlines.(`take`iterate('*':)"*")
```
The expression `iterate('*':)"*"` generates the infinite list `["*","**","***","****","*****",...]`. The function then takes the first `n` elements and joins them with newlines.
The more direct
```
concat.(`take`iterate('*':)"*\n")
```
is one byte longer.
[Answer]
# RProgN, 42 Bytes, Competing only for the Bounty
```
Q L c 's' =
►3'rep'º'R'=]¿]s\R\1-]} [
```
>
> The length of the script is used as the character code for \*.
>
>
>
[Try it Online!](https://tehflamintaco.github.io/Reverse-Programmer-Notation/RProgN.html?rpn=Q%20L%20c%20%27s%27%20%3D%20%0A%E2%96%BA3%27rep%27%C2%BA%27R%27%3D%5D%C2%BF%5Ds%5CR%5C1-%5D%7D%20%5B&input=)
[Answer]
# Perl, ~~83~~ 76 bytes (no asterisk)
```
print substr((split("\n",`perldoc perlre`))[55],48,1)x$_."\n"foreach(1..<>);
```
(Faster version for large input, 83 characters):
```
$r=`perldoc perlre`;print substr((split("\n",$r))[425],11,1)x$_."\n"foreach(1..<>);
```
Explanation:
The statement `perldoc perlre` executes the shell command to display the Perl documentation on regular expressions, which contains an asterisk as the 11th character on line 425. Split the resulting output by line, then extract that character and print in triangular format.
Edited to save 6 characters by not saving the output of the shell command, and instead just running it every time. It increases the runtime, though, but we only care about bytes, not runtime :)
Another byte was saved (for a total of -7) by finding an earlier asterisk in the perldoc output.
[Answer]
# ForceLang, 146 bytes
```
def S set
def G goto
S a io.readnum()
S b 0
label 0
if a=b
G 1
if b
io.writeln()
S b 1+b
S c 0
label b
io.write "*"
S c 1+c
if b=c
G 0
G b
label 1
```
[Answer]
# Python 2, ~~38~~ 37 bytes
There are only 36 characters shown, but a trailing newline is needed to avoid an EOF-related error raised by the interpreter. 1 byte knocked off for Flp.Tkc's observation.
```
for n in range(input()+1):print'*'*n
```
### Output for n=5
```
# leading newline here
*
**
***
****
*****
```
# Python 3, 45 bytes
The actual list comprehension is never assigned or printed, but if it were, it would be full of `None`s, as `None` is the default return value of `print()`.
```
[print('*'*n)for n in range(int(input())+1)]
```
[Answer]
# TI-Basic, ~~28~~ 22 bytes
```
Prompt A
"*
For(B,1,A
Disp Ans
Ans+"*
End
```
[Answer]
## [Underload](https://esolangs.org/wiki/Underload), ~~15~~ 13 bytes
-2 or -3 bytes thanks to @ØrjanJohansen
```
(
)((*)~*:S)^
```
Input is a Church numeral [inserted](https://codegolf.meta.stackexchange.com/a/10553/61384) between the `)` and `^` on the second line. For example:
```
(
)((*)~*:S)::*:**^
```
If printing a leading newline is allowed, the following solution works by ommiting the `~`, for 12 bytes:
```
(
)((*)*:S)^
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 7 bytes[SBCS](https://github.com/abrudz/SBCS)
```
(,⍕⊢)⌸⍳
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qG9qZv6jtgmG/9OApIbOo96pj7oWaT7q2fGod/P//2kKpgA "APL (Dyalog Unicode) – Try It Online")
[Answer]
## [W](https://github.com/A-ee/w) `n`, ~~6~~ 4 bytes
```
'**M
```
## Explanation
```
   M           % Map every item in the implicit input with...
               % (There's an implicit range from 1)
'**            % asterisks input times
n % Join the result with a (n)ewline
```
# How do I use the `n` flag?
`... W.py filename.w [input-list] n`
[Answer]
# [GolfScript](http://www.golfscript.com/golfscript/), 11 bytes
```
~,{)"*"*n}%
```
[Try it online!](https://tio.run/##S8/PSStOLsosKPn/v06nWlNJS0krr1b1/39TAA "GolfScript – Try It Online")
### Explanation:
```
~,                  Create list [0...input-1]
  {      }%         Map over list:
   )"*"*n           Increment, push that many "*"s, push newline
```
[Answer]
# [Flurry](https://github.com/Reconcyl/flurry), 88 bytes
```
{}{()[<><<>()>({})]({}{(){}(((<><<>()>){})[{}{<({}){}>}])}{<(<({})(<({}){}>){}>){}>})}{}
```
Can be run with the interpreter as follows:
```
$ ./Flurry -bnn -c "$pgm" 5
*
**
***
****
*****
```
This is heavily based on [my answer to "Print a 10 by 10 grid of asterisks"](https://codegolf.stackexchange.com/a/211556/61384). In particular, I'm reusing my derivations of `succ`, and `push_star`, and the number `10`.
`push_star` is a function that pushes 42 to the stack and returns its argument unchanged:
```
push_star := {(){}(((<><<>()>){})[{}{<({}){}>}])}
```
A function that takes a number `n` and pushes 42 to the stack `n` times, then pushes 10, and returns `n+1`:
```
push_row = λn. (n push_star (); push 10; succ n)
         = λn. (push (n push_star 10); succ n)
         = λn. K (succ n) (push (n push_star 10))
         = λn. K (succ (push n)) (push (pop push_star 10))
        := {  () [succ (    {})] (      {}  push_star 10)}
        := {  () [succ (    {})] (      {}  push_star {<(<({})(<({}){}>){}>){}>})}
        := {  () [succ (    {})] (      {}  {(){}(((<><<>()>){})[{}{<({}){}>}])}{<(<({})(<({}){}>){}>){}>})}
        := {()[<><<>()>({})]({}{(){}(((<><<>()>){})[{}{<({}){}>}])}{<(<({})(<({}){}>){}>){}>})}
```
The number 1:
```
1 = λf n. f n
  = λf. f
 := {  {} }
```
Pop a number from the stack and apply `push_row` that many times to 1:
```
main = pop push_row 1
    := {}{()[<><<>()>({})]({}{(){}(((<><<>()>){})[{}{<({}){}>}])}{<(<({})(<({}){}>){}>){}>})}{{}}
```
Since popping from an empty stack returns 1, we can replace the final `{{}}` with `{}`, yielding:
```
{}{()[<><<>()>({})]({}{(){}(((<><<>()>){})[{}{<({}){}>}])}{<(<({})(<({}){}>){}>){}>})}{}
```
[Answer]
## Actually, 8 bytes
```
R`'**`Mi
```
[Try it online!](http://actually.tryitonline.net/#code=UmAnKipgTWk&input=NQ)
Explanation:
```
R`'**`Mi
R         range(1, n+1) ([1, 2, ..., n])
 `'**`M   for each element: that many asterisks
       i  flatten and implicitly print
```
---
## 5 bytes
```
R'**i
```
[Try it online!](http://actually.tryitonline.net/#code=UicqKmk&input=NQ)
]


[Question]
      [
### Introduction
The [Atari ST](https://en.wikipedia.org/wiki/Atari_ST) was a rather popular personal computer from the mid 80's to early 90's era, powered by a Motorola 68000 microprocessor. On this machine, the default behavior of the operating system for uncaught CPU exceptions was to display a row of bombs on the screen, as shown in the following picture:
[![row of bombs](https://i.stack.imgur.com/CwMSk.png)](https://i.stack.imgur.com/CwMSk.png)
*Source: <https://commons.wikimedia.org/wiki/File:Row_of_bombs.png>*
*NB: Depending on the OS version, the bomb graphics may vary slightly. But let's take this one as reference.*
The number of bombs depends on the exception vector, the most common ones being:
* ($008) Bus Error : 2 bombs
* ($00c) Address Error : 3 bombs
* ($010) Illegal Instruction : 4 bombs
### Goal
Your goal is to write a program or function that prints or outputs an ASCII art of such Atari ST bombs.
### Input
An integer representing the number of bombs to display. Your code must support the most common values: 2, 3 and 4. Supporting less and/or more bombs is fine, but it is neither required nor subject to a bonus.
### Output
The original bomb consists of a 16x16 pixel tile, represented here in both ASCII and binary:
```
....##..........    0000110000000000
.#.#..#.........    0101001000000000
.......#........    0000000100000000
#..#....#.......    1001000010000000
..#...#####.....    0010001111100000
......#####.....    0000001111100000
....#########...    0000111111111000
...###########..    0001111111111100
...###########..    0001111111111100
..#############.    0011111111111110
..########.####.    0011111111011110
...#######.###..    0001111111011100
...######.####..    0001111110111100
....#########...    0000111111111000
.....#######....    0000011111110000
.......###......    0000000111000000
```
In this challenge, each ASCII bomb must be stretched to twice its original width for a better rendering. Therefore, it will consist of 16 rows of 32 characters, using `##` for 'ON' pixels and two spaces for 'OFF' pixels. All bomb tiles must be put side by side. Leading spaces are forbidden. Trailing spaces are also forbidden, except the ones that are actually part of the bomb tile (i.e. the 31st and 32nd columns) which *must* be present. You may include no more than one leading line-break and no more than one trailing line-break.
### Example
Below is the reference output for two bombs, where mandatory line-breaks are marked as `\n` and tolerated extra line-breaks are marked as `(\n)`:
```
(\n)
        ####                            ####                    \n
  ##  ##    ##                    ##  ##    ##                  \n
              ##                              ##                \n
##    ##        ##              ##    ##        ##              \n
    ##      ##########              ##      ##########          \n
            ##########                      ##########          \n
        ##################              ##################      \n
      ######################          ######################    \n
      ######################          ######################    \n
    ##########################      ##########################  \n
    ################  ########      ################  ########  \n
      ##############  ######          ##############  ######    \n
      ############  ########          ############  ########    \n
        ##################              ##################      \n
          ##############                  ##############        \n
              ######                          ######            (\n)
```
(Of course, other line-break formats such as `\r` or `\r\n` may be used just as well.)
### Rules
This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~43~~ 44 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
+1 byte - forgot to double the characters (not that anyone noticed!)
```
“¥vẏ)X;ndĊɓ¡ẹ3ċi}Ịɲ¡P"¦ḊƥṾ’b⁴‘ĖŒṙị⁾ #Ḥs⁴ẋ€³Y
```
**[TryItOnline](http://jelly.tryitonline.net/#code=4oCcwqV24bqPKVg7bmTEismTwqHhurkzxItpfeG7ismywqFQIsKm4biKxqXhub7igJli4oG04oCYxJbFkuG5meG7i-KBviAj4bikc-KBtOG6i-KCrMKzWQ&input=&args=Mw)**
### How?
Preparation was to compress the data as a run-length encoding of the original image:
* Count the length of each run of `1`s (space) or `0`s (hash) in the image, ignoring new lines - yields a list: `[4,2,11,1,1,...]`;
* Subtract one from each number - this gives a range of `[0,15]`;
* Treat this as a base-16 number (enumerate the values, `v`, with index `i` in reverse and sum up `16**i*v` = `19468823747267181273462257760938030726282593096816512166437`);
* Convert this to base-250: `[5,119,249,42,...]`;
* Map into Jelly's code page as indexes: `¥vẏ)X;ndĊɓ¡ẹ3ċi}Ịɲ¡P`
Now the code evaluates this number, maps the `1`s and `0`s to space and hash characters\*, doubles each, splits into lines and repeats each the appropriate number of times.
\* actually the implementation is performed modulo 2 to save bytes, so spaces are odd and hashes are even:
```
“¥vẏ)X;ndĊɓ¡ẹ3ċi}Ịɲ¡P"¦ḊƥṾ’b⁴‘ĖŒṙị⁾ #Ḥs⁴ẋ€³Y - Main link: n
“¥vẏ)X;ndĊɓ¡ẹ3ċi}Ịɲ¡P"¦ḊƥṾ’                  - base 250 number, as above
                           b⁴                - convert to base 16 (the run length - 1 list)
                             ‘               - increment (vectorises) (the run length list)
                              Ė              - enumerate (pairs each with 1,2,3...)
                               Œṙ            - run length decode
                                              ([1,1,1,1,2,2,3,3,3,3,3,3,3,3,3,3,3,4,5,...])
                                  ⁾ #        - string " #"
                                 ị           - index into (1 based and modular)
                                              (makes a bomb without line feeds)
                                     Ḥ       - double (each char becomes a list of 2 chars)
                                      s⁴     - split into slices of length 16
                                        ẋ€³  - repeat each input, n, times
                                           Y - join with line feeds
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~57~~ ~~55~~ ~~53~~ 50 bytes
Uses [CP-1252](http://www.cp1252.com/) encoding.
```
•ø6ŒY2l½î€ÈS`L<eÆô‚˜3ª½¨ºE»D2Âô3•b15ôvy1J€D„# è¹×,
```
[Try it online!](http://05ab1e.tryitonline.net/#code=4oCiw7g2xZJZMmzCvcOu4oKsw4hTYEw8ZcOGw7TigJrLnDPCqsK9wqjCukXCu0Qyw4LDtDPigKJiMTXDtDHCq3Z54oKsROKAniMgw6jCucOXLA&input=NA)
**Explanation**
As the output image only consists of 2 characters we can represent it as a binary number.
We can ignore newlines as every line has the same length.
We can ignore the last char of each row as it the same for all rows.
We use the thinner image as it takes up less space and we can easily duplicate each character later.
Using **1** to represent **space** and **0** to represent **#** we get the binary number:
`111100111111111101011011111111111111101111111011011110111111110111000001111111111000001111111100000000011111000000000001111000000000001110000000000000110000000010000111000000010001111000000100001111100000000011111110000000111111111100011111`
We then convert this to base-10 and then compress it to base 214, the maximum base in 05AB1E. The result of this is:
```
•ø6ŒY2l½î€ÈS`L<eÆô‚˜3ª½¨ºE»D2Âô3•
```
The meat of the program then consist of the following:
```
<base encoded string>
  b                     # convert to binary
   15ô                  # slice into pieces of 15
      v                 # for each slice
       1J               # append a 1
         €D             # duplicate each character
           „#           # push the string "# "
             è          # use the list of binary digits to index into the string
              ¹×        # repeat string input number of times
                ,       # and print with newline
```
[Answer]
# Pyth, ~~57~~ ~~56~~ ~~54~~ ~~53~~ ~~51~~ 50 bytes
The code contains unprintable characters, so here's a reversible `xxd` hexdump.
```
00000000: 6a2a 4c51 6331 3673 2e65 2a79 6240 2220  j*LQc16s.e*yb@"
00000010: 2322 6b6a 4322 4c49 c142 3c60 0cca 9437  #"kjC"LI.B<`...7
00000020: b383 76bb c246 c86d 4c04 99bd 3614 7022  ..v..F.mL...6.p"
00000030: 3137                                     17
```
[Try it online.](http://pyth.herokuapp.com/?code=j%2aLQc16s.e%2ayb%40%22+%23%22kjC%22LI%C3%81B%3C%60%0C%C3%8A%C2%947%C2%B3%C2%83v%C2%BB%C3%82F%C3%88mL%04%C2%99%C2%BD6%14p%2217&input=2&debug=0)
[Answer]
# JavaScript (ES6), ~~159~~ ~~154~~ ~~140~~ 136 bytes
*Saved lots of bytes thanks to @Hedi and @Arnauld*
```
n=>[..."ￏﾵｿﻶ쀇쀇考萃쐇숇ﱿ"].map(x=>(f=q=>q?(q&1?"  ":"##")+f(q>>1):"")(x.charCodeAt()).repeat(n)).join`
`
```
That's 104 chars, but (sadly) 136 UTF-8 bytes. The string was generated with this snippet:
```
console.log([
0b1111111111001111,
0b1111111110110101,
0b1111111101111111,
0b1111111011110110,
0b1111100000111011,
0b1111100000111111,
0b1110000000001111,
0b1100000000000111,
0b1100000000000111,
0b1000000000000011,
0b1000010000000011,
0b1100010000000111,
0b1100001000000111,
0b1110000000001111,
0b1111000000011111,
0b1111110001111111
].map(x=>(65535-x).toString(16)).join(","))
```
Using `.replace` instead of `[...string].map` is equally long:
```
n=>"ￏﾵｿﻶ쀇쀇考萃쐇숇ﱿ".replace(/./g,x=>(f=q=>q?(q&1?"  ":"##")+f(q>>1):"")(x.charCodeAt()).repeat(n)+`
`)
```
### How it works
Since each row of the raw data can be represented as a 16-bit number, we can store the entire file in a 16-char string. The compression algorithm takes each binary row, flips it and reverses it (since every row in the original ends in a **0**, every row in the modified version now *starts* with a **1**), then turns it into a char, and concatenates the resulting characters.
To decompress it, we need to extract the charcode and turn its binary representation into a string of hashes and spaces. This can be done with a recursive function, like so:
```
(f=q=>q?(q&1?"  ":"##")+f(q>>1):"")(x.charCodeAt())
```
`f` repeatedly takes the last bit of `q`, selecting two spaces if it's 1 or two hashes if it's 0, then concatenates that with the result of running `f` in the rest of `q`. This is run on `x.charCodeAt()`, turning the char-code into the correct string of spaces and hashes.
(There was a lot more drama here before, but the 4-byte-saving technique erased all of that.)
After that, we can just repeat the string `n` times and add a newline. This is the shortest decompression method I have found, but feel free to suggest any possibly shorter methods.
Other attempts at compressing the string:
```
n=>[48,74,128,265,1988,1984,8176,16376,16376,32764,31740,15352,15864,8176,4064,896].map(x=>(f=q=>q?(q&1?"  ":"##")+f(q>>1):"")(65535-x).repeat(n)).join`
`
n=>"1c,22,3k,7d,1j8,1j4,6b4,cmw,cmw,pa4,oho,bug,c8o,6b4,34w,ow".split`,`.map(x=>(f=q=>q?(q&1?"  ":"##")+f(q>>1):"")(65535-parseInt(x,36)).repeat(n)).join`
`
n=>"30,4a,80,109,7c4,7c0,1ff0,3ff8,3ff8,7ffc,7bfc,3bf8,3df8,1ff0,fe0,380".split`,`.map(x=>(f=q=>q?(q&1?"  ":"##")+f(q>>1):"")('0x'+x^65535)).repeat(n)).join`
`
```
The first of these is 153 bytes, so none of them come anywhere near 136...
[Answer]
## MS-DOS .COM file, 84 bytes
OK. Just for fun because I cannot beat the 50 bytes...
Tried under DOSbox as well as under MS-DOS 6.22 in a virtual machine.
Under DOSbox the program works fine however under real MS-DOS the output will not be displayed correctly because DOS requires CR-LF instead of LF at the end of the line.
(However the output is correct.)
A 88 byte variant would use CR-LF at the end of the line.
Here is the file:
```
0000  be 32 01 fc ad 89 c3 8a  36 82 00 80 ee 30 b9 10
0010  00 d1 c3 18 d2 80 ca 20  80 e2 23 b4 02 cd 21 cd
0020  21 e2 ee fe ce 75 e7 b2  0a cd 21 ad 85 c0 75 d5
0030  cd 20 00 0c 00 52 00 01  80 90 e0 23 e0 03 f8 0f
0040  fc 1f fc 1f fe 3f de 3f  dc 1f bc 1f f8 0f f0 07
0050  c0 01 00 00
```
The assembler code (in AT&T syntax) looks like this:
```
start:
      # Read data from "image:"
    mov $image,%si
    cld
      # Read the first 16 bytes
    lodsw
nextLine:
      # Use bx as shift register
    mov %ax, %bx
      # Read the number of bombs
    mov 0x82,%dh
    sub $'0',%dh
nextBombInThisLine:
      # Number of characters
    mov $16, %cx
nextCharacter:
      # Rotate the data# get the next bit to CY
    rol $1, %bx
      # This results in 0x23 ('#') if CY is set, to 0x20 (' ') otherwise
    sbb %dl, %dl
    or $0x20, %dl
    and $0x23, %dl
      # Print result character twice
    mov $2, %ah
    int $0x21
    int $0x21
      # more Characters in this line?
    loop nextCharacter
      # More bombs to draw?
    dec %dh
    jnz nextBombInThisLine
      # Print a newline
#        mov $13, %dl # <- Additional 4 bytes needed for "\r\n"
#        int $0x21    #    at the end of the line!
    mov $10, %dl
    int $0x21
      # Read the next 16 bytes# 0x0000 means: EOF
    lodsw
    test %ax,%ax
    jnz nextLine
      # End of program
    int $0x20
image:
    # Here 34 bytes follow:
    # 16 16-bit-words "bitmap" for the bombs followed
    # by 0x0000 indicating the end of the bitmap
```
--- Edit ---
I forgot to mention: The program must be started with the following command line:
Name of the COM file + **exactly one** space character + Number of bombs (1-9)
[Answer]
# Python, ~~223~~ 179 bytes
### Second approach:
```
f=lambda n:'\n'.join(''.join(2*' #'[int(d)]for d in bin(int('0c0052000100908023e003e00ff81ffc1ffc3ffe3fde1fdc1fbc0ff807f001c0'[i:i+4],16))[2:].zfill(16))*n for i in range(0,64,4))
```
[Try it on repl.it!](https://repl.it/Dn1M)
Rather than creating a list of strings on-the-fly, there is a hard-coded hexadecimal string which is indexed and converted to binary; then each binary digit is turned into either `' '` or `'#'`, which is duplicated and joined together ... etc.
### First approach:
```
s='  ';b='##';f=lambda n:'\n'.join(n*l.ljust(32)for l in[s*4+b*2,(s+b)*2+s*2+b,s*7+b,b+s*2+b+s*4+b,s*2+b+s*3+b*5,s*6+b*5,s*4+b*9,s*3+b*11,s*3+b*11,s*2+b*13,s*2+b*8+s+b*4,s*3+b*7+s+b*3,s*3+b*6+s+b*4,s*4+b*9,s*5+b*7,s*7+b*3])
```
[Try it on repl.it!](https://repl.it/DnYi/2)
This contains a hard-coded list of the strings of each line (not including trailing spaces) created by duplicating either `' '` or `'##'` a number of times. For each of these strings, they are padded with spaces until 32 characters in length, duplicated `n` times, then joined with newlines.
[Answer]
# C, ~~250~~ ~~240~~ ~~208~~ 188 bytes
```
d[]={3072,20992,256,36992,9184,992,4088,8188,8188,16382,16350,8156,8124,4088,2032,448,0},m,c,*i=d;f(k){for(;*i;i++,puts(""))for(c=k;c--;)for(m=32768;m;write(1,&"##  "[m&*i?0:2],2),m>>=1);}
```
Switch to using a function.
```
m,d[]={3072,20992,256,36992,9184,992,4088,8188,8188,16382,16350,8156,8124,4088,2032,448,0},*i=d;main(c,v)char**v;{for(;*i;puts(""),i++)for(c=atoi(v[1]);c--;)for(m=32768;m;write(1,&"##  "[m&*i?0:2],2),m>>=1);}
```
Test like this.
`main(c,v)char**v;
{
 f(atoi(v[1]));
}`
```
a.exe 2
        ####                            ####
  ##  ##    ##                    ##  ##    ##
              ##                              ##
##    ##        ##              ##    ##        ##
    ##      ##########              ##      ##########
            ##########                      ##########
        ##################              ##################
      ######################          ######################
      ######################          ######################
    ##########################      ##########################
    ################  ########      ################  ########
      ##############  ######          ##############  ######
      ############  ########          ############  ########
        ##################              ##################
          ##############                  ##############
              ######                          ######
```
[Answer]
# [///](https://esolangs.org/wiki////), ~~539~~ 532 + no. of bombs bytes
The first /// answer, displaying 4 bombs. The end four 1's can be replaced with any unary representation of the number of bombs you want to print (11 for 2, 111 for 3)
```
/-/?|X//y/\/X//xy|//|/\/\///+/%@!|$/bcd|%/efg|@/hij|!/klm|?/nop|b/Bxc/Cxd/Dxe/Exf/Fxg/Gxh/Hxi/Ixj/Jxk/Kxl/Lxm/Mxn/Nxo/Oxp/Pxq/ss|r/tt|s/SS|t/TT|S/  |T/##|1/AX$+-$+?AXyAX$+-cd+?by$+-d+?cycd+-+?dyd+-fg@!?ey+-g@!?fyfg@!-@!?gyg@!-ij!?hy@!-j!?iyij!-!?jyj!-lm?ky!-m?lylm-?mym-opny-poyop|AXA/AA|bB/BB|cC/CC|dD/DD|eE/EE|fF/FF|gG/GG|hH/HH|iI/II|jJ/JJ|kK/KK|lL/LL|mM/MM|nN/NN|oO/OO|pP/PP|A/qtqqs|B/STSTsTqqS|C/qsSTqq|D/TsTqTqsS|E/sTsSrTqS|F/qsrTqS|G/qrrTsS|H/sSrrtTs|I/sSrrtTs|J/srrrTS|K/srrSrS|L/sSrtTStTs|M/sSrtSrs|N/qrrTsS|O/qSrtTq|P/qsStTqs|X/
/1111
```
[Try it online!](http://slashes.tryitonline.net/#code=Ly0vP3xYLy95L1wvWC8veHl8Ly98L1wvXC8vL14vdFR8Ji9ycnwqL3NTfCsvJUAhfCQvYmNkfCUvZWZnfEAvaGlqfCEva2xtfD8vbm9wfGIvQnhjL0N4ZC9EeGUvRXhmL0Z4Zy9HeGgvSHhpL0l4ai9KeGsvS3hsL0x4bS9NeG4vTnhvL094cC9QeHEvc3N8ci90dHxzL1NTfHQvVFR8Uy8gIHxULyMjfDEvQVgkKy0kKz9BWHlBWCQrLWNkKz9ieSQrLWQrP2N5Y2QrLSs_ZHlkKy1mZ0AhP2V5Ky1nQCE_ZnlmZ0AhLUAhP2d5Z0AhLWlqIT9oeUAhLWohP2l5aWohLSE_anlqIS1sbT9reSEtbT9seWxtLT9teW0tb3BueS1wb3lvcHxBWEEvQUF8YkIvQkJ8Y0MvQ0N8ZEQvRER8ZUUvRUV8ZkYvRkZ8Z0cvR0d8aEgvSEh8aUkvSUl8akovSkp8a0svS0t8bEwvTEx8bU0vTU18bk4vTk58b08vT098cFAvUFB8QS9xdHFxc3xCL1NUU1RzVHFxU3xDL3EqVHFxfEQvVHNUcVRxKnxFL3NUKnJUcVN8Ri9xc3JUcVN8Ry9xJlQqfEgvKiZec3xJLyomXnN8Si9zJnJUU3xLL3MmU3JTfEwvKnJeU15zfE0vKnJ0U3JzfE4vcSZUKnxPL3FTcl5xfFAvcSpecXN8WC8KLzExMTE&input=)
If the input must be decimal, the following has ~~555~~ 548 bytes (where the last digit can be changed to 1, 2, 3 or 4):
```
/-/?|X//y/\/X//xy|//|/\/\///4/13|3/12|2/11|^/tT|&/rr|*/sS|+/%@!|$/bcd|%/efg|@/hij|!/klm|?/nop|b/Bxc/Cxd/Dxe/Exf/Fxg/Gxh/Hxi/Ixj/Jxk/Kxl/Lxm/Mxn/Nxo/Oxp/Pxq/ss|r/tt|s/SS|t/TT|S/  |T/##|1/AX$+-$+?AXyAX$+-cd+?by$+-d+?cycd+-+?dyd+-fg@!?ey+-g@!?fyfg@!-@!?gyg@!-ij!?hy@!-j!?iyij!-!?jyj!-lm?ky!-m?lylm-?mym-opny-poyop|AXA/AA|bB/BB|cC/CC|dD/DD|eE/EE|fF/FF|gG/GG|hH/HH|iI/II|jJ/JJ|kK/KK|lL/LL|mM/MM|nN/NN|oO/OO|pP/PP|A/qtqqs|B/STSTsTqqS|C/q*Tqq|D/TsTqTq*|E/sT*rTqS|F/qsrTqS|G/q&T*|H/*&^s|I/*&^s|J/s&rTS|K/s&SrS|L/*r^S^s|M/*rtSrs|N/q&T*|O/qSr^q|P/q*^qs|X/
/4
```
[Try it online!](http://slashes.tryitonline.net/#code=Ly0vP3xYLy95L1wvWC8veHl8Ly98L1wvXC8vLzQvMTN8My8xMnwyLzExfF4vdFR8Ji9ycnwqL3NTfCsvJUAhfCQvYmNkfCUvZWZnfEAvaGlqfCEva2xtfD8vbm9wfGIvQnhjL0N4ZC9EeGUvRXhmL0Z4Zy9HeGgvSHhpL0l4ai9KeGsvS3hsL0x4bS9NeG4vTnhvL094cC9QeHEvc3N8ci90dHxzL1NTfHQvVFR8Uy8gIHxULyMjfDEvQVgkKy0kKz9BWHlBWCQrLWNkKz9ieSQrLWQrP2N5Y2QrLSs_ZHlkKy1mZ0AhP2V5Ky1nQCE_ZnlmZ0AhLUAhP2d5Z0AhLWlqIT9oeUAhLWohP2l5aWohLSE_anlqIS1sbT9reSEtbT9seWxtLT9teW0tb3BueS1wb3lvcHxBWEEvQUF8YkIvQkJ8Y0MvQ0N8ZEQvRER8ZUUvRUV8ZkYvRkZ8Z0cvR0d8aEgvSEh8aUkvSUl8akovSkp8a0svS0t8bEwvTEx8bU0vTU18bk4vTk58b08vT098cFAvUFB8QS9xdHFxc3xCL1NUU1RzVHFxU3xDL3EqVHFxfEQvVHNUcVRxKnxFL3NUKnJUcVN8Ri9xc3JUcVN8Ry9xJlQqfEgvKiZec3xJLyomXnN8Si9zJnJUU3xLL3MmU3JTfEwvKnJeU15zfE0vKnJ0U3JzfE4vcSZUKnxPL3FTcl5xfFAvcSpecXN8WC8KLzQ&input=)
The most important parts of the code are that:
| means //
ABCDEFGHIJKLMNOP mean each line of the bomb respectively
S means 2 spaces
s means 4 spaces
\* means 6 spaces
q means 8 spaces
T means ## (2)
t means #### (4)
^ means ###### (6)
r means ######## (8)
& means ################ (16)
Most of the code is making sure that the bombs are printed side-by-side, not on top of each other.
[Answer]
# [CJam](http://sourceforge.net/projects/cjam/), 66 bytes
```
"^a1{9\b aZ5w7qQAwndIUffO"136b2b1Ser0'#erG/ri*z{:_N}%
```
[Try it online!](http://cjam.tryitonline.net/#code=IgFeBB9hMXsLOVweGmIEIGFaNXc3fw9xUUF3bmQQSVUTBRhmZk8iMTM2YjJiMVNlcjAnI2VyRy9yaSp6ezpfTn0l&input=Mg) *(note that there are some unprintable characters in the code.)*
---
The bomb in encoded in as a number in binary using 1 for spaces (the leading space as 1 ensures we don't have to pad the binary representations), transposed, and then converted to string in base-136 (which produced the shortest string without wide-characters). These steps can be played with [here](http://cjam.tryitonline.net/#code=IgouLi4uIyMuLi4uLi4uLi4uCi4jLiMuLiMuLi4uLi4uLi4KLi4uLi4uLiMuLi4uLi4uLgojLi4jLi4uLiMuLi4uLi4uCi4uIy4uLiMjIyMjLi4uLi4KLi4uLi4uIyMjIyMuLi4uLgouLi4uIyMjIyMjIyMjLi4uCi4uLiMjIyMjIyMjIyMjLi4KLi4uIyMjIyMjIyMjIyMuLgouLiMjIyMjIyMjIyMjIyMuCi4uIyMjIyMjIyMuIyMjIy4KLi4uIyMjIyMjIy4jIyMuLgouLi4jIyMjIyMuIyMjIy4uCi4uLi4jIyMjIyMjIyMuLi4KLi4uLi4jIyMjIyMjLi4uLgouLi4uLi4uIyMjLi4uLi4uCiIgICAgICAgICAgICAgICAgIGUjIFRIRSBCT01CIQoiLiMiIjEwImVyTiUgICAgICBlIyBlbmNvZGUgdG8gYmluYXJ5IGxpbmVzCnogICAgICAgICAgICAgICAgIGUjIHRyYW5zcG9zZSAoc2F2ZXMgYSBieXRlIHRvLCBidXQgY291bGQgYmUgaW4gY29kZSkKZV97JzAtfSUyYiAgICAgICAgZSMgY29udmVydCBib21iIHRvIG51bWJlcgoxMzZiOmNlX2VkTm8gICAgICBlIyBlbmNvZGluZyAoc3RhY2sgZGlzcGxheSkKICAgICAgICAgICAgICAgICAgZSMgQUNUVUFMIENPREUgQkVMT1cgSEVSRQoxMzZiMmIwJyNlcjFTZXJHLyBlIyBkZWNvZGUgdmlhIGJpbmFyeQpyaSp6ezpfTn0lICAgICAgICBlIyBjb21iaW5lIHZpYSB0cmFuc3Bvc2U&input=Mg&debug=on).
This answer then reverses the encoding, the main trick being to repeat the bomb before transposing, effectively concatenating each line of the bomb at once. The characters in each line can be then be doubled up with newlines inserted for the final output.
[Answer]
# PHP, ~~138~~ 104+32=136 bytes
I had never thought that `file` was binary safe. I only wish I would have found a more interesting way to store the data; but nothing I tried beat raw binary.
```
foreach(unpack("v*",file(b)[0])as$v)echo"
",str_repeat(strtr(sprintf("%016b",$v),["  ","##"]),$argv[1]);
```
* read binary data from file, unpack from little endian 16bit to array of int
* loop through array: print 16 digit binary to string,
replace `0` with 2 spaces, `1` with `##`,
repeat `$argv[1]` times, print result + newline
run with `-r`
---
binary data in file `b`:
```
0000000 0c00 5200 0100 9080 23e0 03e0 0ff8 1ffc
0000010 1ffc 3ffe 3fde 1fdc 1fbc 0ff8 07f0 01c0
```
code to generate the file:
```
$f=fopen(b,wb);foreach(array_map(bindec,explode("
",
"0000110000000000
0101001000000000
0000000100000000
1001000010000000
0010001111100000
0000001111100000
0000111111111000
0001111111111100
0001111111111100
0011111111111110
0011111111011110
0001111111011100
0001111110111100
0000111111111000
0000011111110000
0000000111000000"))as$c)fputs($f,pack("v*",$c));fclose($f);
```
[Answer]
# [MATL](http://github.com/lmendo/MATL), ~~64~~ ~~63~~ ~~60~~ ~~59~~ 58 bytes
```
49:',cxJr(v9hW&waHB`U=NL%)C9[$aoAN'F16ZaQEY"32e!' #'w)liX"
```
[**Try it online!**](http://matl.tryitonline.net/#code=NDk6JyxjeEpyKHY5aFcmd2FIQmBVPU5MJSlDOVskYW9BTidGMTZaYVFFWSIzMmUhJyAjJ3cpbGlYIg&input=Mw)
### Explanation
The code uses a pre-compressed version of the 16×16 binary matrix. The pre-compressing (not part of the program) used two steps:
1. Run-length encoding of the matrix read in row-major order (first across, then down).
2. The resulting run-lengths range from 1 to 16, so the vector of run-lengths minus 1 was converted from base 16 to base 94 (to use all printable ASCII codes except single quote, which is not used because it would need escaping).
The compressed string,
```
   ',cxJr(v9hW&waHB`U=NL%)C9[$aoAN'
```
is decompressed from base 94 to base 16:
```
                                   F16Za
```
The obtained vector of run-lenghts plus 1 is multipled by 2:
```
                                        QE
```
to perform the horizontal stretching.
The vector of run-lenghts contains 49 values. The original numbers to be repeated with those lengths should be `[0 1 0 1 ... 0]` (49 entries). But instead of that, it's shorter to use the vector `[1 2 ... 49]`, which will be equally valid thanks to modular indexing. So the run-length decoding is
```
49:                                       Y"
```
The generated vector containis the runs of `1`, `2`, ...`49`, for a total of 512 entries. This is reshaped into a 16×32 matrix:
```
                                            32e!
```
and used as modular indices into the string `' #'` to produce a single bomb:
```
                                                ' #'w)
```
Finally, horizontal repetition by a factor given by the input produces the desired result:
```
                                                      liX"
```
[Answer]
# Python 2: 143 bytes
```
n=input()
j=2
while j<258:print''.join(2*'# '[b>'0']for b in bin(int('62XI2JG3U2Q0COCDFCZAMC8A9LAP6W1ZMM4A59GC43M49ENF3Z',36))[j:j+16])*n;j+=16
```
It's at **[ideone](http://ideone.com/d9IYc7)**
(I realised that direct encoding of the original bomb in base 36 made for shorter code in Python.)
The string was formed by treating spaces as 1s and hashes as 0s, and then converting to base 36. The program then converts back to binary and slices into lengths of 16 (with an offset of 2 for the '0b' at the front of Python's binary string) , converts to double spaces and double hashes, joins them up, repeats the string `n` times and prints.
---
**Previous: Python 2, ~~169 166~~ 163 bytes**
```
n=input()
j=0
while j<512:print''.join(' #'[i%2]*2*(v+1)for i,v in enumerate(int(c,16)for c in'31A00010F07010308024A4885A4A3C2703360245035876A25'))[j:j+32]*n;j+=32
```
It's at **[ideone](http://ideone.com/ZodxuL)**
Almost a port of [my Jelly answer](https://codegolf.stackexchange.com/a/95309/53748).
[Answer]
# Python 2.7, ~~144~~ 141 bytes
```
x=input()
for i in range(16):print"".join(" #"[b<"1"]*2for b in bin(int("5ZCAZKAVTP6J04W4VZJ2BQDH5DASIKRS524V8SWRSIVWZEWC8V",36))[2+i::16]*x)
```
The bomb is written in binary with 1 for space, the leading 1 removes the need to pad binary representations. The bomb is transposed (much like in [my CJam answer](https://codegolf.stackexchange.com/a/95297/46756)) and stored in base 36.
The program decodes the bomb to binary and iterates bits by a step of 16 effectively following the transposition (which is saves bytes over slicing a given line). The resultant line is concatenated, bits are replaced with doubled  or `#`, and joined into a singe string.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~216 204 183 165~~ 134 bytes
```
b(n,i){for(n*=16,i=--n*16;i--;i%n||puts(""))printf(L"àϸ\x7fc\xfde\xfee`\x1fff\xffe\xffe\x7fcǰᇰ䡀\x80⤀\x600"[i/n]&1<<i%n%16?"##":"  ");}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9JI08nU7M6Lb9II0/L1tBMJ9NWVzdPy9DMOlNX1zpTNa@mpqC0pFhDSUlTs6AoM68kTcNH6fCC8ztiKszTkmMq0lJSgURq6sP962MqDNPS0oC8tFQoAVRxfMPD9g1PFjbEVFgYPFoCpMwMDJSiM/XzYtUMbWyA5qsamtkrKSsrWSkpKChpWtf@B9qhkJuYmaehWZ2kYQQSAQA "C (gcc) – Try It Online")
Written as a standalone program (~~201 183~~ 151 bytes)
```
i=16;main(j,l)char**l;{for(;i--;puts(""))for(j=*l[1]*16-769;j--;printf(L"àϸ\x7fc\xfde\xfee`\x1fff\xffe\xffe\x7fcǰᇰ䡀\x80⤀\x600"[i]&1<<j%16?"##":"  "));}
```
[Try it online!](https://tio.run/##S9ZNT07@/z/T1tDMOjcxM08jSydHMzkjsUhLK8e6Oi2/SMM6U1fXuqC0pFhDSUlTEySSZauVE20Yq2VopmtuZmmdBZIvyswrSdPwUTq84PyOmArztOSYirSUVCCRmvpw//qYCsO0tDQgLy0VSgBVHN/wsH3Dk4UNMRUWBo@WACkzAwOl6MxYNUMbmyxVQzN7JWVlJSslBQWgtda1////NwIA "C (gcc) – Try It Online")
This segfaults if a command line parameter is not supplied.
[Answer]
## Batch, 415 bytes
```
@echo off
set h=#####
set s=
for %%a in ("    ##%s%%s%" " # #  #%s%    " "%s%  #%s%   " "#  #    #%s%  " "  #%h%%s%" "%s% %h%%s%" "    %h%####   " "   %h%%h%#  " "   %h%%h%#  " "  %h%%h%### " "  %h%### #### " "   %h%## ###  " "   %h%# ####  " "    %h%####   " "%s%%h%##    " "%s%  ###%s% ")do call:l %1 %%a
exit/b
:l
set r=
for /l %%i in (1,1,%1) do call set r=%%r%%%~2
set r=%r: =  %
echo %r:#=##%
```
Note: the line `set s=` ends in 5 spaces. Accepts the count as a command-line parameter. Simply loops through each line of the bomb (compressed very slightly by removing runs of 5 identical characters) then repeats the bomb as many times as desired before finally duplicating each character.
[Answer]
# Python 2, ~~206~~ ~~205~~ ~~203~~ ~~199~~ ~~191~~ ~~188~~ ~~186~~ ~~184~~ 160 bytes
```
z=input()
for y in 3072,20992,256,36992,9184,992,4088,8188,8188,16382,16350,8156,8124,4088,2032,448:print"".join(" #"[e>0]*2for e in map(int,bin(y+8**6)[5:]))*z
```
Looked at Hex for the number list but it didn't seem to save enough to make it worth the effort. Was hoping to be able to golf the code down but seem to have got as far as I can with this approach. Any additional hints gratefully received.
**EDIT**
-1 by changing `e==1` to `e>0`. I always forget that one.
-2 by ignoring the length of the binary string, prepending 7 0's and taking only the last 16 elements. Works as there are never more than 7 leading 0's.
-4 because now that I have lost the second reference to the variable b I can use `bin(y)[2:]` directly in the map function taking it below the magic 200 :-)
-8 by using slice assignment on the second list. Learned something new this evening.
-3 with thanks to @Jonathan
-2 by using `c=d=([0]*7+map(int,bin(y)[2:]))[-16:]` instead of having `c=d;`
-2 again thanks to @Jonathan
-24 with thanks to @Linus
**Output**
```
python bombs.py
2
        ####                            ####
  ##  ##    ##                    ##  ##    ##
              ##                              ##
##    ##        ##              ##    ##        ##
    ##      ##########              ##      ##########
            ##########                      ##########
        ##################              ##################
      ######################          ######################
      ######################          ######################
    ##########################      ##########################
    ################  ########      ################  ########
      ##############  ######          ##############  ######
      ############  ########          ############  ########
        ##################              ##################
          ##############                  ##############
              ######                          ######
```
[Answer]
# [RProgN](https://github.com/TehFlaminTaco/Reverse-Programmer-Notation), ~~210~~ 193 Bytes
Saved some bytes by switching 0=' ' 1='##' to 1=' ' 0=' ', this means i don't need to add the extra zeros back. Also, this means that now the B64 string that used to say "MAFIA" does not, This is sad.
```
'n' = => 64 -B 2 B ] 1 16 sub n rep \ 17 32 sub n rep '
' \ . . '1' '  ' replace '0' '##' replace } a'' = D4D/4/'' a DgQ/AH'' a DAIeAj'' a DgA8AB'' a DwB+AD'' a DcH/wf'' a D+/29/'' a Dz/63/'' a
```
## Explanation
```
'n' =                   # Associate the input with "n"
=>                      # Push a new function to the stack.
    64 -B               # Take the value from the top of the stack, convert it to an integer from Base64
    2 B                 # Take the value from the top of the stack, convert it from an integer to binary
    ]                   # Duplicate the top of the stack.
    1 16 sub            # Push the substring from the top of the stack between 1 and 16, 1 indexed.
    n                   # Push the input.
    rep                 # Repeat, this gives us 'n' bombs, essentially.
    \                   # Flip the values such that REPEATEDBOMB_ROW TEXT
    17 32 sub           # Push the substring between 17 and 32.
    n                   # Push the input
    rep                 # Repeat
    '                   # Push a new line
'                       # RProgN doesn't actually have escapes, so the raw newline is represented as a newline between qoutes.
    \ . .               # Flip the values so we have LINE1 NEWLINE LINE2, then concatenate them all into one string.
    '1' '  ' replace    # Replace all the 1's in the binary string with two spaces.
    '0' '##' replace    # Replace all the 1's with two '#'s
} a'' =                 # Associate the function with 'a'
D4D/4/'' a              # Bottom two lines,
DgQ/AH'' a              # Next two up,
DAIeAj'' a              # Etc...
DgA8AB'' a              # Once This is done, the memory stack is implicitly printed from top to bottom.
DwB+AD'' a              # As such, the bomb is upside down.
DcH/wf'' a              # Each of these numbers represents two lines, which is why we do the substringing to split it.
D+/29/'' a              # This works out saving a few bytes.
Dz/63/'' a              # Implicitly printed output. Yay.
```
Pretty long, The expanding, printing and such of the compressed string is 105 of the bytes.
Might be a bit more golfable, but atleast it works.
Input is implicitly on the stack, stack is implicitly printed.
## Output
```
        ####                            ####                            ####
  ##  ##    ##                    ##  ##    ##                    ##  ##    ##
              ##                              ##                              ##
##    ##        ##              ##    ##        ##              ##    ##        ##
    ##      ##########              ##      ##########              ##      ##########
            ##########                      ##########                      ##########
        ##################              ##################              ##################
      ######################          ######################          ######################
      ######################          ######################          ######################
    ##########################      ##########################      ##########################
    ################  ########      ################  ########      ################  ########
      ##############  ######          ##############  ######          ##############  ######
      ############  ########          ############  ########          ############  ########
        ##################              ##################              ##################
          ##############                  ##############                  ##############
              ######                          ######                          ######
```
## Try it!
```
<style>
  #frame{
    width:60em;
    height:60em;
    border:none;
  }
</style>
<iframe id='frame' src="https://tehflamintaco.github.io/Reverse-Programmer-Notation/RProgN.html?rpn=%27n%27%20%3D%20%3D%3E%2064%20-B%202%20B%20%5D%201%2016%20sub%20n%20rep%20%5C%2017%2032%20sub%20n%20rep%20%27%0A%27%20%5C%20.%20.%20%271%27%20%27%20%20%27%20replace%20%270%27%20%27%23%23%27%20replace%20%7D%20a%27%27%20%3D%20D4D%2F4%2F%27%27%20a%20DgQ%2FAH%27%27%20a%20DAIeAj%27%27%20a%20DgA8AB%27%27%20a%20DwB%2BAD%27%27%20a%20DcH%2Fwf%27%27%20a%20D%2B%2F29%2F%27%27%20a%20Dz%2F63%2F%27%27%20a&input=1">Sorry, You need to support IFrame. Why don't you..?</iframe>
```
[Answer]
# PHP, ~~144~~ ~~140~~ ~~139~~ ~~138~~ 136 bytes
Note: uses Windows-1252 encoding
```
for(;$j%=32*$argn or$r=intval(substr("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow",$i++*3,3),36)*print~õ;)echo~ßÜ[$r>>$j++/2%16&1];
```
Run like this:
```
echo 2 | php -nR 'for(;$j%=32*$argn or$r=intval(substr("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow",$i++*3,3),36)*print~õ;)echo~ßÜ[$r>>$j++/2%16&1];'
```
Or using IBM-850 encoding (135 bytes and prettier result):
```
echo 2 | php -nR 'for(;$j%=32*$argn or$r=intval(substr(~¤╬£¤══¤╠ö¤╚ø╬òÃ╬ò╦╔Ø╦£Æê£ÆêÅ×╦ÉùÉØèÿ£ÃÉ╔Ø╦╠╦ê¤Éê,$i++*3,3),36)*print~§;)echo~▀M[$r>>$j++/2%16&1];'
        ▓▓▓▓                            ▓▓▓▓
  ▓▓  ▓▓    ▓▓                    ▓▓  ▓▓    ▓▓
              ▓▓                              ▓▓
▓▓    ▓▓        ▓▓              ▓▓    ▓▓        ▓▓
    ▓▓      ▓▓▓▓▓▓▓▓▓▓              ▓▓      ▓▓▓▓▓▓▓▓▓▓
            ▓▓▓▓▓▓▓▓▓▓                      ▓▓▓▓▓▓▓▓▓▓
        ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓
      ▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓          ▓▓▓▓▓▓▓▓▓▓▓▓  ▓▓▓▓▓▓▓▓
        ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓              ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
          ▓▓▓▓▓▓▓▓▓▓▓▓▓▓                  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓
              ▓▓▓▓▓▓                          ▓▓▓▓▓▓
```
# Explanation
This doesn't do any binary stuff and doesn't require an external file.
Every 16 bit number is reversed, then encoded as a base-36 number, padded with a leading `0` if necessary, so every 16 bits result in 3 bytes. Concatenating those results in `01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow`. The code reverses the process so the bombs are printed correctly `N` times.
# Tweaks
* Saved 4 bytes by using only a single for-loop
* Saved a byte by printing a single char for each iteration and using string index instead of ternary
* Saved a byte by getting resetting `$j` to zero on line boundaries with `%=`. This gets rid of parentheses
* Saved 2 bytes by using `$argn`
[Answer]
# GCC C 129 bytes
### ISO8859/ASCII
```
f(r,i,d){
    for(;i<32;i+=2,puts(""))
        for(d=15*r;--d;)
             printf((*(int*)&("ÿóÿÿþoÜüðààÀ!ÀCÀCàðø?þ"[i]))&(1<<d%15)?"  ":"##");
}
```
In one line:
```
f(r,i,d){for(;i<32;i+=2,puts(""))for(d=15*r;--d;)printf((*(int*)&("ÿóÿÿþoÜüðààÀ!ÀCÀCàðø?þ"[i]))&(1<<d%15)?"  ":"##");}
```
Run with:
```
main(c,v)char**v;{f(atoi(v[1]),0)}
```
Compile source as ISO8859-x (ASCII).
NB óÿÿþÿoÜüðààÀÀ!ÀCàCðøþ? should contain the invisible ASCII Codes but it has been broken due to the way StackExchange presents its content.
Please see the ideaone link for proper test encoding
Alternatively the original ASCII String is at :
<https://github.com/claydonkey/AtariBombs/blob/master/ISO8859_REPR2.txt>
## Explanation
First a conversion of the hex representation of bombs
[f3 ff ad ff fe ff 6f 7f dc 1f fc 1f f0 07 e0 03 e0 03 c0 01 c0 21 c0 43 e0 43 f0 07 f8 0f fe 3f] to UTF-8 (in the UTF-8 version the compiler stores the string as Wide Char Array - 2 or 4 bytes for each character at runtime but this is academic). Whereas UTF-8 characters would be stored as 2-4 bytes, these values are all within ISO-8859-1 (ASCII) and thus only require 1 byte. Also it is safe to be stored as ISO-8859-x (there are no 0x8\_ or 0x9\_ values). Therefore the text consumes 32 bytes in ISO-8859 and the routine consumes 135 bytes in total.
(NB wide chars are stored as a 16 bit integer in windows and 32bit in linux but again this is irrelevant to the task at hand)
Caveat: Not all the characters are displayable (the control characters below 0x20) .They are, however still present . Most web pages are utf-8/ 8859/1253 (<https://w3techs.com/technologies/overview/character_encoding/all>) so I reckon this is legit~~(shifting all values below 0x20 to printable ASCII should fix that).~~
### UTF-8
Here is the version closer to the original posting with UTF-8 encoded source.
This consumes 173 bytes. The string itself being 50 bytes of the source.
The routine is also longer as the ASCII bytes are now stored with padding 0's for the 16bit/32bit Wide Chars and have to be shifted instead of casted to uint16\_t as above. I have kept this up as it can be verified with ideone which uses UTF-8 encoding.
```
*w=L"óÿÿþÿoÜüðààÀÀ!ÀCàCðøþ?";
f(r,i,j,m){
    for(i;i<32;i+=2,puts(""))
        for(j=r;j--;)
            for(m=65536;m>1;(m\=2,printf(((w[i]<<8)+w[i+1]&m)?"  ":"##")));}
```
Run with:
```
main(c,v)char**v;{f(atoi(v[1]),0)}
```
If you can set the implicit value to a 16bit integer in your complier you can omit the wchar\_t type declaration of the Wide Char. Ideone doesn't complain so I reckon it's good to go.
**Try it out** on [ideone](http://ideone.com/jcR3qG)
[Answer]
## Haskell, 155 bytes
As a function with type `Int -> String`:
```
b z=concat$do y<-[0..15];"\n":[if odd$div 0x3800FE01FF03DF83BF87BFC7FFC3FF83FF81FF007C007C401090080004A0030(2^(16*y+x))then"##"else"  "|x<-[1..z]>>[0..15]]
```
Printing to IO directly will cost 5 bytes (or 6 if we prefer to return `IO ()` rather than `IO [()]`):
```
b z=mapM putStr$do y<-[0..15];"\n":[if odd$div 0x3800FE01FF03DF83BF87BFC7FFC3FF83FF81FF007C007C401090080004A0030(2^(16*y+x))then"##"else"  "|x<-[1..z]>>[0..15]]
```
[Answer]
### C, 175 bytes
```
 x[]={48,74,128,265,1988,1984,8176,16376,16376,32764,31740,15352,15864,8176,4064,896};f(z,p){while(z++<16){p=1;while(p<<=1){printf("%s",p&(x[z]<<16|x[z])?"##":" ");}puts("");}}
```
concatenates each x to itself and makes p overflow to end each line.
[Answer]
## Java, 228 bytes
```
import static java.lang.System.out;
public class Bombs
{
    public static void main(String[] args)
    {
        new Bombs().d(2);
        new Bombs().d(3);
        new Bombs().d(4);
    }
    void d(int n){String s="";for(int x=16,r=0;r<16*n;x=16,s+=(++r%n==0?"\n":""))while(--x>=0)s+=((new int[]{1536,10496,128,18496,4592,496,2044,4094,4094,8191,8175,4078,4062,2044,1016,224}[r/n])&(1<<x))==0?"  ":"##";out.println(s);}
}
```
[Answer]
# J, 89 bytes
```
|:@;@#&(<' #'{~2#|:16 16$}.2#.inv 95#.32x-~3 u:'u,:C>%}UwPXHn_C9wF.|U ap<{jH%O9 9wRThGs')
```
Encodes the string as a base-95 number, increments each digit by `32`, then represents it by an ascii string.
## Explanation
This is composed of two main parts. There is the constructing of the bomb, and the actual repetition. Let's for the moment refer to the bomb as `b`. Then, the code looks like:
```
|:@;@#&(b)
```
When called with input `k`, this is equivalent to:
```
|: ; (k#b)
```
`b` is a boxed bomb, so `k#b` makes `k` repetitions of `b`, `;` flattens it vertically, and `|:` transposes the result. (The bomb `b` is itself constructed transposed.)
Now, here is the bomb:
```
<' #'{~2#|:16 16$}.2#.inv 95#.32x-~3 u:'u,:C>%}UwPXHn_C9wF.|U ap<{jH%O9 9wRThGs'
```
The string following is a base-95 encoded string with an offset of `32`, so that all the characters fall into the ASCII range, and thankfully there are no `'`s that need to be escaped. `3 u:` gets the char codes of the string, `32x-~` makes each number an e`x`tended number and subtracts `32` from it; `95#.` converts to a base-95 number an `2#.inv` converts it to a binary digit array. I added a leading `1` to the binary in order to make it a solid number, so I take it off with `}.`. I shape the array into a 16x16 table with `16 16$` then transpose it using `|:`. (Possible golf for later: transpose the literal encoded string.) `2#` duplicates each character width-wise. We are left with a table of `0`s and `1`s. `' #'{~` maps `0`s to `' '` and `1` to `'#'`. As thus, we are left with our bomb.
## Test case
```
   |:@;@#&(<' #'{~2#|:16 16$}.2#.inv 95#.32x-~3 u:'u,:C>%}UwPXHn_C9wF.|U ap<{jH%O9 9wRThGs') 3
        ####                            ####                            ####
  ##  ##    ##                    ##  ##    ##                    ##  ##    ##
              ##                              ##                              ##
##    ##        ##              ##    ##        ##              ##    ##        ##
    ##      ##########              ##      ##########              ##      ##########
            ##########                      ##########                      ##########
        ##################              ##################              ##################
      ######################          ######################          ######################
      ######################          ######################          ######################
    ##########################      ##########################      ##########################
    ################  ########      ################  ########      ################  ########
      ##############  ######          ##############  ######          ##############  ######
      ############  ########          ############  ########          ############  ########
        ##################              ##################              ##################
          ##############                  ##############                  ##############
              ######                          ######                          ######
```
[Answer]
# **[BaCon](http://www.basic-converter.org), ~~229~~ ~~227~~ 195 bytes**
A contribution in BASIC for sake of nostalgia. The variable 'a' determines the amount of bombs.
```
a=2:FOR x=0 TO 15:FOR y=1 TO a:FOR i=15 DOWNTO 0:?IIF$(v[x]&INT(POW(2,i)),"##","  ");:NEXT:NEXT:?:NEXT:LOCAL v[]={3072,20992,256,36992,9184,992,4088,8188,8188,16382,16350,8156,8124,4088,2032,448}
```
**Output**:
```
        ####                            ####
  ##  ##    ##                    ##  ##    ##
              ##                              ##
##    ##        ##              ##    ##        ##
    ##      ##########              ##      ##########
            ##########                      ##########
        ##################              ##################
      ######################          ######################
      ######################          ######################
    ##########################      ##########################
    ################  ########      ################  ########
      ##############  ######          ##############  ######
      ############  ########          ############  ########
        ##################              ##################
          ##############                  ##############
              ######                          ######
```
[Answer]
## Haskell, ~~191~~ 181 bytes
```
f n=h n:f(div n 2)
h n|odd n=' '
h _='#'
g b=mapM_ putStrLn[[f 0xfc7ff01fe00fc207c40784038003c007c007e00ff83ff83bfef6ff7fffb5ffcf!!(x`mod`32`div`2+y*16)|x<-[0..32*b-1]]|y<-[0..15]]
```
[Answer]
# C (Atari TOS 2.06 US), ~~129 124 117~~ 113 bytes
```
short*a=0xe013b0;main(j,l)char**l;{for(;*a++-224;puts(""))for(j=*l[1]*16-768;j--;printf(*a&1<<j%16?"##":"  "));}
```
This uses the bomb bitmap from the TOS ROM, which is slightly different from the one in the question. For other versions of TOS, you'll have to adjust the address pointed to by `*a`. Note that some emulator roms don't include the bomb bitmap!
If you don't provide a command line argument, several high resolution bitmapped bombs may be displayed :-)
[Answer]
# Excel VBA, 204 Bytes
Anonymous VBE Immediate window function that takes input from the range `[A1]` and outputs to the ActiveSheet Object
```
Cells.RowHeight=48:For i=0To[A1-1]:[A4,B2,C5,D4,D2,E1:F1,G2,H3,I4,G5:K6,E7:M7,D8:N9,C10:J11,K10:O10,O11,L11:N13,K13:K15,L14:L15,M14,D12:I13,J12,E14:G14,F15:G15,H14:J16].Offset(,16*i).Interior.Color=0:Next
```
### Output
[![Babomb](https://i.stack.imgur.com/tzY5M.png)](https://i.stack.imgur.com/tzY5M.png)
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal) `j`, 49 bytes
```
»ƛ¢y⇧↲⁽¹ŀuḂHŻḊ`I5□‡+vġ¯=<↓ d→YCnȧr»‛# τ16ẇƛ⁰*ƛd;ṅ
```
[Try it Online!](http://lyxal.pythonanywhere.com?flags=j&code=%C2%BB%C6%9B%C2%A2y%E2%87%A7%E2%86%B2%E2%81%BD%C2%B9%C5%80u%E1%B8%82H%C5%BB%E1%B8%8A%60I5%E2%96%A1%E2%80%A1%2Bv%C4%A1%C2%AF%3D%3C%E2%86%93%20d%E2%86%92YCn%C8%A7r%C2%BB%E2%80%9B%23%20%CF%8416%E1%BA%87%C6%9B%E2%81%B0*%C6%9Bd%3B%E1%B9%85&inputs=3&header=&footer=)
[Answer]
### C++11, 252 bytes
```
#include <iostream>
using namespace std;string d("01c02203k07d1j81j46b4cmwcmwpa4ohobugc8o6b434w0ow");int main(){for(int i=0;i!=45;i+=3){int z=stoi(d.substr(i,3),NULL,36);for(unsigned long p=1;p!=1<<31;p<<=1){cout<<(((z<<16|z)&p)?"##":"  ");}puts("");}}
```
[Answer]
# SmileBASIC, 127 bytes
```
INPUT N
FOR J=0TO 15FOR K=1TO N
FOR I=0TO 14?" #"[1AND ASC("xxxxxxxxxxxxxxx"[I])>>J]*2;
NEXT
NEXT?NEXT
```
[![screenshot](https://i.stack.imgur.com/OUfXA.jpg)](https://i.stack.imgur.com/OUfXA.jpg)
(Screenshot of version without doubled characters)
SB has a square font, so doubling the characters looks bad (and doesn't fit on the screen)
Non-ASCII characters have been replaced by `x`'s.
Hex values: `0008,0002,0610,1F8A,3FC1,7FC1,7FF2,FFF4,FFF8,EFF0,73F0,7FC0,3FC0,1F80,0600`
Since SB saves files in UTF-8, some of these count as 2 or 3 bytes.
]


[Question]
      [
PPCG user and elected mod, [@Dennis](https://codegolf.stackexchange.com/users/12012/dennis) just became the second ever user to earn over 100k rep!
[![enter image description here](https://i.stack.imgur.com/5ME5N.png)](https://i.stack.imgur.com/5ME5N.png)
This is a totally original idea, that I [did not get from anybody else](https://codegolf.stackexchange.com/questions/57719/generate-dennis-numbers), but let's make a challenge based off of his user ID, `12012` as a tribute!
Looking at it, you'll notice that there are two distinct "sections" to his ID.
>
> 12
>
>
>
and
>
> 012
>
>
>
Both of these sections add up to a 3. That's a pretty interesting property.
Let's define a "Dennis 2.0 number" as any positive integer where every maximal subsequence of strictly increasing digits sums to the same number. For example,
```
123
```
is a Dennis 2.0 number because there is only one maximal sublist of strictly increasing digits, and it sums to 6. Additionally, 2,846,145 is also a Dennis 2.0 number because the three maximal sublists of increasing digits, namely
```
28
46
145
```
All sum to `10`. Additionally, numbers that just repeat the same digit *must* be Dennis 2.0 numbers because, for example, `777` can be broken down into
```
7
7
7
```
which *clearly* all sum to seven.
A number such as `42` is *not* a Dennis 2.0 number, since it is broken down into
```
4
2
```
which clearly do not sum to the same number.
# The challenge
You must write a program or function to determine if a given number is a Dennis 2.0 number or not. You can take input and output in any reasonable input format, e.g. as a string, as a number, from a file, funtion arguments/return, from STDIN/STDOUT, etc. and then return a [truthy value](http://meta.codegolf.stackexchange.com/questions/2190/interpretation-of-truthy-falsey) if this number is a Dennis 2.0 number, and a falsy value if it is not. For reference, here is every Dennis 2.0 number up to 1,000:
```
1
2
3
4
5
6
7
8
9
11
12
13
14
15
16
17
18
19
22
23
24
25
26
27
28
29
33
34
35
36
37
38
39
44
45
46
47
48
49
55
56
57
58
59
66
67
68
69
77
78
79
88
89
99
101
111
123
124
125
126
127
128
129
134
135
136
137
138
139
145
146
147
148
149
156
157
158
159
167
168
169
178
179
189
202
222
234
235
236
237
238
239
245
246
247
248
249
256
257
258
259
267
268
269
278
279
289
303
312
333
345
346
347
348
349
356
357
358
359
367
368
369
378
379
389
404
413
444
456
457
458
459
467
468
469
478
479
489
505
514
523
555
567
568
569
578
579
589
606
615
624
666
678
679
689
707
716
725
734
777
789
808
817
826
835
888
909
918
927
936
945
999
```
Standard loopholes apply, and the shortest answer measured in bytes wins!

[Answer]
## JavaScript (ES6), ~~72~~ 70 bytes
Takes a string as input. Returns either false or a truthy value (which can be a number).
It's using a regular expression to transform an input string such as `"2846145"` into:
```
"(a=2+8)&&(a==4+6)&&(a==1+4+5)"
```
Then calls `eval()` on this expression.
```
let f =
n=>eval(n.replace(/./g,(v,i)=>(v>n[i-1]?'+':i?')&&(a==':'(a=')+v)+')')
console.log(f("101"));
console.log(f("102"));
console.log(f("777"));
console.log(f("2846145"));
```
[Answer]
# Jelly, ~~13~~ 12 bytes
*1 byte thanks to @Dennis.*
```
DI·π†‚Äô0;≈ì·πóDS‚Ç¨E
```
[Try it online!](http://jelly.tryitonline.net/#code=REnhuaDigJkwO8WT4bmXRFPigqxF&input=&args=Mjg0NjE0NQ)
### Explanation
```
DI·π†‚Äô0;≈ì·πóDS‚Ç¨E    Main link. Argument: N
D               Convert N to its digits.
 I              Find the differences between the elements.
  ·π†             Find the sign of each difference. This yields 1 for locations where the
                list is strictly increasing and 0 or -1 elsewhere.
   ‚Äô            Decrement. This yields 0 for locations where the list is strictly
                increasing and -1 or -2 elsewhere.
    0;          Prepend a 0.
        D       Get another list of digits.
      ≈ì·πó        Split the list of digits at truthy positions, i.e. the -1s and -2s.
         S‚Ç¨     Sum each sublist.
           E    Check if all values are equal.
```
[Answer]
# Python, 50 bytes
```
r='0'
for d in input():r=d+'=+'[r<d]*2+r
1/eval(r)
```
Expects `input()` to evaluate to a string, so the input needs surrounding quotes in Python 2. Output is via [exit code](https://codegolf.meta.stackexchange.com/a/5330/12012), where **0** indicates success (truthy) and **1** indicates failure (falsy).
Test it on [Ideone](http://ideone.com/pmwd1X).
### How it works
We initialize **r** to the string **0** and iterate over all digits **d** in the input.
* If **d** is larger than the first digit of **r** (initially **0**, then equal to the previous value of **d**), `r<d` evaluates to *True* and `'=+'[r<d]*2` yields `++`.
* If **d** is smaller than the first digit of **r**, `'=+'[r<d]*2` yields `==`.
* If **d** is equal to the first digit of **r**, **r** will be longer than the singleton string **d**, so `'=+'[r<d]*2` yields once again `==`.
In all cases, the digit **d** and the two generated characters get prepended to **r**.
Once all input digits have been processed, `eval(r)` evaluates the generated expression.
* If the input consists of a single strictly increasing sequence of (positive) digits, the expression evaluates to their sum.
For example, the integer **12345** results in the expression `5++4++3++2++1++0`, which yields **15** when evaluated. Note that each second **+** is a *unary* plus, so it doesn't affect the result. Dividing **1** by **15** is valid (the result is not important); the program exits normally.
* If the input consists of two strictly increasing sequences of digits, the expression consists of a simple comparison.
For example, the integer **12012** results in the expression `2++1++0==2++1++0`, which yields *True* when evaluated since both terms have sum **3**. Dividing **1** by *True* (**1**) is valid (the result is not important); the program exits normally.
On the other hand, the integer **12366** results in the expression `6==6++3++2++1++0`, which yields *False* when evaluated since the terms have sums **6** and **12**. Dividing **1** by *False* (**0**) raises a *ZeroDivisionError*; the program exits with an error.
* If the input consists of three or more strictly increasing sequences of digits, the expression consists of a [chained comparison](https://docs.python.org/3/reference/expressions.html#comparisons), which returns *True* if and only if all involved comparisons return *True*.
For example, the integer **94536** results in the expression `6++3==5++4==9++0`, which yields *True* when evaluated since all terms have sum **9**. As before, the program exits normally.
On the other hand, the integer **17263** results in the expression `3==6++2==7++1++0`, which yields *False* when evaluated since the terms have sums **3**, **8**, and **8**. As before, the program exits with an error.
[Answer]
# [Brachylog](http://github.com/JCumin/Brachylog), 13 bytes
```
~c@e:{<+}a!#=
```
[Try it online!](http://brachylog.tryitonline.net/#code=fmNAZTp7PCt9YSEjPQ&input=NTc1)
### Explanation
```
~c               Find a list of integers which when concatenated result in the Input
  @e             Split the integers into lists of digits
    :{<+}a       Each list of digit is stricly increasing, and compute its sum
          !      Discard all other choice points (prevents backtracking for smaller sublists)
           #=    All sums must be equal
```
`~c` will unify with the biggest sublists first.
[Answer]
## Pyke, 18 bytes
```
mb$1m>0R+fMbms}lt!
```
[Try it here!](http://pyke.catbus.co.uk/?code=mb%241m%3E0R%2BfMbms%7Dlt%21&input=%22835%22)
```
mb                 -         map(int, input)
  $                -        delta(^)
   1m>             -       map(^, 1>i)
      0R+          -      [0]+^
         f         -     input.split_at(^)
          Mb       -    deep_map(int, ^)
            ms     -   map(sum, ^)
              }    -  uniquify(^)
               lt! - len(^) == 1
```
[Answer]
## PowerShell v2+, ~~100~~ ~~64~~ 61 bytes
```
-join([char[]]$args[0]|%{("+$_","-eq$_")[$_-le$i];$i=$_})|iex
```
A literal one-liner, as this is all one pipeline. Takes input as a string `$args[0]`. Loops through it as a `char`-array, each iteration placing either the current element with a `+` or `-eq` in front of it onto the pipeline based on whether the current value is `-l`ess-than-or-`e`qual to the previous value `$i`. Those strings are `-join`ed together and piped to `iex` (short for `Invoke-Expression` and similar to `eval`. For example, for input `2846145` this will be evaluated as `+2+8-eq4+6-eq1+4+5`, which is `True`.
That Boolean is left on the pipeline, and `True`/`False` is implicitly written at program completion.
*NB - for single-digit input, the resulting digit is left on the pipeline, which is a truthy value in PowerShell.*
### Examples
```
PS C:\Tools\Scripts\golfing> 2846145,681,777,12366,2|%{"$_ -> "+(.\dennis-number-20.ps1 "$_")}
2846145 -> True
681 -> False
777 -> True
12366 -> False
2 -> 2
```
[Answer]
# GNU sed 217 or 115
Both include +1 for -r
**217:**
```
s/./&,/g;s/^/,/g;:;s,0,,;s,2,11,;s,3,21,;s,4,31,;s,5,41,;s,6,51,
s,7,61,;s,8,71,;s,9,81,;t;s/(,1*)(1*)\1,/\1\2X\1,/;t;s/,//g
s,1X1(1*),X\1a,;t;/^1.*X/c0
/Xa*$/s,a*$,,;y,a,1,;/1X1/b;/1X|X1/c0
c1
```
Takes input in normal decimal
[Try it online!](http://sed.tryitonline.net/#code=cy8uLyYsL2c7cy9eLywvZzs6O3MsMCwsO3MsMiwxMSw7cywzLDIxLDtzLDQsMzEsO3MsNSw0MSw7cyw2LDUxLApzLDcsNjEsO3MsOCw3MSw7cyw5LDgxLDt0O3MvKCwxKikoMSopXDEsL1wxXDJYXDEsLzt0O3MvLC8vZwpzLDFYMSgxKiksWFwxYSw7dDsvXjEuKlgvYzAKL1hhKiQvcyxhKiQsLDt5LGEsMSw7LzFYMS9iOy8xWHxYMS9jMApjMQ&input=MTIzCjI4NDYxNDUKNzc3CjQy&args=LXI)
---
**115:**
```
s/^|$/,/g;:;s/(,1*)(1*)\1,/\1\2X\1,/;t;s/,//g
s,1X1(1*),X\1a,;t;/^1.*X/c0
/Xa*$/s,a*$,,;y,a,1,;/1X1/b;/1X|X1/c0
c1
```
Takes input as a comma separated list of the numbers digits in unary. e.g. `123` would be `1,11,111`
[Try it online!](http://sed.tryitonline.net/#code=cy9efCQvLC9nOzo7cy8oLDEqKSgxKilcMSwvXDFcMlhcMSwvO3Q7cy8sLy9nCnMsMVgxKDEqKSxYXDFhLDt0Oy9eMS4qWC9jMAovWGEqJC9zLGEqJCwsO3ksYSwxLDsvMVgxL2I7LzFYfFgxL2MwCmMx&input=MSwxMSwxMTEKMTEsMTExMTExMTEsMTExMSwxMTExMTEsMSwxMTExLDExMTExCjExMTExMTEsMTExMTExMSwxMTExMTExCjExMTEsMTE&args=LXI)
[Answer]
## Perl, 38 + 3 (`-p`) = 41 bytes
*-9 bytes thanks to [@Ton Hospel](https://codegolf.stackexchange.com/users/51507/ton-hospel) !*
```
s%.%2x$&.(~$&le~$')%eg;$_=/^(2+1)\1*$/
```
Since there is a `$'`, the code needs to be in a file to run. So `-p` counts for 3 bytes. Outputs 1 if the number is a Dennis 2.0 number, or an empty string otherwise :
```
$ cat dennis_numbers.pl
s%.%2x$&.(~$&le~$')%eg;$_=/^(2+1)\1*$/
$ perl -p dennis_numbers.pl <<< "1
10
12315
12314"
```
[Answer]
# JavaScript (ES6), ~~66~~ ~~65~~ 63 bytes
*Saved 2 bytes thanks to @edc65*
```
x=>[...x,p=t=z=0].every(c=>p>=(t+=+p,p=c)?(z?z==t:z=t)+(t=0):1)
```
Takes input as a string. Old version (only works in Firefox 30+):
```
x=>[for(c of(p=t=0,x))if(p>=(t+=+p,p=c))t+(t=0)].every(q=>q==+p+t)
```
[Answer]
# Mathematica, 38 bytes
```
Equal@@Tr/@IntegerDigits@#~Split~Less&
```
Anonymous function. Takes a number as input, and returns `True` or `False` as output.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog) 2, 10 bytes, language postdates challenge
```
·∫π~c<‚ÇÅ·µê!+·µê=
```
[Try it online!](https://tio.run/nexus/brachylog2#@/9w1866ZJtHTY0Pt05Q1AYStv//G5mYmQEA "Brachylog ‚Äì TIO Nexus")
This is basically the same algorithm as @Fatalize's answer (which I didn't see until after I'd written this), but rearranged somewhat to make it golfier under Brachylog 2's syntax.
It's a full program, returning `false.` if it isn't a Dennis 2.0 number, or `true` if it is.
## Explanation
```
·∫π~c<‚ÇÅ·µê!+·µê=
·∫π           Interpret the input number as a list of digits
      !     Find the first (in default order)
 ~c           partition of the digits
   <‚ÇÅ·µê        such that each is in strictly increasing order
         =  Assert that the following are all equal:
       +·µê     the sums of each partition
```
As usual for a Brachylog full program, if all the assertions can be met simultaneously, we get a truthy return, otherwise falsey. The default order for `~c` is to sort partitions with fewer, longer elements first, and in Prolog (thus Brachylog), the default order's defined by the first predicate in the program (using the second as a tiebreak, and so on; here, `~c` dominates, because `·∫π` is deterministic and thus has nothing to order).
[Answer]
# MATL, ~~24~~ ~~23~~ ~~20~~ ~~18~~ 16 bytes
```
Tjdl<vYsG!UlXQ&=
```
Returns a [truthy of falsey](http://matl.tryitonline.net/#code=YAppdEQKPwonVFJVRSdECn0KJ0ZBTFNFJ0QKXVQKCg&input=WzEgMSAxOyAxIDEgMTsgMSAxIDFdClsxXQpbMSAwIDA7IDAgMSAwOyAwIDAgMV0KWzEgMSAxOyAxIDAgMTsgMSAxIDFd) matrix
[**Try it Online!**](http://matl.tryitonline.net/#code=VGpkbDx2WXNHIVVsWFEmPQ&input=Mjg0NjE0NQ)
Also, congrats @Dennis!
**Explanation**
```
T       % Push a literal TRUE to the stack
        %   STACK: {1}
j       % Explicitly grab the input as a string
        %   STACK: {1, '2846145'}
d       % Compute the difference between successive ASCII codes
        %   STACK: {1, [6 -4 2 -5 3 1]}
l<      % Find where that difference is less than 1
        %   STACK: {1, [0 1 0 1 0 0]}
v       % Prepend the TRUE value we pushed previously
        %   STACK: {[1 0 1 0 1 0 0]}
Ys      % Compute the cumulative sum. This assigns a unique integer label to
        % each set of increasing numbers
        %   STACK: {[1 1 2 2 3 3 3]}
G!U     % Grab the input as numeric digits
        %   STACK: {[1 1 2 2 3 3 3], [2 8 4 6 1 4 5]}
lXQ     % Compute the sum of each group of increasing digits
        %   STACK: {[10 10 10]}
&=      % Computes element-wise equality (automatically broadcasts). A
        % truthy value in MATL is a matrix of all ones which is only the case
        % when all elements are equal:
        %   STACK: {[1 1 1
        %            1 1 1
        %            1 1 1]}
        % Implicitly display the result
```
[Answer]
## PHP, ~~108~~ ~~105~~ 92 bytes
```
$p=-1;foreach(str_split("$argv[1].")as$d)$p>=$d?$r&&$s-$r?die(1):($r=$s)&$s=$p=$d:$s+=$p=$d;
```
takes input from argument, exits with `0` for Dennis-2.0 number, with `1` else.
**breakdown**
```
$p=-1;                              // init $p(revious digit) to -1
foreach(str_split("$argv[1].")as$d) // loop $d(igit) through input characters
                                    // (plus a dot, to catch the final sum)
    $p>=$d                              // if not ascending:
        ?$r                             // do we have a sum remembered
        &&$s-$r                         // and does it differ from the current sum?
                ?die(1)                     // then exit with failure
                :($r=$s)&$s=$p=$d           // remember sum, set sum to digit, remember digit
        :$s+=$p=$d                      // ascending: increase sum, remember digit
    ;
//
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 18 bytes
```
SD¬•X‚ÄπX¬∏¬´DgL*√™¬•¬£O√ôg
```
**Explanation**
`N = 12012` used as example.
```
                    # implicit input N = 12012
S                   # split input number to list of digits
                    # STACK: [1,2,0,1,2]
 D                  # duplicate
                    # STACK: [1,2,0,1,2], [1,2,0,1,2]
  ¬•                 # reduce by subtraction
                    # STACK: [1,2,0,1,2], [1,-2,1,1]
   X‚Äπ               # is less than 1
                    # STACK: [1,2,0,1,2], [0,1,0,0]
     X¬∏¬´            # append 1
                    # STACK: [1,2,0,1,2], [0,1,0,0,1]
        DgL*        # multiply by index (1-indexed)
                    # STACK: [1,2,0,1,2], [0,2,0,0,5]
            √™       # sorted unique
                    # STACK: [1,2,0,1,2], [0,2,5]
             ¬•      # reduce by subtraction
                    # STACK: [1,2,0,1,2], [2,3]
              ¬£     # split into chunks
                    # STACK: [[1,2],[0,1,2]]
               O    # sum each
                    # STACK: [3,3]
                √ô   # unique
                    # STACK: [3]
                 g  # length, 1 is true in 05AB1E
                    # STACK: 1
```
[Try it online!](http://05ab1e.tryitonline.net/#code=U0TCpVjigLlYwrjCq0RnTCrDqsKlwqNPw5ln&input=MjQ1MTI4MDI5)
[Answer]
# Ruby 2.3, 56 bytes
```
p !gets.chars.chunk_while(&:<).map{|a|eval a*?+}.uniq[1]
```
Almost certainly not the golfiest way to do this, but it shows off some nice language features.
(Not newline-tolerant, so run like `ruby dennis2.rb <<< '12012'`)
[Answer]
# PHP, 144 bytes
```
<?php preg_match_all("/0?1?2?3?4?5?6?7?8?9?/",$argv[1],$n);foreach($n[0]as$i)if(strlen($i)&&($a=array_sum(str_split($i)))!=$s=$s??$a)die;echo 1;
```
I'm sure there's a much cleverer (and shorter) way to do this but it will do for now.
[Answer]
## Python 2, 69 bytes
Takes input as a string.
```
lambda I:len(set(eval(reduce(lambda x,y:x+',+'[y>x[-1]]+y,I+' '))))<2
```
Explanation:
ex `1201212012`
Converts to list of sums:
`1+2,0+1+2,1+2,0+1+2,`
Evals and converts to set.
`set([3])`
If the length of the set is 1, all sums are the same.
[Answer]
# JavaScript (ES6), 58
```
s=>![...s,z=x=p=0].some(c=>[c>p?0:z-=(x=x||z),z-=p=c][0])
```
Applying my rarely useful tip <https://codegolf.stackexchange.com/a/49967/21348>
It scans the string char by char identifying run of ascending chars, at the end of each rum it checks if the sum is always the same
* c : current char
* p : previous char
* z : running sum, at the end of a run will be compared to ...
* x : sum to compare against, at first run is simply made equal to z
**Test**
```
f=
s=>![...s,z=x=p=0].some(c=>[c>p?0:z-=(x=x||z),z-=p=c][0])
function run()
{
  var i=I.value
  O.textContent = i + ' -> ' + f(i)
}
run()
test=`1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 22 23 24 25 26 27 28 29 33 34 35 36 37 38 39 44 45 46 47 48 49 55 56 57 58 59 66 67 68 69 77 78 79 88 89 99 101 111 123 124 125 126 127 128 129 134 135 136 137 138 139 145 146 147 148 149 156 157 158 159 167 168 169 178 179 189 202 222 234 235 236 237 238 239 245 246 247 248 249 256 257 258 259 267 268 269 278 279 289 303 312 333 345 346 347 348 349 356 357 358 359 367 368 369 378 379 389 404 413 444 456 457 458 459 467 468 469 478 479 489 505 514 523 555 567 568 569 578 579 589 606 615 624 666 678 679 689 707 716 725 734 777 789 808 817 826 835 888 909 918 927 936 945 999`.split` `
numerr=0
for(i=1; i<1000; i++)
{
  v = i + '';
  r = f(v);
  ok = r == (test.indexOf(v) >= 0)
  if (!ok) console.log('Error',++numerr, v)
}
if(!numerr) console.log('All test 1..999 ok')
```
```
<input id=I value=612324 type=number oninput='run()'>
<pre id=O>
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 20 bytes
Two versions
```
!t{sMcJjQThMx1<R0.+J
LS{b!t{sMhyI#I#./jQT
```
[Try the first one online!](http://pyth.herokuapp.com/?code=%21t%7BsMcJjQThMx1%3CR0.%2BJ&test_suite=1&test_suite_input=101%0A102%0A777%0A2846145&debug=0)
[Try the second one online!](http://pyth.herokuapp.com/?code=LS%7Bb%21t%7BsMhyI%23I%23.%2FjQT&test_suite=1&test_suite_input=101%0A102%0A777%0A2846145&debug=0)
[Answer]
# Ruby, ~~117~~ ~~105~~ 85 bytes
```
# original (117):
j,k=0,?0;"#{i}".chars.group_by{|n|n>k||j=j+1;k=n;j}.values.map{|a|a.map(&:to_i).reduce(&:+)}.reduce{|m,n|n==m ?m:nil}
# inspired by PHP regexp approach (105):
"#{i}".scan(/0?1?2?3?4?5?6?7?8?9?/).map{|a|a.chars.map(&:to_i).reduce(&:+)}.reduce{|m,n|!n||n==m ?m:nil}
# some number comparison simplification (85):
!"#{i}".scan(/0?1?2?3?4?5?6?7?8?9?/).map{|a|a.chars.map(&:to_i).reduce(&:+)}.uniq[1]
```
This would return the integer of this dennis number or `nil` if not a dennis number. All integers will be considered true in ruby as well `nil` is considered false. `i` is the integer that is being check.
Third version actually returns `true` and `false`.
P.S. tested to return 172 integers from 1 to 1000 as in the answer.
[Answer]
# APL, 23 bytes
```
{1=‚â¢‚à™+/‚ÜëN‚äÇ‚ç®1,2>/N‚Üê‚çé¬®‚çï‚çµ}
```
Explanation:
* `N‚Üê‚çé¬®‚çï‚çµ`: get the individual digits in the input, store in `N`
* `N‚äÇ‚ç®1,2>/N`: find the sublists of strictly increasing numbers in `N`
* `+/‚Üë`: sum each sublist
* `1=‚â¢‚à™`: see if the resulting list has only one unique element
[Answer]
# [Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), 109 bytes
```
D,g,@@#,BF1_B
D,k,@@#,bR$d@$!Q@BFB
D,f,@,BDdV√ë_‚Ç¨?1‚Ç¨_0b]$+‚Ç¨?dbLRBcB*BZB]GbL1+b]+qG‚Ç¨gd‚Ç¨bL√ë_0b]$+BcB]¬£k‚Ç¨¬¶+√ë=1$¬™=
```
[Try it online!](https://tio.run/##TY7fasIwGMWvm6fousDAhtHUP9sKupAVZSDIvPBiWDqzVKnOrGurFJw3ewOfYbCLsaeob7IXcV@KDG9OzvfL@XIykTJJDgefzAhj54R3aciRTxbVJIZYMnz2wHhXwylhhPtytN@Fvx8/txQkdESAbT1J0R/yZ17jjzzoiT61RWC/9eBmJkFEH5aqLGSC8nMBrPyy97s2xeV3G/qzPIXnkWFdWJLN1wj6lpNYEeYBlJvpFhl4A6HtUQGOsC6i4XvdvavNEcJ6oUPdeuvfOtQ9eve60aKN5kmodeqbV/UbhArPGis/UirOTPfSMdVqKaI0M1eJmb@a1HEcb6wsNCgQeomXce5phLqVh2/GSkaFF4N7SiMN8LRTMbD3msBpDCpy@AM "Add++ ‚Äì Try It Online")
## How it works
We define our 3 functions, \$f\$, \$g\$ and \$k\$. \$f\$ is the main function, which transforms the input to the correct output.
### \$f(x)\$
First, we convert the input \$x\$ into a list of digits, then take the forward increments. Next, we take the sign of each increment. For increasing subsequences, this yields a subsequence of \$1\$, for equal subsequences, such as \$[4, 4, 4]\$, this yields \$0\$s and for decreasing sections, \$-1\$ is returned. We then take the complement of each of these signs, to turn \$1\$ into a falsey value, and everything else into a truthy value. Next, \$0\$ is prepended to this array, and we take the sign of each element again. This yields an array, \$A\$, of \$0\$ and \$1\$, with the first element always being \$0\$.
We then yield the range \$[1, 2, ... length(A)]\$ and remove the elements that correspond to \$0\$ in \$A\$. This leaves us with a second array, \$A'\$. We then push the number of digits in the input, add one and append this number to \$A'\$. We then deduplicate \$A'\$, to yield a new array, \$A''\$.
Next, we use the \$g\$ helper function. As \$g\$ is dyadic (takes 2 arguments), it behaves slightly differently when paired with the *each* operator, `‚Ç¨`. Dyadic functions pop a value from the stack and bind that value as their right argument to create a partial monadic function. This partial function is then mapped over each element in the argument. Here, the bound right argument is the digits of the input and the partial function is mapped over \$A''\$.
### \$g(x, y)\$
Let's take a look at just one iteration of \$g(x, y)\$ where \$x := [1, 2, 0, 1, 2]\$ and \$y = 3\$. Note that \$3\$ is the first index in \$A''\$ where the signs from \$A\$ corresponded with \$1\$, rather than \$0\$. In fact, for \$x = 12012\$, we can see that \$A'' = [3, 6]\$. \$3\$ is the only non-zero index in \$A\$, and \$6\$ is the length of \$x\$ plus one.
So, for \$g([1, 2, 0, 1, 2], 3)\$ the following happens: First, we swap the two arguments so that the stack has the digits below the index. We then flatten the array and decrement the index. So far, the stack looks like `[1 2 0 1 2 2]`. We then perform the *head* command. We pop the index from the top f the stack and take that many characters from the stack, starting at the bottom. This yields \$[1, 2]\$, which is then returned by \$g\$.
So, \$g(x, y)\$ is mapped over each element \$y \in A''\$, which returns a series of prefixes of the input of various increasing lengths. This part could get slightly confusing, so we'll work through it with the example input of \$x := 12012\$. After the mapping of \$g\$, the stack currently looks like
```
[[[1 2] [1 2 0 1 2]]]
```
We then push an array containing the length of each array in the top element, or in this instance, the array \$[2, 5]\$. This is the same as \$A'' - 1\$, if the \$-\$ operator maps, but it takes more bytes to use this relationship. Next, the forward differences of the lengths is taken, and \$0\$ is prepended, yielding, in this example, \$[0, 3]\$. This new array is then zipped with the results from \$g\$ to create \$B\$ and the *starmap* operator is run over each pair.
### \$k(x, n)\$
The *starmap* operator uses the function \$k\$ as its argument, and works by taking a dyadic function and a nested array. The array must consist of pairs, such as \$[[1, 2], [3, 4], [5, 6]]\$, and the dyadic function is mapped over each pair, with each element of the pairs being the left and right arguments respectively.
Here, our example nested array is \$[[[1, 2], 0], [[1, 2, 0, 1, 2], 3]]\$ and our function is \$k\$. We'll focus simply on \$k([1, 2, 0, 1, 2], 3)\$ for now.
\$k(x, n)\$ starts, similar to \$g\$, by swapping the two arguments, so that the array is the top of the stack. We then reverse the array and swap the arguments back. Now, \$n = 0\$, we want to leave the array unchanged, so we duplicate the integer and rotate the top three arguments, so that the stack has the format of \$[n, x, n]\$. Next, we return the array if \$n = 0\$. Otherwise, the top element is discarded, and we arrange the stack back to how it was i.e. with the reversed array at the bottom and the integer at the top, or in our example: \$[[2, 1, 0, 1, 2], 3]\$. We then flatten the stack, and take the first \$n\$ elements of \$x\$. These elements are then returned and replace \$x\$ in \$B\$.
For our input, this returns \$[0, 1, 2]\$. (Strictly speaking, it returns\$[2, 1, 0]\$, but order doesn't matter for the rest of the program).
After \$k(x, n)\$ is mapped over each pair \$(x, n) \in B\$, we take the sum of each pair, then check that each element is equal, by asserting that each neighbouring pair are equal, and then asserting that each of those equality tests result in \$1\$ (a truthy value). Finally, this result is returned.
]