[Question]
  [
Write a program or function that takes in a positive integer. You can assume the input is valid and may take it as a string. If the number is any of
```
123
234
345
456
567
678
789
```
then output a [truthy](http://meta.codegolf.stackexchange.com/a/2194/26997) value. Otherwise, output a [falsy](http://meta.codegolf.stackexchange.com/a/2194/26997) value. For example, the inputs
```
1
2
3
12
122
124
132
321
457
777
890
900
1011
1230
1234
```
must all result in falsy output. (The input will not have leading zeroes so you needn't worry about things like `012`.)
**The shortest code in bytes wins.**
  
[Answer]
## Python, 24 bytes
```
range(123,790,111).count
```
An anonymous function that outputs 0 or 1. It creates the list `[123, 234, 345, 456, 567, 678, 789]` and counts how many times the input appears.
```
f=range(123,790,111).count
f(123)
=> 1
f(258)
=> 0
```
[Answer]
## Python, 24 bytes
```
lambda n:n%111==12<n<900
```
Just a lot of condition chaining.
[Answer]
## Haskell, 22 bytes
```
(`elem`[123,234..789])
```
An anonymous function. Generates the evenly-spaced list `[123, 234, 345, 456, 567, 678, 789]` and checks if the input is an element.
[Answer]
# Python 2, 25 bytes
```
lambda n:`n-12`==`n`[0]*3
```
Test it on [Ideone](http://ideone.com/dH6JE0).
[Answer]
# [Brachylog](http://github.com/JCumin/Brachylog), 9 bytes
```
h:2j:12+?
```
[Try it online!](http://brachylog.tryitonline.net/#code=aDoyajoxMis_&input=MTIz) or [Verify all test-cases.](http://brachylog.tryitonline.net/#code=Ons6MiYsInRydWUuIkB3OyJmYWxzZS4iQHd9YQpoOjJqOjEyKz8&input=WzEyMzoyMzQ6MzQ1OjQ1Njo1Njc6Njc4Ojc4OToxOjI6MzoxMjoxMjI6MTI0OjEzMjozMjE6NDU3Ojc3Nzo4OTA6OTAwOjEyMzA6MTIzNF0)
[Credits to Dennis for the algorithm](https://codegolf.stackexchange.com/a/91604/48934).
In English, "(prove that) the Input's first digit, concatenated to itself twice, add 12, is still the Input."
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak) 76 + 3 = 79 bytes
This answer is a golf of [this](https://codegolf.stackexchange.com/a/91609/56656) answer. I don't actually know quite how my answer works but DJMcMayhem gives a good explanation in his original answer and my answer is a modification of his.
```
([]<>)<>({}[({})]<>)<>(({}[({})()()()()()]<>{}{}<(())>)){{}{}(((<{}>)))}{}{}
```
It is run with the -a ascii flag adding 3 bytes.
## Explanation (of sorts)
Starting with the original working solution:
```
([]<>)<>({}[({})]<>)<>({}[({})]<>)({}{}[()()])({}<({}[()()()])>)(({}{}<(())>)){{}{}(((<{}>)))}{}{}
```
I run this through a simple golfing algorithm I wrote and get:
```
([]<>)<>({}[({})]<>)<>(({}[({})]<>{}[()()]<({}[()()()])>{}<(())>)){{}{}(((<{}>)))}{}{}
```
From here I see the section `<({}[()()()])>{}` this essentially multiplies by one which makes it equal to `{}[()()()]` reduce the whole code to:
```
([]<>)<>({}[({})]<>)<>(({}[({})]<>{}[()()]{}[()()()]<(())>)){{}{}(((<{}>)))}{}{}
```
Lastly negatives can be combined:
```
([]<>)<>({}[({})]<>)<>(({}[({})()()()()()]<>{}{}<(())>)){{}{}(((<{}>)))}{}{}
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/), 5 bytes
```
¥XX‚Q
```
**Explanation**
```
¥      # deltas
    Q  # are equal to
 XX‚   # [1,1]
```
[Try it online](http://05ab1e.tryitonline.net/#code=wqVYWOKAmlE&input=NDU2)
[Answer]
# Brainfuck, 32 bytes
```
+>,+>,>,-[-<-<->>],[<]<[<]<[<]<.
```
[Try it online!](http://brainfuck.tryitonline.net/#code=Kz4sKz4sPiwtWy08LTwtPj5dLFs8XTxbPF08WzxdPC4&input=MTIz)
[Credits to Lynn for the core of the algorithm.](https://codegolf.stackexchange.com/a/91617/48934)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
DI⁼1,1
```
[Try it online!](http://jelly.tryitonline.net/#code=REnigbwxLDE&input=&args=NDU2) or [verify all test cases](http://jelly.tryitonline.net/#code=REnigbwxLDEKMTAwMDBSw4fDkGY&input=).
### How it works
```
DI⁼1,1  Main link. Argument: n (integer)
D       Decimal; convert n to base 10.
 I      Increments; compute the differences of all pairs of adjacent digits.
   1,1  Yield [1, 1].
  ⁼     Test the results to both sides for equality.
```
[Answer]
# [MATL](http://github.com/lmendo/MATL), 8 bytes
```
d1=tn2=*
```
[Try it online!](http://matl.tryitonline.net/#code=ZDE9dG4yPSo&input=JzEyMyc)
This will print `1 1` for a truthy input, and an array with a `0` in it for a falsy value, since that is falsy in MATL.
Explanation:
```
d           % Calculate the difference between consecutive digits
 1=         % Push an array of which elements equal one
   t        % Duplicate this array
    n       % Push the length of this array
     2=     % Push a one if the length is 2, and a zero otherwise
            % Now, if we have a truthy input, the stack looks like:
            %   [1 1]
            %   1
            % And if we have a falsy input, the stack looks something like this:
            %   [1 0]
            %   1
            % Or this:
            %   [1 1]
            %   0
       *    % Multiply the top two elements
```
[Answer]
## Java 7, 46 bytes
```
boolean f(int a){return a>12&a<790&a%111==12;}
```
After trying several things with Leaky Nun in chat, this seems to be the shortest. Sometimes you just have to do things the straightforward way :/
Explanation:
```
boolean f(int a){
    return a>12         Is it more than 12? (stupid edge case)
           &
           a<790        Is it in range the other way? 
           &
           a%111==12;   Is it 12 more than a multiple of 111? 
}
```
[Answer]
# [Perl 6](http://perl6.org), ~~35 29 24 21~~ 19 bytes
```
~~{.chars==3&&'0123456789'.index: $\_}
{$\_ (elem) (123,\*+111...789)}
{$\_∈(123,\*+111...789)}
\*∈(123,\*+111...789)~~
*∈(123,234...789)
```
## Explanation:
```
# Whatever lambda ( the parameter is ｢*｣ )
*
∈ # is it an element of:
# this sequence
(
  123,
  234,
  # deduce rest of sequence
  ...
  # stop when you generate this value
  789
)
```
## Usage:
```
my &code = *∈(123,234...789);
say code 123; # True
say code 472; # False
say (  *∈(123,234...789)  )( 789 ); # True
```
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 26
```
.
$*: 
^(:+ ):\1::\1$
```
Outputs 1 for truthy and 0 for falsey.
[Try it online](http://retina.tryitonline.net/#code=JShHYAouCiQqOiAKXig6KyApOlwxOjpcMSQ&input=MTIzCjIzNAozNDUKNDU2CjU2Nwo2NzgKNzg5CjEKMgozCjEyCjEyMgoxMjQKMTMyCjMyMQo0NTcKNzc3Cjg5MAo5MDAKMTAxMQoxMjMwCjEyMzQ) (First line added to allow multiple testcases to be run).
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 99 bytes
```
([{}]({})<>)<>([{}]{}<>)(({})<([{}]{})((){[()](<{}>)}{})>)([{}]{})((){[()](<{}>)}{})<>{{{}}<>{}}<>
```
[Try it online!](https://tio.run/nexus/brain-flak#@68RXV0bq1Fdq2ljB0RgXnUtkK0BFoPygTzN6mgNzVgNm@paO81aoAhQBU45G7vq6upaoClg4v9/QyPj/7qJAA "Brain-Flak – TIO Nexus")
This is 98 bytes of code `+1` for the `-a` flag.
This prints `1` for truthy, and either `0` or nothing (which is equivalent to 0) for falsy
[Answer]
# Ruby `-nl`, ~~32~~ ~~30~~ 25 bytes
```
p"123456789"[$_]&.size==3
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcnm0km5ejlLsgqWlJWm6FjsLlAyNjE1MzcwtLJWiVeJj1fSKM6tSbW2NIfJQZQtuBgOVcQFVcgEVcwHVcwG1cAF1cQE1chlyGXEZcxkaAREIm3AZGgMFjAyBCs25zM3NuSwsDbgsDQy4DA0MDYEKjA1AhAnEbAA)
[Answer]
# [Brain-Flak](http://github.com/DJMcMayhem/Brain-Flak), 114 bytes
```
([((()()()){}){}]{})(((()()()){}())<>)<>{({}<(({}[(((((()()()){}()){}){}){}){}]())){(<{}>)<>({}[()])<>}{}>[()])}<>
```
[Try it online!](http://brain-flak.tryitonline.net/#code=KFsoKCgpKCkoKSl7fSl7fV17fSkoKCgoKSgpKCkpe30oKSk8Pik8Pnsoe308KCh7fVsoKCgoKCgpKCkoKSl7fSgpKXt9KXt9KXt9KXt9XSgpKSl7KDx7fT4pPD4oe31bKCldKTw-fXt9PlsoKV0pfTw-&input=MTIz)
Correct version (in the spirit of the question): takes the integer as input, output 0 for falsey and 1 for truthy.
This is **not** stack clean.
### Algorithm
Let the input be `n`.
The output is truthy iff `(n-123)(n-234)(n-345)(n-456)(n-567)(n-678)(n-789)=0`.
I computed those seven numbers by first subtracting 12 and then subtract 111 7 times, and then computed the logical double-NOT of those seven numbers and added them up.
For truthy results, the sum is 6; for falsey results, the sum is 7.
Then, I subtract the sum from 7 and output the answer.
[Answer]
# R, ~~30~~ 22 bytes
```
scan()%in%(12+1:7*111)
```
Not particularly exciting; check if input is in the sequence given by 12 + 111k, where k is each of 1 to 7. Note that `:` precedes `*` so the multiplication happens after the sequence is generated.
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~41 30~~ 23 bytes
First code-golf submission, be gentle :)
```
~~a=>{return a&gt12&&a&lt790?a%111==12:false;};~~
~~a=>a&gt12&&a&lt790?a%111==12:false~~
a=>a&gt12&a&lt790&a%111==12
```
[Try it online!](https://tio.run/##Dcq7CoQwEAXQfr9impUEXZixEUkm5Vbbbx2DgQuSgI/vj5YHTjo@6UD7XiV5lHNYat0CZW1RQwwydtFPM3fxLSKqMjb3ynU3TyUoO5AnYWZH6HuLbLKBtf8d5/pDWR@4dgM "C# (Visual C# Interactive Compiler) – Try It Online")
* -11 bytes thanks to Kirill L.
* Another -7 bytes thanks to ASCII-only.
[Answer]
# Brainfuck, 43 bytes
```
,>,>,>,[>>]<[[-<-<->>]<+[>>]<++[>>->]<+<]>.
```
Bah, I'm no good at this. Outputs `\x01` if the output is one of the strings `123`, `234`, …, `789`; outputs `\x00` otherwise.
(I beat Java 7, though…)
[Try it online!](http://brainfuck.tryitonline.net/#code=LD4sPiw-LFs-Pl08W1stPC08LT4-XTwrWz4-XTwrK1s-Pi0-XTwrPF0-Lg&input=MzQ1&debug=on)
[Answer]
# JavaScript ES6, 26 bytes
`n=>1>(n-12)%111&n>99&n<790`
This takes advantage of the fact that I'm using bit-wise logic operators on what are essentially booleans (which are bit-based!)
Thanks to Titus for saving 2.
[Answer]
# Excel - 62 57 35 31 bytes
Based on Anastasiya-Romanova's answer, but returning Excel's `TRUE/FALSE` values.
```
=AND(LEN(N)=3,MID(N,2,1)-MID(N,1,1)=1,MID(N,3,1)-MID(N,2,1)=1)
```
Further, we can get to
```
=AND(LEN(N)=3,MID(N,2,1)-LEFT(N)=1,RIGHT(N)-MID(N,2,1)=1)
```
since both `RIGHT` and `LEFT` return a single character by default.
And, inspired by some of the Python solutions:
```
=AND(LEN(N)=3,MOD(N,111)=12,N<>900)
```
Thanks to Neil for 4 more bytes...
```
=AND(N>99,MOD(N,111)=12,N<900)
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog) (2), 7 bytes
```
ẹ~⟦₂-_2
```
[Try it online!](https://tio.run/nexus/brachylog2#@/9w1866R/OXPWpq0o03@v/fxNQMAA "Brachylog – TIO Nexus")
## Explanation
```
ẹ~⟦₂-_2
ẹ        Split into digits
 ~⟦₂     Assert that this is an increasing range; take its endpoints
    -_2  Assert that the starting minus ending endpoint is -2
```
As a full program, we get a truthy return if all assertions hold, a falsey return if any fail.
[Answer]
# CJam, ~~13~~ 9 bytes
```
A,s3ewqe=
```
[Try it online!](https://tio.run/nexus/cjam#@@@oU2ycWl6Yavv/v6GRMQA)
**Explanation**
```
A,s        e# Push "0123456789".
   3ew     e# Split it into contiguous length-3 chunks: ["012" "123" "234" ... "789"].
      q    e# Push the input.
       e=  e# Count the number of times the input appears in the array.
```
[Answer]
# Regex (ECMAScript), 20 bytes
The input *n* is in unary, as the length of a string of `x`s.
```
^x{12}(x{111}){1,7}$
```
[Try it online!](https://tio.run/##TY/NTgIxFEZfBScG7gVmoEg0oRZXLti40KXRpIFL52rpNG35kWGefRwWJm6@zfmSk/OlDzquA/uUR88bCrvKfdNPG5SjY@@VzPPJA5zVcjJsP0@1mDXQrRAN1mL80Ny2w8kZi1S9pcDOABbR8prgfpzPEWVUU3ks2RKAVYH0xrIjQLxRbm8t1kbZInrLCQb5ACVvAZwyhSVnUonL2eXC8UW/ACuvQ6SVS2Depx@If4D@A7cUT2JxxZjKUB2zlTtoy5te0M7QopeNrNxWASQ/KpI8GmEnzE5ZEciTTsBY7HRalxAQ69jv@y4pwbVCSL9PMYXuIpumneZidjf/BQ "JavaScript (SpiderMonkey) – Try It Online")
This works by asserting that \$n-12\$ is of the form \$111k\$ where \$1\le k\le 7\$.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 4 bytes
```
¯k₁⁼
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiwq9r4oKB4oG8IiwiIiwiMTIzXG4yMzRcbjFcbjJcbjNcbjEyMzQiXQ==)
### Explained
```
¯k₁⁼
¯    # Deltas
 k₁  # [1,1]
   ⁼ # compare lists
```
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), 15 bytes
```
{($x-12)=3#*$x}
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs6rWUKnQNTTStDVW1lKpqOXiSos2NDKOBVImBgYgysjYBMwzNQNR5haWEB5YzhAkCQBJFhD+)
Port of [Dennis' algorithm](https://codegolf.stackexchange.com/a/91604/107017).
Explanation:
```
{($x-12)=3#*$x}  Main function. Takes x as input
            $x   Convert x to string
           *     Then get the first character
         3#      And duplicate it thrice
        =        Is it equal to
 ( x-12)         x - 12
  $              Converted to string?
```
[Answer]
# Excel - 104 bytes
```
=IF(LEN(N)<3,"Falsy",IF(AND(LEN(N)=3,MID(N,2,1)-MID(N,1,1)=1,MID(N,3,1)-MID(N,2,1)=1),"Truthy","Falsy"))
```
**Explanation:**
The syntax for the IF formula in Excel is:
```
IF( condition, [value_if_true], [value_if_false] )
```
If the length of input `N`, where it's a name of the reference cell, is less than 3, then it will return **Falsy**. Else, if the length of input `N` is 3 and both of the difference of second digit and first digit and the difference of third digit and second digit are equal to 1, then it will return **Truthy**.
[Answer]
# Pyth, 8 Bytes
```
qi>3SeQT
```
[Try online!](http://pyth.herokuapp.com/?code=qi%3E3SeQT&input=234&debug=0)
Explanation:
```
q       Q  Is the input equal to:
  <3S       The last three digits of the range from 1 to
     eQ      The last digit of the input    
 i     T      Concatenated together into an integer
```
[Answer]
# [Dyalog APL](http://goo.gl/9KrKoM), 10 [bytes](http://meta.codegolf.stackexchange.com/a/9429/43319)
Takes string argument.
```
1 1≡¯2-/⍎¨
```
`1 1≡` Is {1, 1} identical to
`¯2-/` the reversed pair-wise difference of
`⍎¨` each character taken as a number?
[TryAPL online!](http://tryapl.org/?a=e%u2190%7B%7B1%3D%u2374%u2375%3A%u236C%u2374%u2375%u22C4%u2375%7D%u2283%7B%u237A/%u2375%7D/%u2395VFI%20%u2375%7D%20%u22C4%20f%u21901%201%u2261%AF2-/e%A8%20%u22C4%20f%A8%2C%A8%27123%27%20%27234%27%20%27345%27%20%27456%27%20%27567%27%20%27678%27%20%27789%27%20%271%27%20%272%27%20%273%27%20%2712%27%20%27122%27%20%27124%27%20%27132%27%20%27321%27%20%27457%27%20%27777%27%20%27890%27%20%27900%27%20%271011%27%20%271230%27%20%271234%27&run) (`⍎` has been emulated with `e` for security reasons.)
[Answer]
# Perl, 18 bytes
Includes +1 for `-p`
Run with the input on STDIN
```
123.pl <<< 123
```
`123.pl`:
```
#!/usr/bin/perl -p
$_=$_=/./.2==$_-$&x3
```
]