Skip to main content
added 432 characters in body
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94

J, 3232 30 bytes

4=5 12 17+/@e.~[:+/\0,~1+0=7|]

-2 thanks to xash

Try it online!

original explanation

[:(5&e.*12&e.*17={:)[:+/\1+0=7|]

Try it online!

Straightforward:

  • Take list of digits
  • 7|] mod 7
  • 0= equals 0 (returns 1-0 list)
  • 1+ add 1 (now list of 1-2)
  • [:+/\ scan sum
  • [:(5&e.*12&e.*17={:) is 5 an elm and is 12 an elm and is 17 the last?

J, 32 bytes

[:(5&e.*12&e.*17={:)[:+/\1+0=7|]

Try it online!

Straightforward:

  • Take list of digits
  • 7|] mod 7
  • 0= equals 0 (returns 1-0 list)
  • 1+ add 1 (now list of 1-2)
  • [:+/\ scan sum
  • [:(5&e.*12&e.*17={:) is 5 an elm and is 12 an elm and is 17 the last?

J, 32 30 bytes

4=5 12 17+/@e.~[:+/\0,~1+0=7|]

-2 thanks to xash

Try it online!

original explanation

[:(5&e.*12&e.*17={:)[:+/\1+0=7|]

Try it online!

Straightforward:

  • Take list of digits
  • 7|] mod 7
  • 0= equals 0 (returns 1-0 list)
  • 1+ add 1 (now list of 1-2)
  • [:+/\ scan sum
  • [:(5&e.*12&e.*17={:) is 5 an elm and is 12 an elm and is 17 the last?
added 243 characters in body
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94

J, 3632 bytes

3=[[:(5 12&e5&e.+/@,17=*12&e.*17={:)[:+/\1+e.&'07'\1+0=7|]

Try it online!Try it online!

still golfingStraightforward:

  • Take list of digits
  • 7|] mod 7
  • 0= equals 0 (returns 1-0 list)
  • 1+ add 1 (now list of 1-2)
  • [:+/\ scan sum
  • [:(5&e.*12&e.*17={:) is 5 an elm and is 12 an elm and is 17 the last?

J, 36 bytes

3=[:(5 12&e.+/@,17={:)[:+/\1+e.&'07'

Try it online!

still golfing

J, 32 bytes

[:(5&e.*12&e.*17={:)[:+/\1+0=7|]

Try it online!

Straightforward:

  • Take list of digits
  • 7|] mod 7
  • 0= equals 0 (returns 1-0 list)
  • 1+ add 1 (now list of 1-2)
  • [:+/\ scan sum
  • [:(5&e.*12&e.*17={:) is 5 an elm and is 12 an elm and is 17 the last?
Source Link
Jonah
  • 33.8k
  • 4
  • 40
  • 94

J, 36 bytes

3=[:(5 12&e.+/@,17={:)[:+/\1+e.&'07'

Try it online!

still golfing