g | x | w | all
Bytes Lang Time Link
040AWK250303T160837Zxrs
047Tcl180415T234837Zsergiol
026JavaScript Node.js230612T152318ZFhuvi
015Arturo230613T181316Zchunes
076Rockstar230613T150005ZShaggy
001Thunno 2230608T135041ZThe Thon
110Slashalash180620T164201ZSophie S
019Factor220305T202819Zchunes
241Excel180416T040441Zl4m2
nanScratch 3.0210314T054236Zlyxal
001Vyxal210314T052545Zlyxal
021brainfuck210314T021631ZMitch Sc
014Zsh extendedglob210313T204043Zpxeger
017Swift 24 /210312T135250ZDaniel
043Prolog200913T154022Zuser
003Pip200913T074552ZRazetime
004Stax200220T174816ZNanajnai
050naz200219T212632Zsporebal
002MATL 5 bytes or170614T053124ZDrQuariu
031Regex ECMAScript190208T174947ZGrimmy
060Pepe181008T143130Zu-ndefin
019Kotlin180606T050522Zsnail_
002Pyt181021T053334Zu-ndefin
048Pepe181020T182709ZRedClove
068Pascal FPC181008T185734ZAlexRace
003MathGolf181009T081547ZJo King
032APLNARS181009T071433Zuser5898
006J181009T042327ZBubbler
706Taxi181008T200118ZJosiahRy
093Whitespace181008T153519ZKevin Cr
032QBasic180620T044535ZDLosc
003Pyth180607T202608Zhakr14
087Forth gforth180607T183608Zreffu
042PHP180606T192741ZFrancisc
026SmileBASIC 3180416T055843Zsnail_
021Pari/GP180416T042429Zalephalp
012><>180416T031952ZJo King
038F#171104T142504ZJason Ha
030Julia171102T215653ZEricSher
005Pushy171102T213723ZFlipTack
039Noether170608T102137ZBeta Dec
124Check170614T072553ZEsolangi
177Batch170614T093009Zstevefes
055QBasic 4.5170608T113137Zsteenber
019Smalltalk170614T033302ZDonald R
006CJam170614T034540ZEsolangi
028PHP170609T085533ZTitus
139COBOL170609T135304ZSaggingR
021Java170609T130206ZNathan M
022Python170608T025338Zpraosyle
028C#170608T085206ZLiefdeWe
031R170609T063921ZSven Hoh
023PowerShell170609T010627ZTessella
016TIBASIC170608T210923ZScott Mi
015Cubix170608T205249ZMickyT
053Swift170608T183451ZLeena
005APL170608T105315ZUriel
033AWK170608T183319ZRobert B
012Perl 6170608T181927ZSean
024><>170608T131529ZAGourd
023QBIC170608T053751Zsteenber
025R170608T163512Zuser2390
006V170608T151750ZDJMcMayh
023Java170608T115431ZOlivier
012Clojure170608T081141ZNikoNyrh
013V170608T123156Znmjcman1
017grep170608T123121ZToby Spe
038C#170608T123055ZTheLetha
038C170608T122626ZToby Spe
031Excel170608T122009ZWernisch
034PHP170608T105423ZJör
004Ohm170608T111351ZDatboi
025PHP170608T094424ZChristop
003Pyke170608T100249ZBlue
021JavaScript ES6170608T063251ZArnauld
053Tcl170608T082153Zavl42
004Japt170608T071530ZTom
006Braingolf170608T075944ZMayube
027Mathematica170608T074325ZMartin E
001Neim170608T061509ZOkx
1312Ruby170608T073324ZG B
030PHP170608T063908Zuser6395
001Brachylog170608T030437ZLeaky Nu
023Python 3170608T053512Zmusicman
011Octave170608T052454ZStewie G
019Python 3170608T050008ZShadow
001Jelly170608T030309ZDennis
041C gcc170608T034427ZDoorknob
029C gcc170608T040709ZDennis
00105AB1E170608T035155ZNeil A.
015Haskell170608T034100Zxnor
016Cheddar170608T032234ZLeaky Nu

AWK, 40 bytes

{for(x=1;i++<NF-1;)$i~$(i+1)||x=0}1,$0=x

To test:

awk -F "" '{for(x=1;i++<NF-1;)$i~$(i+1)||x=0}1,$0=x' <<< 1111

Tcl, 47 bytes

