Skip to main content
edited body
Source Link
chunes
  • 26.8k
  • 3
  • 24
  • 53

Arturo, 42 bytes

$->a[0x:∑map a\[0..6]=>[&*<=1+]a\7=x%11]

Try it!Try it!

Explanation

$->a[]            ; a function taking a list a
0                 ; push zero, our multiplier, to stack
x:                ; let x be...
∑                 ; sum of...
map a\[0..6]=>[]  ; first seven numbers of input mapped to...
&                 ; current digit...
*                 ; multiplied by...
<=                ; extra copy of...
1+                ; top of stack plus one
a\7=              ; is the last number of input equal to...
x%11              ; x modulo eleven?

Arturo, 42 bytes

$->a[0x:∑map a\[0..6]=>[&*<=1+]a\7=x%11]

Try it!

Explanation

$->a[]            ; a function taking a list a
0                 ; push zero, our multiplier, to stack
x:                ; let x be...
∑                 ; sum of...
map a\[0..6]=>[]  ; first seven numbers of input mapped to...
&                 ; current digit...
*                 ; multiplied by...
<=                ; extra copy of...
1+                ; top of stack plus one
a\7=              ; is the last number of input equal to...
x%11              ; x modulo eleven?

Arturo, 42 bytes

$->a[0x:∑map a\[0..6]=>[&*<=1+]a\7=x%11]

Try it!

Explanation

$->a[]            ; a function taking a list a
0                 ; push zero, our multiplier, to stack
x:                ; let x be...
∑                 ; sum of...
map a\[0..6]=>[]  ; first seven numbers of input mapped to...
&                 ; current digit...
*                 ; multiplied by...
<=                ; extra copy of...
1+                ; top of stack plus one
a\7=              ; is the last number of input equal to...
x%11              ; x modulo eleven?
Source Link
chunes
  • 26.8k
  • 3
  • 24
  • 53

Arturo, 42 bytes

$->a[0x:∑map a\[0..6]=>[&*<=1+]a\7=x%11]

Try it!

Explanation

$->a[]            ; a function taking a list a
0                 ; push zero, our multiplier, to stack
x:                ; let x be...
∑                 ; sum of...
map a\[0..6]=>[]  ; first seven numbers of input mapped to...
&                 ; current digit...
*                 ; multiplied by...
<=                ; extra copy of...
1+                ; top of stack plus one
a\7=              ; is the last number of input equal to...
x%11              ; x modulo eleven?