Created
February 16, 2014 14:58
-
-
Save suut/9035580 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Jacobi.hpp" | |
| void Jacobi::fac2(uintmax_t n, uintmax_t &a, uintmax_t &b) | |
| { | |
| uintmax_t ret_a = 0; | |
| uintmax_t ret_b = n; | |
| while((ret_b&1) == 0) | |
| { | |
| ret_b = ret_b >> 1; | |
| ret_a++; | |
| } | |
| a = ret_a; | |
| b = ret_b; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| class Jacobi | |
| { | |
| public: | |
| static void fac2(uintmax_t n, uintmax_t &a, uintmax_t &b); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include "Jacobi.hpp" | |
| using namespace std; | |
| int main(int argc, char **argv) | |
| { | |
| uintmax_t ret_a; | |
| uintmax_t ret_b; | |
| uintmax_t n = 1872; | |
| Jacobi::fac2(n, ret_a, ret_b); | |
| cout << "2^" << ret_a << " * " << ret_b << endl; | |
| return(0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment