[Question]
  [
## Challenge
A [repdigit](https://oeis.org/wiki/Repdigit_numbers) is a non-negative integer whose digits are all equal.
Create a function or complete program that takes a single integer as input and outputs a truthy value if the input number is a repdigit in base 10 and falsy value otherwise.
The input is guaranteed to be a *positive* integer.
You may take and use input as a string representation in base 10 with impunity.
## Test cases
These are all repdigits below 1000.
```
1
2
3
4
5
6
7
8
9
11
22
33
44
55
66
77
88
99
111
222
333
444
555
666
777
888
999
```
A larger list can be found [on OEIS](https://oeis.org/A010785).
## Winning
The shortest code in bytes wins. That is not to say that clever answers in verbose languages will not be welcome.
  
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 1 byte
```
=
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/3/b/f0NDQwA "Brachylog ‚Äì Try It Online")
This acts on integers.
From [`src/predicates.pl#L1151`](https://github.com/JCumin/Brachylog/blob/master/src/predicates.pl#L1151):
```
brachylog_equal('integer':0, 'integer':0, 'integer':0).
brachylog_equal('integer':0, 'integer':I, 'integer':I) :-
    H #\= 0,
    integer_value('integer':_:[H|T], I),
    brachylog_equal('integer':0, [H|T], [H|T]).
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~33~~ ~~30~~ 29 bytes
```
f(n){n=n%100%11?9/n:f(n/10);}
```
[Try it online!](https://tio.run/##S9ZNT07@/z9NI0@zOs82T9XQwEDV0NDeUj/PCiimb2igaV37PzcxM09Dk6uaizMtv0gjM69EIU/BVsHQGkjZKAB1GABZ2tqaXJycIHMU1NQUCoqAqtI0lFRLY/KUdBTyNK25av8DAA "C (gcc) ‚Äì Try It Online")
[Answer]
# [COBOL](https://en.wikipedia.org/wiki/COBOL), 139 BYTES
I feel like COBOL doesn't get any love in code golfing (probably because there is no way it could win) but here goes:
```
IF A = ALL '1' OR ALL '2' OR ALL '3' OR ALL '4' OR ALL '5' OR
ALL '6' OR ALL '7' OR ALL '8' OR ALL '9' DISPLAY "TRUE" ELSE   
DISPLAY "FALSE".
```
A is defined as a PIC 9(4). 
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 1 byte
```
√ã
```
Checks if all digits are equal
[Try it online!](https://tio.run/##MzBNTDJM/f//cPf//yYmJgA "05AB1E ‚Äì Try It Online")
[Answer]
# Python 3, 25, 24 19 bytes.
```
len({*input()})>1>t
```
A stdin => error code variant.
Returns error code 0 if it's a repdigit - or an error on failure.
Thanks to Dennis for helping me in the comments.
[Answer]
# [Haskell](https://www.haskell.org/), 15 bytes
```
all=<<(==).head
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P802MSfH1sZGw9ZWUy8jNTHlf25iZp6CrUJBUWZeiYKKQm5igUKaQrSSoZKOgpIhmDQ2NgZzjCBiRmAxICf2PwA "Haskell ‚Äì Try It Online") Takes string input.
Equivalent to `\s->all(==head s)s`. Narrowly beats out alternatives:
```
f s=all(==s!!0)s
f s=s==(s!!0<$s)
f(h:t)=all(==h)t
f(h:t)=(h<$t)==t
f s=(s<*s)==(s*>s)
f(h:t)=h:t==t++[h]
```
[Answer]
## Mathematica, 27 bytes
```
AtomQ@Log10[9#/#~Mod~10+1]&
```
It doesn't beat `Equal@@IntegerDigits@#&`, but it beats the other arithmetic-based Mathematica solution.
Repdigits are of the form **n = d (10m-1) / 9** where **m** is the number of digits and **d** is the repeated digit. We can recover **d** from **n** by taking it modulo 10 (because if it's a rep digit, it's last digit will be **d**). So we can just rearrange this as **m = log10(9 n / (n % 10) + 1)** and check whether **m** is an integer.
[Answer]
# [Slashalash](https://esolangs.org/wiki/Slashalash), 110 bytes
```
/11/1//22/2//33/3//44/4//55/5//66/6//77/7//88/8//99/9//1/.//2/.//3/.//4/.//5/.//6/.//7/.//8/.//9/.//T..///.//T
```
[Try it online!](https://tio.run/##HcuxDYAwDAXRjTglThxnDxagQKKgy/4y@TRP19x6r/XcK5NSKFArFcwwaI0GvdPBHYcxGBBBwJxM9nLsSZhoogsXQ4SY4jw2f2R@ "/// ‚Äì Try It Online")
The /// language doesn't have any concept of truthy and falsey, so this outputs "T" if the input is a repdigit, and does not output any characters if the input is not a repdigit.
[Answer]
## C (gcc), 41 bytes
```
f(char*s){s=!s[strspn(s,s+strlen(s)-1)];}
```
This is a function that takes input as a string and returns `1` if it is a repdigit and `0` otherwise.
It does this by making use of the `strspn` function, which takes two strings and returns the length of the longest prefix of the first string consisting of only characters from the second string. Here, the first string is the input, and the second string is the last digit of the input, obtained by passing a pointer to the last character of the input string.
Iff the input is a repdigit, then the result of the call to `strspn` will be `strlen(s)`. Then, indexing into `s` will return a null byte if this is the case (`str[strlen(str)]` is always `\0`) or the first digit that doesn't match the last digit otherwise. Negating this with `!` results in whether `s` represents a repdigit.
[Try it online!](https://tio.run/##TYzBDoIwEETvfMVKYrILJSkHT8iXqIdarTaBQrp4Inx7XQgmzmUmmTdjq5e1KTm0bxMLppnbA194ijwGZMWlxO4pkaqabs2SeuMDEswZiNYRFPePgxZ603WDxRM1W@WGCOjDBF463YidodZaUln6334Vj1Ewh/KiID8@cgV@/1jlHeBWEsFOCnQNf9gC2ZK@ "C (gcc) ‚Äì Try It Online")
Thanks to @Dennis for indirectly reminding me of the assign-instead-of-return trick via his [insanely impressive answer](https://codegolf.stackexchange.com/a/125150/3808), saving 4 bytes!
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~2~~ 1 byte
```
E
```
[Try it online!](https://tio.run/##AVsApP9qZWxsef//Rf/It@G5vuKCrCDDh8OQZiBZIOG4t@KAnCBHZW5lcmF0ZSBbIjEiLCAuLi4sICIxMDAwIl0sIGZpbHRlciBieSB0aGUgY29kZSwgZGlzcGxheS7/ "Jelly ‚Äì Try It Online")
[Answer]
## PHP, ~~25~~ ~~28~~ 25
```
<?=!chop($argn,$argn[0]);
```
remove all chars from the right that are equal to the first and print `1` if all chars were removed.
[Answer]
## R, 31 bytes
```
function(x)grepl("^(.)\\1*$",x)
```
This functions works with string inputs and uses a regular expression to determine whether the input is a repdigit.
### Example
```
> f <- function(x)grepl("^(.)\\1*$",x)
> x <- c("1", "2", "11", "12", "100", "121", "333")
> f(x)
[1]  TRUE  TRUE  TRUE FALSE FALSE FALSE  TRUE
```
[Answer]
## Regex (ECMAScript), 31 bytes
```
^(x{0,9})((x+)\3{8}(?=\3$)\1)*$
```
[Try it online!](https://tio.run/##Tc3NTsJAFEDhV8GGhHspHVowRqkDKxdsWOhSNJmUy/TqMNPMjFD5efaKCxO351ucD7VXofLcxCw0vCG/c/aTvjsvLR16z6Sf2gbgKOfjYfcO7SkfPVwQoE1xPT3dX2Ah19M@rgsc9rvh@Igiupfo2WpAEQxXBHej7BaxPNRsCMBIT2pj2BIg3kj7ZQyetDQiNIYjDLIBlrwFsFILQ1bHGueT85nDSq2AZaN8oKWNoF/zN8Q/oP9g58WimP0yxtq7Q7K0e2V40/PKapr1ktSUW@eh5EdJJacpXodJmwhPDakIjGKnYlWDR6ycDc6QME5fe3np8mwyzfMf)
Takes input in unary, as usual for math regexes (note that the problem is trivial with decimal input: just `^(.)\1*$`).
Explanation:
```
^(x{0,9})           # \1 = candidate digit, N -= \1
(                   # Loop the following:
  (x+)\3{8}(?=\3$)  # N /= 10 (fails and backtracks if N isn‚Äôt a multiple of 10)
  \1                # N -= \1
)* $                # End loop, assert N = 0
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 11 bytes
```
@(s)s==s(1)
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo1iz2Na2WMNQ83@ahrqhuiYXkDIBAgjLFCpiaGQMROqa/wE "Octave ‚Äì Try It Online")
Takes the input as a string.
It checks all characters for equality with the first characters. If all are equal, the result will be a vector with only `1` (true in Octave), otherwise there will be at least one `0` (false in Octave).
Here's a [proof](https://tio.run/##y08uSSxL/f8/M00h2lABCGN1UjKLCzTUoTyFzGKFkqLSkoxKdU2d1JziVAW4tAFUOi0xpxgsm5fCBTHGAMUYA5KN@f8fAA).
[Answer]
# grep, 17 bytes
```
grep -xP '(.)\1*'
```
Matches any string that's a repetition of its first character.
[Answer]
# APL, 5 bytes
*2 bytes saved thanks to @KritixiLithos*
```
‚çï‚â°1‚åΩ‚çï
```
[Try it online!](http://tryapl.org/?a=f%25u2190%25u2355%25u22611%25u233D%25u2355%20%25u22C4%20f%20445%20%25u22C4%20f%20444%20%25u22C4%20f%20%27445%27%20%25u22C4%20f%20%27444%27&run)
[Answer]
# C#, 42 33  28 bytes
```
i=>i.Replace(i[0]+"","")==""
```
`i` has to be a string.
Shaved down a lot thanks to @LethalCoder
[Answer]
# [Braingolf](https://github.com/gunnerwolf/braingolf), 6 bytes
```
iul1-n
```
[Try it online!](https://tio.run/##SypKzMxLz89J@/8/szTHUDfv/38TExNTAA "Braingolf ‚Äì Try It Online")
Unfortunately, Braingolf's implicit input from commandline args can't accept an all-digits input as a string, it will always cast it to a number, so instead the solution is to pass it via STDIN, which adds 1 byte for reading STDIN (`i`)
## Explanation:
```
iul1-n
i       Read from STDIN as string, push each codepoint to stack
 u      Remove duplicates from stack
  l     Push length of stack
   1-   Subtract 1
     n  Boolean negate, replace each item on stack with 1 if it is a python falsey value
        replace each item on stack with 0 if it is a python truthy value
        Implicit output of last item on stack
```
After `u`, the length of the stack equals the number of unique characters in the input, subtracting 1 means it will be `0` if and only if there is exactly 1 unique character in the input, `0` is the only falsey number in Python, so `n` will replace `0` with `1`, and everything else with `0`.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 4 bytes
```
¬•√ßUg
```
[Try it online!](https://tio.run/##y0osKPn//9DSw8tD0///VzIxMVH6DwA "Japt ‚Äì Try It Online")
[Answer]
## JavaScript (ES6), ~~23~~ 21 bytes
*Saved 2 bytes thanks to Neil*
Takes input as either an integer or a string. Returns a boolean.
```
n=>/^(.)\1*$/.test(n)
```
### Demo
```
let f =
n=>/^(.)\1*$/.test(n)
console.log(f(444))
console.log(f(12))
```
[Answer]
# [Ohm](https://github.com/MiningPotatoes/Ohm), 4 bytes
```
Ul2<
```
[Try it online!](https://tio.run/##y8/I/f8/NMfI5v9/ExNjAA "Ohm ‚Äì Try It Online")
### Explanation
```
 Ul2<
 U    # Push uniquified input
  l   # Length
   2< # Is it smaller than 2?
```
[Answer]
# Java, ~~38~~ ~~33~~ 23 bytes
```
n->n.matches("(.)\\1*")
```
`n` is a `String`, naturally.
Note that there is no need for `^...$` in the regex since it's automatically used for exact matching (such as the `match` method), compared to finding in the string.
[Try it!](http://ideone.com/KxyRJ9)
## Saves
* -5 bytes: used `String` since "You may take and use input as a string with impunity."
* -10 bytes: regex is apparently a good fit.
[Answer]
# Java, 21 bytes:
```
l->l.toSet().size()<2
```
`l` is a `MutableList<Character>` from eclipse collections.
[Answer]
# [Kotlin](https://kotlinlang.org), ~~28~~ 19 bytes
```
{it.toSet().size<2}
```
[Try it online!](https://tio.run/##JYyxDoIwFEV3vuKGqW@QWMcGMDi78QVNbEljeTWlmCjh22vVs95zzz0k7zg/tYdVEGOKjifCocclBG80o8ubS00Ko0mCmsW9TXvas10Zs3YsdJwWhSFG/Wr/756wVSh8o7zO6BCNvl0dG0E4K9TH@rc/ip2EFcUhqvYspfwA "Kotlin ‚Äì Try It Online")
Takes input as a `String` because
> 
> You may take and use input as a string representation in base 10 with impunity.
> 
> 
> 
## Explanation
```
{
    it.toSet()     // create a Set (collection with only unique entries)
                   // out of the characters of this string
        .size < 2  // not a repdigit if the set only has one entry
}
```
If you don't like the fact it takes a `String`, you can have one that takes an `Int` for **24 bytes**.
```
{(""+it).toSet().size<2}
```
[Answer]
# PHP, 30 bytes
```
<?=($a=$argn).$a[0]==$a[0].$a;
```
[Answer]
# [Neim](https://github.com/okx-code/Neim), 1 byte
```
ùêê
```
Simply checks that all elements are equal.
Without builtin, 2 bytes:
```
ùêÆùê•
```
Explanation:
```
ùêÆ     Calculate unique digits
 ùê•    Get the length
```
This works because only `1` is considered truthy in Neim, and everything else is falsy.
Alternatively, for 4 bytes:
```
ùêÆùê£ŒºùïÉ
```
Explanation:
```
ùêÆ      Calculate unique digits
 ùê£      Join list into an integer
   ùïÉ   Check that is is less than
  Œº    Ten.
```
[Try it!](http://178.62.56.56:80/neim?code=%F0%9D%90%90&input=12)
[Answer]
# C, 38 bytes
```
f(char*s){return*s^s[1]?!s[1]:f(s+1);}
```
Recursively walks a string. If the first two characters differ (`*s^s[1]`) then we succeed only if we're at the end of the string (`!s[1]`) otherwise we repeat the test at the next position (`f(s+1)`).
## Test program
```
#include <stdio.h>
int main(int argc, char **argv)
{
    while (*++argv)
        printf("%s: %s\n", *argv, f(*argv)?"yes":"no");
}
```
[Answer]
# R, 25 bytes
```
grepl("^(.)\\1*$",scan())
```
[Try it online](https://tio.run/##K/r/P70otSBHQylOQ08zJsZQS0VJpzg5MU9DU/O/paUllwmXhSGXpYW5mfF/AA)
Best non-regex solution I could come up with was 36 bytes:
```
is.na(unique(el(strsplit(x,"")))[2])
```
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), 15 bytes
```
uOn@ii?-?;.$@<_
```
[Try it online!](https://tio.run/##Sy5Nyqz4/7/UP88hM9Ne195aT8XBJv7/f1MQAAA "Cubix ‚Äì Try It Online")
```
    u O
    n @
i i ? - ? ; . $
@ < _ . . . . .
    . .
    . .
```
[Watch It Run](https://ethproductions.github.io/cubix/?code=ICAgIHUgTwogICAgbiBACmkgaSA/IC0gPyA7IC4gJApAIDwgXyAuIC4gLiAuIC4KICAgIC4gLgogICAgLiAuCg==&input=MjIzMjI=&speed=20)
Outputs 1 for truthy and nothing for falsey
Very simply read reads in the input one character at a time. It takes the current character away from the previous. If a non zero result then it halts immediately. Otherwise it continues inputting and comparing until the EOI. On EOI (-1), negate and exit
[Answer]
# QBasic 4.5, 55 bytes
```
INPUT a
FOR x=1TO LEN(STR$(a))
c=c*10+1
NEXT
?a MOD c=0
```
I've mathed it! The FOR-loop checks the number of digits in the input, then creates `c`, which is a series of 1's of length equal to the input. A number then is repdigit if it modulo the one-string == 0.
[Try it online!](https://repl.it/IcSt/0) Note that the online interpreter is a bit quirky and I had to write out a couple of statements that the DOS-based QBasic IDE would expand automatically.
]