; Write in an array of words starting at the address in register RDI the first ; 7 numbers of the Sylvester's sequence, the first of which is 2, and each of ; the next ones is equal to the product of all before it plus 1. option prologue:none, epilogue:none .code sequence proc _sequence proc MOV RAX,1 ; Current number (MUL changes RDX -> it's unusable) .repeat MOV RCX,RAX ; Save S[i-1] - 1 for the next iteration INC RAX ; S[i] = S[i-1] * (S[i-1] - 1) + 1 STOSQ ; Write S[i] into the array MUL RCX ; S[i] = S[i-1] * (S[i-1] - 1) .until (carry?) ; If the high word of the product in RDX != 0, end RET ; Return to the calling function _sequence endp sequence endp end