proc R n {expr 1[regsub -all ^(.)\\1* $n ""]<2}

Try it online!


# [Tcl], 52 bytes
proc R n {expr [llength [lsort -u [split $n ""]]]<2}

Try it online!

JavaScript (Node.js), 26 27 bytes

(Solutions without regex. They all take input as a string. Luckily for some of them, OP guaranteed that the input can't be zero)

-1 byte thanks to @Shaggy

Checking that there is no character different from the first :

s=>![...s].some(c=>c-s[0])

Try it online!


Checking that every character is the same as the first (27 bytes) :

s=>[...s].every(c=>c==s[0])

Checking that the parameter is equal to the first character repeated parameter.length times (27 bytes) :

s=>s==s[0].repeat(s.length)

Checking that the parameter divided by its first character is equal to 1 repeated parameter.length times (31 bytes) :

s=>s/s[0]=="1".repeat(s.length)

More mathematical ways (could probably be a lot shorter in other languages ?) :

There is a special rule that only repdigits follow.
For example, 4444 +1 in base 4+1 gives 10000 in the same base, and we can recognize this particular pattern (still without using regex).

Using the same example, checking that 10000 (made from concatenation and repetition) from base 4+1 to base 10, minus 4444 (the parameter) with same base conversion, gives exactly 1. The 4 for the base conversion comes from the first character of the parameter (63 bytes) :

s=>parseInt(1+"0".repeat(s.length),a=s[0]*1+1)-parseInt(s,a)==1

Using the same example, checking that 4444 (the parameter) from base 4+1 to base 10, plus 1, converted back to its original base, gives a number that when inverted from right to left (to get rid of the previously trailing zeroes), is exactly 1. The 4 for the base conversion comes from the highest digit of the parameter (76 bytes) :

s=>[...(parseInt(s,a=Math.max(...s)+1)+1).toString(a)].reverse().join``*1==1

Arturo, 15 bytes

$->x[{}=x--x\0]

Try it!

$->x[       ; a function taking an input x
    {}=     ; is the empty string equal to...
    x--x\0  ; x without its first element
]           ; end function

Rockstar, 76 bytes

listen to N
cut N
roll N in D
O's 1
while N and O
let O be D's roll N

say O

Try it (Code will need to be pasted in)

Thunno 2, 1 byte

Attempt This Online!

Built-in that works on numbers.

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!

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.

Factor, 19 bytes

[ present all-eq? ]

Try it online!

Excel, 24 bytes (assuming Tab is 1 byte)

=LEFT(B1,1);=A1&B1=B1&A1

Excel, 28 27 bytes

=A1=MID(A1,2,A1)&LEFT(A1,1)

Scratch 3.0, 20 blocks/148 bytes

enter image description here

define(z)
set[o v]to(1
set[i v]to(1
repeat(length of(z)
if <not<(letter(i)of(z))=(letter(1)of(z))>>then
set[o v]to(0
end
set[i v]to((i)+(1
end
say(o

Try it on Scratch

I did the most logical thing and answer this with scratch. Essentially, we loop through every character and see if it equals the first character. If any character doesn't equal the first, the output is set to falsey

Vyxal, 1 byte

Try it Online!

Simply checks if all the digits are equal to each other

brainfuck, 21 bytes

,<,[[>->+<<-]>[>],]>.

With a little formatting:

,<,
[
  [>->+<<-]
  >[>]
  ,
]
>.

Try it online

Prints the repeated digit for true, and NUL for false.

Compares adjacent digits in a loop, and in the case of inequality, shifts pointer so that all subsequent comparisons will also result in inequality, and the cell to the right will be zero upon exiting the loop.

Variant for stricter output rules, 25 bytes

,<,[[>->+<<-]>[>>->],]<+.

Formatted:

,<,
[
  [>->+<<-]
  >[>>->]
  ,
]
<+.

Try it online

This version prints \x01 for true.

Zsh --extendedglob, 14 bytes

>$1
: ^{1..9}#

Try it online!

Outputs via exit code: 0 is not a repdigit, 1 is a repdigit.

--extendedglob is required to enable the ^ and # glob operators.

Swift (24 / 17 bytes)

Console App (24 bytes):

Set(readLine()!).count<2

Function (17 bytes):

{Set($0).count<2}

Usage example:

let isRepdigit: (String) -> Void = {Set($0).count<2}
print(isRepdigit("234")) // prits false
print(isRepdigit("66666")) // prints true

Prolog, 43 bytes

f(N,D):-N==0;O is N//10,D is N-O*10,f(O,D).

Run the query with f(666,D) (or whatever other number you have). If it's a repdigit, it will return a value for D, otherwise, it will return false.

Try it in SWISH (By the way, I think if you make changes directly without creating a new notebook, it may modify the original, so please don't mess with it :))

Pip, 3 bytes

$=a

fold by equality.

Try it online!

Stax, 4 bytes

ë@╛α

Run and debug it

Unpacked

Eu%v!

naz, 50 bytes

2a2x1v1r2x2v1x1f1r3x1v2e3x2v1e0m1o0x1x2f0m1a1o0x1f

Works for any input integer, provided it's passed as a file terminated with the control character STX (U+0002).

Explanation (with 0x commands removed)

2a2x1v                 # Set variable 1 equal to 2
1r2x2v                 # Read the first byte of input and store it in variable 2
1x1f                   # Function 1
    1r                 # Read a byte of input
      3x1v2e           # Jump to function 2 if it equals variable 1
            3x2v1e     # Jump back to the start of the function if it equals variable 2
                  0m1o # Otherwise, output 0
1x2f                   # Function 2
    0m1a1o             # Output 1
1f                     # Call function 1

MATL (6 5 bytes or 2 bytes for Luis Mendo solution)

Vun1=

Try it online!

Explanation

V     % convert to string
un    % find unique characters and count them
1=    % if there is only one unique character, then we pass.

Luis Mendo solution (see comments):

&=

Outputs a truthy array (all 1's) if repdigit, or a falsy array (some 0 in the array) if not a perfect repdigit.

Try it online!

Regex (ECMAScript), 31 bytes

^(x{0,9})((x+)\3{8}(?=\3$)\1)*$

Try it online!

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

Pepe, 69 60 bytes

REeErEEEEEREEEeeEREEEEeEeEREEEEEEeREEEeREEEEEerrEEreEErEereE

Try it online!

How it works?

It takes the greatest digit and subtracts it from the least digit. Repdigit numbers always evaluate to 0.

REeE             # Takes a number (stack r) 
rEEEEEREEEeeE    # Splits by digits 
REEEEeEeE        # Sorts them
REEEEEEe         # Copies first digit to other stack
REEEe            # Move pointer to last in stack r
REEEEEe          # Subtract stack R to stack r
rrEErEEEEErEereE # Print if 0, else none

Kotlin, 28 19 bytes

{it.toSet().size<2}

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}

Pyt, 2 bytes

ą≡

Try it online!

Explanation:

   Implicit input
ą  Split digits
 ≡ Are all elements equal?

Pepe, 48 bytes

rrEEreeeEEeeeErEeREEeREEREEEEEEErEEEEreErEEEeReE

Outputs 1 if number is a repdigit, nothing otherwise.

Try it online!

Explanation

(for input 45. 52 and 53 are charcodes of digits)

rrEE          # Create label 0, implicitly push 0 to the second stack [] [0]
  reeeEEeeeE    # Print "1"
rEe           # Return

REEe          # Start: Take input as charcodes to the first stack [52,52,53] [0]
REE           # Create label I (1)
  REEEEEEE      # Move first item in first stack to the other [52,53] [0, 52]
  rEEEE         # Reset second stack pointer position [>52, 53] [>0, 52]
  reE           # If item in first stack equals the first item in the second stack (0), 
                #   call label 0. It will only be true if first stack is empty
                #   because it will implicitly give 0.
rEEEe           # Move second stack pointer to the end [>52, 52] [0, >52]
ReE           # Repeat if items are the same (52 == 52), end program otherwise
reeeEEeeee    # Optional: Print 0.

Pascal (FPC), 81 75 68 bytes

var n:string;begin read(n);write(n=StringOfChar(n[1],length(n)))end.

Try it online!

It seems that taking a number as string is shorter.


75 bytes - taking the number as integer:

Thanks to @Ørjan Johansen for -6 bytes - mod 100 mod 11 trick

var n:word;begin read(n);while n mod$64mod$B=0do n:=n div$A;write(n<=9)end.

Try it online!

$64, $B and $A are hexadecimal constants, they eliminate some whitespace that would be needed for their decimal counterparts.

MathGolf, 3 bytes

▀£┴

Try it online!

Takes input as a string.

Explanation:

▀    Get unique characters
 £   Get length of list
  ┴  Is equal to one?

APL(NARS), 16 chars, 32 bytes

{(⍴w)=+/w=↑w←⍕⍵}

test:

  {(⍴w)=+/w=↑w←⍕⍵}¨1 2 23 33 93 9999999
 1  1  0  1  0  1 

J, 6 bytes

1=#@~.

Try it online!

Take unique elements; does its length equal 1?

/:-:\:

Try it online!

Does ascending sorting order equal descending sorting order?

-:##{.

Try it online!

Does the first element, duplicated to the length, equal the original?

-:1&|.

Try it online!

Does the input, rotated once, equal itself?

Taxi, 730 706 bytes

-24 bytes by eliminating linebreaks.

Clever answer in a verbose language? Check and check.

Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.Pickup a passenger going to Cyclone.[B]Switch to plan D if no one is waiting.Pickup a passenger going to Crime Lab.Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Crime Lab.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 2 r 2 r.Switch to plan C if no one is waiting.Pickup a passenger going to Cyclone.Go to Fueler Up:n.Go to Chop Suey:n 3 r 1 l.Switch to plan B.[C]0 is waiting at Writer's Depot.Go to Writer's Depot:n 4 l 2 l.Pickup a passenger going to Cyclone.Go to Chop Suey:n 3 r 3 r.[D]Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Post Office.Go to Post Office:s 1 l 2 r 1 l.

Try it online!

Try it online with linebreaks!

Doesn't return to the Taxi Garage after the program ends, so the boss fires me, and it exits with an error.

What this program actually does is checks whether or not the input consists of any repeating character, and outputs that character if it does, or 0 if it doesn't.

Alternative solution, 602 582 541 445 bytes

-20 bytes by eliminating linebreaks.

-41 bytes by having the program error out upon a false result.

-96 bytes by having the program output via error message.

Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 1 r 1 l 4 r 1 l.Pickup a passenger going to Cyclone.[B]Switch to plan C if no one is waiting.Pickup a passenger going to Crime Lab.Go to Cyclone:n 1 l 3 l.Pickup a passenger going to Crime Lab.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 2 r 2 r.Pickup a passenger going to Cyclone.Go to Fueler Up:n.Go to Chop Suey:n 3 r 1 l.Switch to plan B.[C]

Try it online!

Try it online with linebreaks!

This alternative solution errors out with The boss couldn't find your taxi in the garage. You're fired! if the input is a repdigit, and no outgoing passengers found if the input is not a repdigit (meaning this also works with 0...or 00, or 000...).

Whitespace, 96 93 bytes

[S S S N
_Push_0][S N
S _Duplicate][T N
T   T   _Read_STDIN_as_integer][T   T   T   _Retrieve][N
S S N
_Create_Label_LOOP][S N
S _Duplicate][S S S T   T   S S T   S S N
_Push_100][T    S T T   _Modulo][S S S T    S T T   N
_Push_11][T S T T   _Modulo][N
T   S S N
_If_0_Jump_to_label_NEXT][S S S T   S S T   N
_Push_9][S N
T   _Swap_top_two][T    S T S _Integer_division][T  N
S T _Print_as_integer][N
S S S N
_Create_Label_NEXT][S S S T S T S N
_Push_10][T S T S _Integer_division][N
S N
N
_Jump_to_Label_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.

Port of @Dennis♦' C answer, so also outputs a positive digit ([1,9]) as truthy and 0 as falsey.

Try it online (with raw spaces, tabs and new-lines only).

Pseudo-code:

Integer i = STDIN as integer
Start LOOP:
  If(i modulo-100 modulo-11 == 0):
    i = i integer-divided by 10
    Go to next iteration of LOOP
  i = 9 / i
  Print i to STDOUT as integer
  Stop the program with an error

QBasic, 37 32 bytes

INPUT n$
?n$=STRING$(LEN(n$),n$)

-5 bytes thanks to steenbergh

The STRING$ function takes two arguments, a number n and a string s$, and constructs a string consisting of n copies of the first character of s$.* So this code reads our number as a string n$, generates a string consisting of LEN(n$) copies of n$'s first character, and checks to see if it is equal to n$.

* The second argument can also be an integer codepoint, in which case it repeats the character corresponding to that codepoint.

Pyth, 4 3 bytes

!t{

Try it online!
-1 thanks to Erik the Outgolfer!

Takes input as a string.

Forth (gforth), 87 bytes

: m 10 /mod swap ; : f 1 swap m >r begin ?dup 0> while m r@ = rot * swap repeat rdrop ;

Try it online!

Explanation

The algorithm is approximately:

  1. Divide by 10, take remainder and store on return stack
  2. Repeatedly divide by 10 and compare remainder to stored value
  3. When quotient equals 0, stop loop and clean return stack

Code Explanation

: m 10 /mod swap ;        \ helper to grab the quotient and remainder after dividing by 10

1 swap                    \ place 1 as a result value on the stack and move to the bottom
m >r                      \ divide by 10 and place remainder on the return stack
begin                     \ start an indefinite loop
  ?dup 0>                 \ duplicate if not equal to 0 and check if greater than 0
while                     \ if greater than 0 execute loop body, else go the end of the loop
  m r@ =                  \ divide by 10, check if remainder equals our check value
  rot *                   \ move the result value to the top and multiply by result
  swap                    \ move the result value back to the boottom
repeat                    \ end the loop body
rdrop                     \ clean the return stack

PHP, 42 Bytes

Try it online

(42 Bytes because i forgot Towel day on may 25)

Code

<?=!(($a=$argv)%str_repeat(1,strlen($a)));

Explanation

Every number like 11, 22222,5555555555 always will be dvisible by 1 times the number length it just checks that, if the % between the numbers is 0 outputs 1 else empty.

SmileBASIC 3, 26 bytes

INPUT N$?N$[0]*LEN(N$)==N$

Takes input as a string, prints 0 for false and 1 for true. If we repeat the first character of the input length(input) times and that is equal to the input, then it's a repdigit.

Pari/GP, 21 bytes

n->#Set(digits(n))==1

Try it online!

><>, 12 bytes

1l2=?n@:}=*!

Try it online!

Takes input through the -s flag and checks whether every digit is the same.

F#, 38 bytes

let f n=Seq.length(Seq.countBy id n)=1

Try it online!

Julia, 30 bytes

f(n)=length(Set(string(n)))==1

Pushy, 5 bytes

sK=P#

Try it online!

                                              Falsy Example:      Truthy Example:
       \ Implicit: Input on stack             [22121]             [5555]
s      \ Split into digits                    [2, 2, 1, 2, 2]     [5, 5, 5, 5]
 K=    \ Pop last, compare with all others    [1, 1, 0, 1]        [1, 1, 1]
   P#  \ Print the stack's product            PRINT: 0            PRINT: 1

6 bytes

I prefer this method as it's sweet and simple, but unfortunately it's one byte longer:

suLtn#

Try it online!

        \ Implicit: Input on stack
s       \ Split into digits
 u      \ Make stack into a set of itself
  Lt    \ Get the stack length - 1
        \ This will be 0 for a valid repdigit, a positive value otherwise
    n   \ Boolean negate: this maps 0 -> 1, and everything else to 0.
     #  \ Print result.

Noether, 39 bytes

""~bI~aL(ai/~c{bc/}{}{bc+~b}i1+~i)bL1=P

Try it here!

It takes input as a number enclosed in quotation marks.

This works by looping through the input string, and, at the start, adding the first character to the string, B. As it loops, if the current character in the input isn't in B, it is appended to B. At the end, if the number is a repdigit, B will only be one character long.

Outputs 1 for true, 0 for false.

Check, 135 134 132 124 bytes

 [r            #v
#:>10%:]R+r->\#v#?
#v
# >10-\)\#     # ?
d #             ^ 
 #R:
:>=r,#v
#ddd[=#(:@:@=R-?
d\:!:R *
o>]=d#^

Input should be passed as a command-line argument. Outputs some unprintables for truthy and only zero bytes for falsey. Always terminates with an IndexError due to the fact that it abuses an interpreter bug.

How does it work?

This code is divided into two segments. The first half turns the input integer into a list of digits, and the second half checks that all of its digits are equal to the first digit (i.e. they are all equal).

It roughly corresponds to the following pseudocode:

  1. Read input and call it i.
  2. Create an empty array and store it in the register. ([r)
  3. If i is 0, go to step 13.
  4. Take the number modulo 10. Call it x.
  5. Prepend x to the register and store it back in the register.
  6. Subtract x from i.
  7. Create a counter, starting at 0.
  8. If i is 0, go to step 12.
  9. Increment the counter.
  10. Decrement i by 10.
  11. Go back to step 8.
  12. Set i to whatever value is now in the counter.
  13. Go back to step 3.
  14. Load the register, which is now an array containing the digits of the input. Call this d.
  15. Get the first element in d and store it in the register.
  16. Create a counter called j, initialized to the length of d.
  17. Decrement j.
  18. If the jth element of d is not equal to the value of the register, crash the program. (We found a digit that is not correct.)
  19. Otherwise, print some random junk !j times. This only prints something if j == 0.
  20. Create an array of length 1 and get the !jth element. This will crash the program if j == 0.
  21. If the program has not yet crashed, j must not yet be zero, so go back to step 17.

Batch, 177 bytes

@echo off
set s=
set z=
<nul set/p=.%1>t
for /f "usebackq" %%G in ('t')do set z=%%~zG
for /l %%G in (2,1,%z%)do call set s=1%%s%%
set/ar=%1%%%s%
if %r%==0 echo %r%&exit/b
echo 1

Not properly golfed, yet.

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! 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.

Smalltalk, 21 19 bytes

[:s|s asSet size<2]

Try it online!

You can execute the block above by sending the message value: to the block with a String. A String in Smalltalk is written with single quotes. A longer version of the block could accept an Integer. It would take 30 28 bytes.

[:i|i asString asSet size<2]

I tried both solutions in the current online version of Amber Smalltalk and Pharo Smalltalk version 6.0.

Thanks to the suggestion in the comments I was able to remove the spaces before and after the <. It's been many years since I wrote Smalltalk but I doubt I ever tried that in practice. The shorter version worked in both versions of Smalltalk I tested.

CJam, 6 bytes

qL|,1=

Explanation:

q  e# Get the input: "1311211"
L| e# Get unique elements: "132"
,  e# Length: 3
1= e# Equal to 1: 0 (false)

PHP, 28 bytes

<?=!count_chars($argn,3)[1];

count_chars with mode=3 creates a string with all different characters in $argn.
If there is only one, the second character will be empty == falsy.

Run as pipe with -F.

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).

Java, 21 bytes:

l->l.toSet().size()<2

l is a MutableList<Character> from eclipse collections.

Python, 27 22 bytes:

Just to get things started.

lambda x:len(set(x))<2

Converts to a string, converts the string into a set of all distinct characters in that string, and checks whether there aren't multiple elements in the set.

5 bytes saved thanks to @LeakyNun's reminder.

C#, 42 33 28 bytes

i=>i.Replace(i[0]+"","")==""

i has to be a string.

Shaved down a lot thanks to @LethalCoder

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

PowerShell, 23 bytes

"$args"-match'^(.)\1*$'

Save as repdigit.ps1 and run with PS C:\wherever\repdigit.ps1 444, outputs True or False.

If you want the Python len(set(input))==1 style, it costs more at 32 bytes:

@($args-split''|group).count-eq2

(Noting that the split on the space between chars also outputs an empty start and end string as well as the characters).

TI-BASIC, 17 16 bytes

log(1+.9X/fPart(.1X:Ans=int(Ans

Takes input on X. TI-BASIC is token based, all tokens are one byte.

Cubix, 15 bytes

uOn@ii?-?;.$@<_

Try it online!

    u O
    n @
i i ? - ? ; . $
@ < _ . . . . .
    . .
    . .

Watch It Run

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

Swift , 53 Bytes

var s=readLine()!,r=Set(s.characters);r.count>1 ?0:1

APL, 5 bytes

2 bytes saved thanks to @KritixiLithos

⍕≡1⌽⍕

Try it online!

AWK, 33 bytes

BEGIN{FS=""}{$0=NF==gsub($1,"")}1

Try it online!

Replaces all characters in the input with the first character and compares the changed count to the total number of characters.

Perl 6, 12 bytes

{[==] .comb}

Reduces the list of characters in the input number with the numeric equality operator.

><>, 26 24 bytes

!vi:0(?v::&r&=?
 >0n;n1<

Reads the input as a string and reads every character in a loop

  i               // Take the next character and pushes it onto the stack
   :0(?v          // If the end of the input has been reached, goto the successful termination code
        ::        // Duplicate the top of the stack twice
!v         &r&=?  // Pop the top of the stack, pop the bottom of the stack, and compare them. If they are not equal, goto the failure termination code
 >0n;            // Failure termination code. Prints a 0 and terminates
    ;n1<         // Success termination code. Prints a 1 and terminates

QBIC, 36 23 bytes

[_l!:$||p=p*z+1]?b%p=0

Explanation

    :     Read a number from the cmd line
   ! $    cast it to string
 _l   |   Take its length
[      |  And run a FOR-loop from 1 to that length 
p=        p starts out as 0. set it to 
  p*z       itself multiplied by 10 (z=10 in QBIC) (still 0 on the first run
  +1        then add 1. On consecutive FOR-loops yields 1, 11, 111, ....
]         Close the FOR loop
?b%p=0    PRINT -1 if b mod p is 0 (ie 444 % 111 = 0), or 0 otherwise

R, 25 bytes

grepl("^(.)\\1*$",scan())

Try it online

Best non-regex solution I could come up with was 36 bytes:

is.na(unique(el(strsplit(x,"")))[2])

V, 6 bytes

ø^ˆ±*$

Try it online!

Hexdump:

00000000: f85e 88b1 2a24                           .^..*$

This uses a brand new operator that I haven't used in any PPCG answers before. The ø operator will count the number of matches of a given regex. In this case, the (compressed) regex is:

/^\(.\)\1*$/

That is, any character at the start of the line, followed by only that character until the end of the line.

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!

Saves

Clojure, 17 12 bytes

You may take and use input as a string representation in base 10 with impunity.

Oh in that case:

#(apply = %)

Original:

#(apply =(str %))

V, 13 bytes

ylÍ"/.
ñ/ä
d

Try it online!

Leaves a string of .s if truthy, nothing if falsy (empty strings are truthy in Vim/V and vice versa)

grep, 17 bytes

grep -xP '(.)\1*'

Matches any string that's a repetition of its first character.

C#, 38 bytes

using System.Linq;s=>s.All(c=>c==s[0])

Or alternatively for 44 bytes:

using System.Linq;s=>s.Distinct().Count()==1

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");
}

Excel, 31 bytes

=MOD(A2,10)*(10^LEN(A2)-1)/9=A2

PHP, 34 bytes

<?=preg_match('#^(.)\1*$#',$argn);

Try it online!

Ohm, 4 bytes

Ul2<

Try it online!

Explanation

 Ul2<
 U    # Push uniquified input
  l   # Length
   2< # Is it smaller than 2?

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.

Pyke, 3 bytes

}t!

Try it here!

}   -   uniquify(input)
 t  -  ^[:-1]
  ! - not ^

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))

Tcl, 53 bytes

proc r n {expr 1==1[string trim $n [string in $n 0]]}

"string trim" removes leading and trailing occurrences of all its second argument's characters from its first argument (usually used for whitespace). Second argument here is the first digit of $n. For a repdigit an empty string remains, and attaching that to 1 remains 1. For number 42424, 242 would remain after the trim, so 1 is not equal to 1242.

PS: attaching to 1 is a golfing-thing that saved two bytes versus comparing the trim with empty string.

Japt, 4 bytes

¥çUg

Try it online!

Braingolf, 6 bytes

iul1-n

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.

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.

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!

Ruby, 13 bytes (12 + '-n' flag)

p~/^(.)\1*$/

Try it online!

PHP, 30 bytes

<?=($a=$argn).$a[0]==$a[0].$a;

Brachylog, 1 byte

=

Try it online!

This acts on integers.

From 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]).

Python 3, 23 bytes

lambda s:s==s[0]*len(s)

Try it online!

Not shorter than @shadow's answer, but I thought it was interesting. Should work in Python 2 as well.

Octave, 11 bytes

@(s)s==s(1)

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.

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.

Jelly, 2 1 byte

E

Try it online!

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!

Thanks to @Dennis for indirectly reminding me of the assign-instead-of-return trick via his insanely impressive answer, saving 4 bytes!

C (gcc), 33 30 29 bytes

f(n){n=n%100%11?9/n:f(n/10);}

Try it online!

05AB1E, 1 byte

Ë

Checks if all digits are equal

Try it online!

Haskell, 15 bytes

all=<<(==).head

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]

Cheddar, 16 bytes

s->s.len*s[0]==s

Try it online!

Integer input, 29 bytes

n->(s->s.len*s[0]==s)("%d"%n)

Try it online!