Skip to main content
Commonmark migration
Source Link

#Pyth, 11 10 bytes

Pyth, 11 10 bytes

!es*V*jT7l 

Accepts input as a list of digits. Try it online here, or verify all test cases at once here.

!es*V*jT7lQQ Implicit: Q=eval(input()) Trailing QQ implied jT7 10 in base 7 - yields [1,3] * lQ Repeat the above len(input) times *V Q Vectorised multiply the above with the input s Take the sum e % 10 ! Logical not 

Edit: saved a byte by replacing ,1 3 with jT7

#Pyth, 11 10 bytes

!es*V*jT7l 

Accepts input as a list of digits. Try it online here, or verify all test cases at once here.

!es*V*jT7lQQ Implicit: Q=eval(input()) Trailing QQ implied jT7 10 in base 7 - yields [1,3] * lQ Repeat the above len(input) times *V Q Vectorised multiply the above with the input s Take the sum e % 10 ! Logical not 

Edit: saved a byte by replacing ,1 3 with jT7

Pyth, 11 10 bytes

!es*V*jT7l 

Accepts input as a list of digits. Try it online here, or verify all test cases at once here.

!es*V*jT7lQQ Implicit: Q=eval(input()) Trailing QQ implied jT7 10 in base 7 - yields [1,3] * lQ Repeat the above len(input) times *V Q Vectorised multiply the above with the input s Take the sum e % 10 ! Logical not 

Edit: saved a byte by replacing ,1 3 with jT7

Saved a byte
Source Link
Sok
  • 6.2k
  • 1
  • 19
  • 30

#Pyth, 1111 10 bytes

!es*V*,1 3les*V*jT7l 

Accepts input as a list of digits. Try it online herehere, or verify all test cases at once herehere.

!es*V*,1 3lQQes*V*jT7lQQ Implicit: Q=eval(input())   Trailing QQ implied ,1jT7 3  10 in base 7 - yields [1,3] *  lQ Repeat the above len(input) times *V  Q Vectorised multiply the above with the input s  Take the sum e  % 10 !  Logical not 

Edit: saved a byte by replacing ,1 3 with jT7

#Pyth, 11 bytes

!es*V*,1 3l 

Accepts input as a list of digits. Try it online here, or verify all test cases at once here.

!es*V*,1 3lQQ Implicit: Q=eval(input())   Trailing QQ implied ,1 3 [1,3] *  lQ Repeat the above len(input) times *V  Q Vectorised multiply the above with the input s  Take the sum e  % 10 !  Logical not 

#Pyth, 11 10 bytes

!es*V*jT7l 

Accepts input as a list of digits. Try it online here, or verify all test cases at once here.

!es*V*jT7lQQ Implicit: Q=eval(input()) Trailing QQ implied jT7   10 in base 7 - yields [1,3] * lQ Repeat the above len(input) times *V Q Vectorised multiply the above with the input s Take the sum e % 10 ! Logical not 

Edit: saved a byte by replacing ,1 3 with jT7

Source Link
Sok
  • 6.2k
  • 1
  • 19
  • 30

#Pyth, 11 bytes

!es*V*,1 3l 

Accepts input as a list of digits. Try it online here, or verify all test cases at once here.

!es*V*,1 3lQQ Implicit: Q=eval(input()) Trailing QQ implied ,1 3 [1,3] * lQ Repeat the above len(input) times *V Q Vectorised multiply the above with the input s Take the sum e % 10 ! Logical not