Skip to main content
correction: -n only costs 1 byte, not 2; improvement to bonus solution - ? was to prevent 0, which is not needed per specs
Source Link
ThaddeusB
  • 401
  • 2
  • 8

#Perl, 23 2120 bytes

say/^(?!(..+)\1+$)/

using -n option.

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever number you entered) or a blank line.

Bonus: decimal version, 3231 bytes

(1x<>)=~/^1?$|^^1$|^(11+)\1+$/||say 1

#Perl, 23 21 bytes

say/^(?!(..+)\1+$)/

using -n option.

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever number you entered) or a blank line.

Bonus: decimal version, 32 bytes

(1x<>)=~/^1?$|^(11+)\1+$/||say 1

#Perl, 23 20 bytes

say/^(?!(..+)\1+$)/

using -n option.

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever number you entered) or a blank line.

Bonus: decimal version, 31 bytes

(1x<>)=~/^1$|^(11+)\1+$/||say 1
Improved formatting
Source Link
DLosc
  • 39.2k
  • 5
  • 83
  • 141

#Perl, 2321 21 bytes

say/^(?!(..+)\1+$)/

using -n option.

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever your digitnumber you entered) or a blank line.

Bonus: decimal version, 32 bytes

(1x<>)=~/^1?$|^(11+)\1+$/||say 1

#Perl, 2321 bytes

say/^(?!(..+)\1+$)/

using -n option

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever your digit entered) or a blank line

Bonus: decimal version, 32 bytes

(1x<>)=~/^1?$|^(11+)\1+$/||say 1

#Perl, 23 21 bytes

say/^(?!(..+)\1+$)/

using -n option.

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever number you entered) or a blank line.

Bonus: decimal version, 32 bytes

(1x<>)=~/^1?$|^(11+)\1+$/||say 1
-2 bytes
Source Link
ThaddeusB
  • 401
  • 2
  • 8

#Perl, 232321 bytes

say<>=~say/^(?!(..+)\1+$)/

using -n option

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever your digit entered) or a blank line

Bonus:Bonus: decimal version, 32 bytes

(1x<>)=~/^1?$|^(11+)\1+$/||say 1

#Perl, 23 bytes

say<>=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever your digit entered) or a blank line

Bonus: decimal version, 32 bytes

(1x<>)=~/^1?$|^(11+)\1+$/||say 1

#Perl, 2321 bytes

say/^(?!(..+)\1+$)/

using -n option

say=~/^(?!(..+)\1+$)/

Using the regular expression+unary input approach, prints 11 (or whatever your digit entered) or a blank line

Bonus: decimal version, 32 bytes

(1x<>)=~/^1?$|^(11+)\1+$/||say 1
add decimal version
Source Link
ThaddeusB
  • 401
  • 2
  • 8
Loading
clarify
Source Link
ThaddeusB
  • 401
  • 2
  • 8
Loading
Source Link
ThaddeusB
  • 401
  • 2
  • 8
Loading