Skip to main content
added 86 characters in body
Source Link
LegionMammal978
  • 18k
  • 4
  • 25
  • 57

Mathematica, 62 6161 60 bytes

Saved 2 bytes due to @MartinEnder.

MatchQ[Differences@IntegerDigits@#,MatchQ[{a:1...,b___}/;{b}==-{a}]&]@*Differences@*IntegerDigits

Anonymous functionComposition of functions. Takes a number as input and returns True or False as output.

Mathematica, 62 61 bytes

MatchQ[Differences@IntegerDigits@#,{a:1...,b___}/;{b}==-{a}]&

Anonymous function. Takes a number as input and returns True or False as output.

Mathematica, 62 61 60 bytes

Saved 2 bytes due to @MartinEnder.

MatchQ[{a:1...,b___}/;{b}==-{a}]@*Differences@*IntegerDigits

Composition of functions. Takes a number as input and returns True or False as output.

added 9 characters in body
Source Link
LegionMammal978
  • 18k
  • 4
  • 25
  • 57

Mathematica, 6262 61 bytes

MatchQ[Differences@IntegerDigits@#,{a:1...,b:___b___}/;{b}==-{a}]&

Anonymous function. Takes a number as input and returns True or False as output.

Mathematica, 62 bytes

MatchQ[Differences@IntegerDigits@#,{a:1...,b:___}/;{b}==-{a}]&

Anonymous function. Takes a number as input and returns True or False as output.

Mathematica, 62 61 bytes

MatchQ[Differences@IntegerDigits@#,{a:1...,b___}/;{b}==-{a}]&

Anonymous function. Takes a number as input and returns True or False as output.

Source Link
LegionMammal978
  • 18k
  • 4
  • 25
  • 57

Mathematica, 62 bytes

MatchQ[Differences@IntegerDigits@#,{a:1...,b:___}/;{b}==-{a}]&

Anonymous function. Takes a number as input and returns True or False as output.