Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;trying to find the smallest integer such that the numbers 1 through k are all even divisors
- section .text
- global _start
- _start:
- mov ecx,20 ;let's define our 'k'
- mov ebx,1 ;might as well start looking at 1
- next_candidate_number:
- inc ebx ;go ahead and increment ebx
- mov esi,0 ;i know dividing by 1 is a waste of time, it's just prettier this way
- next_divisor:
- inc esi ;this'll set it to 1 in the first iteration before we die of a lack of definition
- cmp esi,ecx ;if our divisor is greater than our target, we can bail
- ja yay_done
- mov eax,ebx ;get ready to divide
- xor edx,edx ;
- div esi ;
- cmp edx,0 ;see if there's a remainder
- jne next_candidate_number ;if there is one, try the next number because this one sucks
- jmp next_divisor
- yay_done:
- mov eax,1
- ;mov ebx,nothing because it's already there!
- int 0x80
Add Comment
Please, Sign In to add comment