Skip to main content
Golfed 1 byte, added ATO link
Source Link
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Pip -x, 20 1414 13 bytes

L#al+Lgl+:lPE!ll=all=g 

Try it here! TIO doesn't support the -x flag, but you can simulate it using Takes the header:list of numbers as separate command-line arguments. Try it online!Attempt This Online!

Explanation

We generate the nth row of Pascal's triangle, where n is the length of the input list; then we output truthy if the row and the input are equal, falsey otherwise. Heavily based on my answer to Generate Pascal's triangle, which I recommend you read for a better explanation of the core algorithm.

  ag is 1st cmdline arg,list evaluatedof (-xcmdline flag);args; l is empty list L  Loop #ag len(ag) times:   !l 1 if l is empty, 0 otherwise   lPE l with that value prepended   l+: Add to l itemwise and assign back to l   l=al=g 1 if l equals ag, 0 otherwise 

Pip -x, 20 14 bytes

L#al+:lPE!ll=a 

Try it here! TIO doesn't support the -x flag, but you can simulate it using the header: Try it online!

Explanation

We generate the nth row of Pascal's triangle, where n is the length of the input list; then we output truthy if the row and the input are equal, falsey otherwise. Heavily based on my answer to Generate Pascal's triangle, which I recommend you read for a better explanation of the core algorithm.

  a is 1st cmdline arg, evaluated (-x flag); l is empty list L  Loop #a len(a) times:   !l 1 if l is empty, 0 otherwise   lPE l with that value prepended   l+: Add to l itemwise and assign back to l   l=a 1 if l equals a, 0 otherwise 

Pip, 20 14 13 bytes

Lgl+:lPE!ll=g 

Takes the list of numbers as separate command-line arguments. Attempt This Online!

Explanation

We generate the nth row of Pascal's triangle, where n is the length of the input list; then we output truthy if the row and the input are equal, falsey otherwise. Heavily based on my answer to Generate Pascal's triangle, which I recommend you read for a better explanation of the core algorithm.

 g is list of cmdline args; l is empty list L Loop g len(g) times: !l 1 if l is empty, 0 otherwise lPE l with that value prepended l+: Add to l itemwise and assign back to l l=g 1 if l equals g, 0 otherwise 
Golfed 6 bytes
Source Link
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Pip -x, 2020 14 bytes

W@a=1&a>ll+L#al+:lPE!ll=a 

Try it here! TIO doesn't support the -x flag, but you can simulate it using the header: Try it online!Try it online!

Explanation

If the input list starts with a 1, weWe generate rowsthe nth row of Pascal's triangle until a row, where n is numerically greater than or equal tothe length of the input list; then we output truthy if the row and the input are equal, falsey otherwise. Heavily based on my answer to Generate Pascal's triangle, which I recommend you read for a better explanation of the core algorithm.

  a is 1st cmdline arg, evaluated (-x flag); l is empty list W L Loop while  @a=1  #a the first element of a equals 1 len(necessary to prevent infinite loop) &a>l and a is greater than l (current row) times:   !l 1 if l is empty, 0 otherwise   lPE l with that value prepended   l+: Add to l itemwise and assign back to l   l=a 1 if l equals a, 0 otherwise 

Pip -x, 20 bytes

W@a=1&a>ll+:lPE!ll=a 

Try it here! TIO doesn't support the -x flag, but you can simulate it using the header: Try it online!

Explanation

If the input list starts with a 1, we generate rows of Pascal's triangle until a row is numerically greater than or equal to the input list; then we output truthy if the row and the input are equal, falsey otherwise. Heavily based on my answer to Generate Pascal's triangle, which I recommend you read for a better explanation of the core algorithm.

  a is 1st cmdline arg, evaluated (-x flag); l is empty list W  Loop while  @a=1  the first element of a equals 1 (necessary to prevent infinite loop) &a>l and a is greater than l (current row):   !l 1 if l is empty, 0 otherwise   lPE l with that value prepended   l+: Add to l itemwise and assign back to l   l=a 1 if l equals a, 0 otherwise 

Pip -x, 20 14 bytes

L#al+:lPE!ll=a 

Try it here! TIO doesn't support the -x flag, but you can simulate it using the header: Try it online!

Explanation

We generate the nth row of Pascal's triangle, where n is the length of the input list; then we output truthy if the row and the input are equal, falsey otherwise. Heavily based on my answer to Generate Pascal's triangle, which I recommend you read for a better explanation of the core algorithm.

 a is 1st cmdline arg, evaluated (-x flag); l is empty list L Loop #a len(a) times: !l 1 if l is empty, 0 otherwise lPE l with that value prepended l+: Add to l itemwise and assign back to l l=a 1 if l equals a, 0 otherwise 
Source Link
DLosc
  • 40.7k
  • 6
  • 87
  • 142

Pip -x, 20 bytes

W@a=1&a>ll+:lPE!ll=a 

Try it here! TIO doesn't support the -x flag, but you can simulate it using the header: Try it online!

Explanation

If the input list starts with a 1, we generate rows of Pascal's triangle until a row is numerically greater than or equal to the input list; then we output truthy if the row and the input are equal, falsey otherwise. Heavily based on my answer to Generate Pascal's triangle, which I recommend you read for a better explanation of the core algorithm.

 a is 1st cmdline arg, evaluated (-x flag); l is empty list W Loop while @a=1 the first element of a equals 1 (necessary to prevent infinite loop) &a>l and a is greater than l (current row): !l 1 if l is empty, 0 otherwise lPE l with that value prepended l+: Add to l itemwise and assign back to l l=a 1 if l equals a, 0 otherwise