#include #include int valuation(long long m, long long n) { for (int v=0;; v++) { if (m%n) { return v; } else { m/=n; } } } long long gcd(long long a, long long b) { while (a != 0) { long long c = a; a = b%a; b = c; } return (b<0) ? -b : +b; } #define MAX (1LL<<31) short *numdiv = 0; long long unseen = 1; long long other(long long p) { numdiv[p] = 0; while (unseen < MAX && numdiv[unseen]==0) { unseen++; } for (long long v=unseen; v