Skip to main content
Rollback to Revision 4
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661

Haskell, 25 bytes

f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Haskell, 36 31 26 bytes

f[1]=1
f(1:b)=f$scanr1(-)b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 32 bytes

f[1]=1
f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr1(-) to calculate what the layer above would have to be in order to produce the input, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of Pascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

Haskell, 25 bytes

f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Haskell, 36 31 26 bytes

f[1]=1
f(1:b)=f$scanr1(-)b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 32 bytes

f[1]=1
f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr1(-) to calculate what the layer above would have to be in order to produce the input, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of Pascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

Haskell, 36 31 26 bytes

f[1]=1
f(1:b)=f$scanr1(-)b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 32 bytes

f[1]=1
f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr1(-) to calculate what the layer above would have to be in order to produce the input, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of Pascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

added 317 characters in body
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661

Haskell, 25 bytes

f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Haskell, 36 31 26 bytes

f[1]=1
f(1:b)=f$scanr1(-)b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 32 bytes

f[1]=1
f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr1(-) to calculate what the layer above would have to be in order to produce the input, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of Pascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

Haskell, 36 31 26 bytes

f[1]=1
f(1:b)=f$scanr1(-)b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 32 bytes

f[1]=1
f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr1(-) to calculate what the layer above would have to be in order to produce the input, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of Pascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

Haskell, 25 bytes

f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Haskell, 36 31 26 bytes

f[1]=1
f(1:b)=f$scanr1(-)b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 32 bytes

f[1]=1
f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr1(-) to calculate what the layer above would have to be in order to produce the input, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of Pascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

added 102 characters in body
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661

Haskell, 36 3131 26 bytes

f[1]=1
f(1:b)=f$init$scanr=f$scanr1(-)0bb

Try it online!Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 3737 32 bytes

f[1]=1
f(1:b)=f$init$scanr=f$scanr1(-)0bb
f _=0

Try it online!Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanrscanr1(-) to calculate what the layer above would have to be in order to produce the input, then we remove the zero at the end with init, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of the fibonacciPascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

Haskell, 36 31 bytes

f[1]=1
f(1:b)=f$init$scanr(-)0b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 bytes

f[1]=1
f(1:b)=f$init$scanr(-)0b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr(-) to calculate what the layer above would have to be in order to produce the input, then we remove the zero at the end with init, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of the fibonacci triangle. And if we encounter something starting with something other than 1 we halt with no.

Haskell, 36 31 26 bytes

f[1]=1
f(1:b)=f$scanr1(-)b

Try it online!

This version errors as a false indicator and returns 1 as the true indicator. It's short but I generally find these sorts of answers a little cheaty so below I have a version with a more traditional output method:

42 37 32 bytes

f[1]=1
f(1:b)=f$scanr1(-)b
f _=0

Try it online!

Outputs 1 for yes and 0 for no.

This is I believe the only answer here using this method. We use scanr1(-) to calculate what the layer above would have to be in order to produce the input, and check if that new smaller layer holds. If we encounter [1] we halt with yes, because that is the first layer of Pascal's triangle. And if we encounter something starting with something other than 1 we halt with no.

added 290 characters in body
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661
Loading
deleted 23 characters in body
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661
Loading
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661
Loading