Skip to main content
deleted 29 characters in body
Source Link
FedeWar
  • 291
  • 1
  • 4

GolfScript - 54 52 bytes

1/[{~}/][):a;[3 1]3*[3]+]zip 0\{{*}*+}/10%10\- 10%a= 
  • Input: 33765129
  • Output: 1

If the input is an array the code can be modified to:

~[):a;[3 1]3*[3]+]zip 0\{{*}*+}/10%10\- 10%a= # 45 bytes 
  • Input: [3 3 7 6 5 1 2 9]
  • Output: 1

Explanation

1/[{~}/] # Parse input [):a; # Gets last digit [3 1]3*[3]+ # Generates the vector [3 1 3 1 3 1 3] ]zip # Transposes the vector [[input] [3 1s]] 0\{{*}*+}/ # Vector dot product 10%10\- 10% # (10-ans mod10)mod10 a= # Compare 

GolfScript - 54 52 bytes

1/[{~}/][):a;[3 1]3*[3]+]zip 0\{{*}*+}/10%10\- 10%a= 

Explanation

1/[{~}/] # Parse input [):a; # Gets last digit [3 1]3*[3]+ # Generates the vector [3 1 3 1 3 1 3] ]zip # Transposes the vector [[input] [3 1s]] 0\{{*}*+}/ # Vector dot product 10%10\- 10% # (10-ans mod10)mod10 a= # Compare 

GolfScript - 54 52 bytes

1/[{~}/][):a;[3 1]3*[3]+]zip 0\{{*}*+}/10%10\- 10%a= 
  • Input: 33765129
  • Output: 1

If the input is an array the code can be modified to:

~[):a;[3 1]3*[3]+]zip 0\{{*}*+}/10%10\- 10%a= # 45 bytes 
  • Input: [3 3 7 6 5 1 2 9]
  • Output: 1

Explanation

1/[{~}/] # Parse input [):a; # Gets last digit [3 1]3*[3]+ # Generates the vector [3 1 3 1 3 1 3] ]zip # Transposes the vector [[input] [3 1s]] 0\{{*}*+}/ # Vector dot product 10%10\- 10% # (10-ans mod10)mod10 a= # Compare 
deleted 29 characters in body
Source Link
FedeWar
  • 291
  • 1
  • 4

GolfScriptGolfScript - 5454 52 bytes

1/[{~}/][):a;[3 1]3*[3]+]zip[1]3*[3]+]zip 0\{{*}**+}/]{+}*10%10\10%10\- 10%a= 

Explanation

1/[{~}/] # Parse input [):a; # Gets last digit [3 1]3*[3]+ # Generates the vector [3 1 3 1 3 1 3] ]zip # Transposes the vector [[input] [3 1s]] [0\{{*}**+}/]  # Element-wise product {+}*  #Vector Elementsdot sumproduct 10%10\- 10% # (10-ans mod10)mod10 a= # Compare 

GolfScript - 54 bytes

1/[{~}/][):a;[3 1]3*[3]+]zip[{{*}*}/]{+}*10%10\- 10%a= 

Explanation

1/[{~}/] # Parse input [):a; # Gets last digit [3 1]3*[3]+ # Generates the vector [3 1 3 1 3 1 3] ]zip # Transposes the vector [[input] [3 1s]] [{{*}*}/]  # Element-wise product {+}*  # Elements sum 10%10\- 10% # (10-ans mod10)mod10 a= # Compare 

GolfScript - 54 52 bytes

1/[{~}/][):a;[3 1]3*[3]+]zip 0\{{*}*+}/10%10\- 10%a= 

Explanation

1/[{~}/] # Parse input [):a; # Gets last digit [3 1]3*[3]+ # Generates the vector [3 1 3 1 3 1 3] ]zip # Transposes the vector [[input] [3 1s]] 0\{{*}*+}/ # Vector dot product 10%10\- 10% # (10-ans mod10)mod10 a= # Compare 
Source Link
FedeWar
  • 291
  • 1
  • 4

GolfScript - 54 bytes

1/[{~}/][):a;[3 1]3*[3]+]zip[{{*}*}/]{+}*10%10\- 10%a= 

Explanation

1/[{~}/] # Parse input [):a; # Gets last digit [3 1]3*[3]+ # Generates the vector [3 1 3 1 3 1 3] ]zip # Transposes the vector [[input] [3 1s]] [{{*}*}/] # Element-wise product {+}* # Elements sum 10%10\- 10% # (10-ans mod10)mod10 a= # Compare