Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 135 characters in body
Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61

Husk, (削除) 18 (削除ここまで) (削除) 17 (削除ここまで) (削除) 14 (削除ここまで) 13(削除) 13 (削除ここまで) 12 bytes

Edit: -3 bytes, and then another -1 byte, thanks to Leo, and -1 byte thanks to inspiration from pajonk's R answer (3rd edit)

1ドルmΠ†dfṁ→m1⁄2Pd1ドルmΠ†dm1⁄2f→Pd

Try it online! Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

Commented penultimate version:

1ドル # index of input if present, zero otherwise, in
 mΠ # products of each element-pair
 †d # combining digits as a number from
 m1⁄2 # first & second halves of
 P # all permutations of
 d # digits of input;
 f # and filtering only element-pairs for which
 ṁ→ # sum of last digits is nonzero

Husk, (削除) 18 (削除ここまで) (削除) 17 (削除ここまで) (削除) 14 (削除ここまで) 13 bytes

Edit: -3 bytes, and then another -1 byte, thanks to Leo

1ドルmΠ†dfṁ→m1⁄2Pd

Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

1ドル # index of input if present, zero otherwise, in
 mΠ # products of each element-pair
 †d # combining digits as a number from
 m1⁄2 # first & second halves of
 P # all permutations of
 d # digits of input;
 f # and filtering only element-pairs for which
 ṁ→ # sum of last digits is nonzero

Husk, (削除) 18 (削除ここまで) (削除) 17 (削除ここまで) (削除) 14 (削除ここまで) (削除) 13 (削除ここまで) 12 bytes

Edit: -3 bytes, and then another -1 byte, thanks to Leo, and -1 byte thanks to inspiration from pajonk's R answer (3rd edit)

1ドルmΠ†dm1⁄2f→Pd

Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

Commented penultimate version:

1ドル # index of input if present, zero otherwise, in
 mΠ # products of each element-pair
 †d # combining digits as a number from
 m1⁄2 # first & second halves of
 P # all permutations of
 d # digits of input;
 f # and filtering only element-pairs for which
 ṁ→ # sum of last digits is nonzero
added 31 characters in body
Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61

Husk, (削除) 18 (削除ここまで) 17(削除) 17 (削除ここまで)(削除) 14 (削除ここまで) 13 bytes

Edit: -3 bytes, and then another -1 byte, thanks to Leo

1ドルmoΠmdfo→Fz+m1⁄2Pd1ドルmΠ†dfṁ→m1⁄2Pd

Try it online! Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

1ドル # index of input if present, zero otherwise, in
 moΠ # products of each element-pair
 †d md # combining digits as a number from
 m1⁄2 m1⁄2 # first & second halves of
 P P # all permutations of
 d d # digits of input;
 f # and filtering only element-pairs for which
 ṁ→ o→Fz+ # last element # sum of zippedlast sumsdigits is nonzero

Husk, (削除) 18 (削除ここまで) 17 bytes

1ドルmoΠmdfo→Fz+m1⁄2Pd

Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

1ドル # index of input if present, zero otherwise, in
 moΠ # products of each element-pair
 md # combining digits as a number from
 m1⁄2 # first & second halves of
 P # all permutations of
 d # digits of input;
 f # and filtering only element-pairs for which
 o→Fz+ # last element of zipped sums is nonzero

Husk, (削除) 18 (削除ここまで) (削除) 17 (削除ここまで)(削除) 14 (削除ここまで) 13 bytes

Edit: -3 bytes, and then another -1 byte, thanks to Leo

1ドルmΠ†dfṁ→m1⁄2Pd

Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

1ドル # index of input if present, zero otherwise, in
  # products of each element-pair
 †d # combining digits as a number from
 m1⁄2 # first & second halves of
 P # all permutations of
 d # digits of input;
 f # and filtering only element-pairs for which
 ṁ→  # sum of last digits is nonzero
deleted 66 characters in body
Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61

Husk, (削除) 18 (削除ここまで) 17 bytes

1ドルmoΠmdfo→Fz+m1⁄2Pd

Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

1ドル # index of input if present, zero otherwise, in
 moΠ # products of each element-pair of
 mom  # results of mapping these functions:
 md d # combining digits #as combinea digitsnumber infrom
 1⁄2m1⁄2 # first & second halves
 # across all elements of:
 P # all permutations of
 d # digits of input;
 f f # and filtering only element-pairs for which
 F¤|%10 o→Fz+ # onelast orelement otherof iszipped nonzerosums modulois 10nonzero

Husk, (削除) 18 (削除ここまで) 17 bytes

1ドルmoΠmdfo→Fz+m1⁄2Pd

Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

1ドル # index of input if present, zero otherwise, in
  # products of each element-pair of
 mom  # results of mapping these functions:
  d # combine digits in
 1⁄2 # first & second halves
 # across all elements of:
 P # all permutations of
 d # digits of input;
 f # and filtering only element-pairs for which
 F¤|%10 # one or other is nonzero modulo 10

Husk, (削除) 18 (削除ここまで) 17 bytes

1ドルmoΠmdfo→Fz+m1⁄2Pd

Try it online!

Outputs nonzero integer if it's a vampire number, zero otherwise.

1ドル # index of input if present, zero otherwise, in
 moΠ # products of each element-pair
 md # combining digits as a number from
 m1⁄2 # first & second halves of
 P # all permutations of
 d # digits of input;
 f # and filtering only element-pairs for which
 o→Fz+ # last element of zipped sums is nonzero
added 9 characters in body
Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61
Loading
added 537 characters in body
Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61
Loading
Source Link
Dominic van Essen
  • 37.2k
  • 2
  • 24
  • 61
Loading

AltStyle によって変換されたページ (->オリジナル) /