(a - b)(x + y)
Chat with our AI personalities
Recall distributivity a(b + c) = ab + ac = (b + c)a and associativity (ab)c = a(bc) (a + b) + c = a + (b + c) as well as commutativity ab = ba a + b = b + a we are gonna need those. See for yourself when I applied each to learn the trick: ax - bx - ay + yb = (ax - bx) + (-ay + yb) = x(a - b) + -y(a - b) = (x - y)(a - b)
No, unless you're factoring negative numbers. (For example, -36 = -1 x 36.) But a positive number cannot have a factor greater than it. The reason why is that if a larger number times something is a smaller (positive) number, that "something" must be between 0 and 1: a > b > 0 (where a and b are positive whole numbers) ax = b (for some x) Therefore, a > ax > 0. Dividing by a: 1 > x > 0, so x cannot be a whole number.
y = ax^2 + bx + c
This is my program, and it works with all no.s except multiples of 2. org 100h MOV CX,0000H MOV DS,CX MOV SS,CX MOV SI,5000H MOV DI,5002H MOV [ DS:SI ],10H MOV [ DS:DI ],20H MOV SP,600FH MOV BX,[ DS:SI ] CMP BX,[ DS:DI ] JZ E1 JC SMALL THIK: MOV BX,0001H OK: MOV AX,[ DS:SI ] MOV DX,0000H DIV BX CMP DX,0000H JZ L1 L2: INC BX CMP [ DS:DI ],BX JC HCF JMP OK SMALL: MOV AX,[ DS:DI ] MOV [ DS:DI ],BX MOV [ DS:SI ],AX JMP THIK L1: MOV AX,[ DS:DI ] DIV BX CMP DX,0000H JNZ L2 PUSH BX INC CX JMP L2 HCF: MOV AX,0001H AGAIN: POP BX MUL BX DEC CX JNZ AGAIN LCM: MOV BX,AX MOV AX,[ DS:SI ] MUL [ DS:DI ] DIV BX E1 : INC DI INC DI MOV [ DS:DI ],AX ret
a proper factor is a factor.