code_junkie

Big number in C++

Nov 11th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include "string"
  2. #include "iostream"
  3. #include "bigint/NumberlikeArray.hh"
  4. #include "bigint/BigUnsigned.hh"
  5. #include "bigint/BigInteger.hh"
  6. #include "bigint/BigIntegerAlgorithms.hh"
  7. #include "bigint/BigUnsignedInABase.hh"
  8. #include "bigint/BigIntegerUtils.hh"
  9. using namespace std;
  10.  
  11. int main() {
  12.  
  13. //unsigned long int num = 13195;
  14. //unsigned long long int num = 600851475143;
  15. BigInteger num = 13195;
  16. int divider = 2;
  17.  
  18. //num = 600851475143;
  19.  
  20. while (1) {
  21. if ((num % divider) == 0) {
  22. cout << divider << 'n';
  23. num /= divider;
  24. }
  25. else
  26. divider++;
  27.  
  28. if (num == 1)
  29. break;
  30. }
  31.  
  32.  
  33.  
  34.  
  35. }
  36.  
  37. #include <iostream>
  38.  
  39. int main()
  40. {
  41. long long num = 600851475143LL;
  42.  
  43. std::cout << num;
  44. }
  45.  
  46. unsigned long long int num = 600851475143ULL;
Add Comment
Please, Sign In to add comment