Skip to content

rsamanez/BigFactorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BigFactorial

This program was made in assembler x64 and can calculate the factorial up to 40000

Algorithm

multiply(a[1..p], b[1..q], base)                            // Operands containing rightmost digits at index 1
  product = [1..p+q]                                        // Allocate space for result
  for b_i = 1 to q                                          // for all digits in b
    carry = 0
    for a_i = 1 to p                                        // for all digits in a
      product[a_i + b_i - 1] += carry + a[a_i] * b[b_i]
      carry = product[a_i + b_i - 1] / base
      product[a_i + b_i - 1] = product[a_i + b_i - 1] mod base
    product[b_i + p] = carry                               // last digit comes from final carry
  return product

How to Compile and RUN

Compile with:
     nasm -f elf64 -o bigFactorialNumber64.o bigFactorialNumber64.asm
Link with:
     ld -m elf_x86_64 -o bigFactorialNumber64 bigFactorialNumber64.o
Run with:
     ./bigFactorialNumber64

About

Assembler x64 Calculate factorial up to 40000

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published