Subtract: Difference between revisions

Jump to navigation Jump to search
9 bytes added ,  10:48, 5 November 2019
m
Miraheze>Marshall
(Created page with ":''This page describes the dyadic arithmetic function. For negation of a single argument, see Negate. For subtraction of sets, see Without.'' {{Built-in|Subtract|-}},...")
 
Miraheze>Marshall
Line 28: Line 28:
7
7
</source>
</source>
In the absense of rounding error we have <source lang=apl inline>-/v {{←→}} <source lang=apl inline>+/v×(⍴v)⍴1 ¯1</source> for a [[vector]] <source lang=apl inline>v</source>.
In the absense of rounding error we have <source lang=apl inline>-/v</source> {{←→}} <source lang=apl inline>+/v×(⍴v)⍴1 ¯1</source> for a [[vector]] <source lang=apl inline>v</source>.


An interesting property of the alternating difference is that it can be used as a [[wikipedia:Divisibility rule|divisibility test]] for division by 11, a counterpart to the better-known test for divisibility by 9. A number is divisible by 11 if and only if the sum of its digits is divisible by 11, so repeatedly taking the alternating sum of the digits determines divisibility by 11.
An interesting property of the alternating difference is that it can be used as a [[wikipedia:Divisibility rule|divisibility test]] for division by 11, a counterpart to the better-known test for divisibility by 9. A number is divisible by 11 if and only if the sum of its digits is divisible by 11, so repeatedly taking the alternating sum of the digits determines divisibility by 11.
Anonymous user

Navigation menu