0 Members and 1 Guest are viewing this topic.
***NECRODOUBLEPOST***It's been awhile since I did anything with this because of so many factors, but I decided to write my tibasic code into C so I could use bigger primes. I made a flowchart to help me figure out what exactly is going on since I haven't touched this in awhile, and for anybody who didn't really know it was that it was doing in the first place. I'm still pursuing this because I have a strong feeling I was onto something, and it would be a great discovery.Also, maybe this topic should be moved under the 'Math and Science' subforums?
You really should mark yes and no on your flow chart. Also, I don't know what ISQRT(p,q) is to know what X is. I also don't know what you assume for P and Q. Also, there are some nodes that have 3 outputs, too.
But how can ISQRT have two inputs?
#include <cmath>#include <cstdio>#include <cstdlib>#include <vector>#define FPART(x) (float)(((float)x)-floor((float)x))inline unsigned int isqrt(unsigned int n) { unsigned int i; for (i = 0; n >= (2*i)+1; n -= (2*i++)+1); return i;}int main(int argc, char *argv[]) { FILE *fp; unsigned int f, p, q, n, x, l; std::vector<unsigned int> xy; f = 1; p = atoi(argv[1]); q = atoi(argv[2]); n = p * q; x = isqrt(n); l = (p > q) ? q : p; for(; FPART(n/x) > FPART(n/(x+1)); --x); for(; x > l-1; ++f, --x) { if (FPART(n/x) > FPART(n/(x+1))) continue; xy.push_back(x); xy.push_back(f); f = 0; } fp = fopen("dataset", "w"); fprintf(fp, "%u %u %zu ", p, q, xy.size()); for (x = 0; x < xy.size(); ++x) fprintf(fp, "%u ", xy[x]); fprintf(fp, "\n"); fclose(fp); return EXIT_SUCCESS;}