Merge continued

git-svn-id: svn://ultimatepp.org/upp/trunk@10263 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-10-04 08:34:39 +00:00
parent adf46bd64e
commit 2e4b276e07
3860 changed files with 1161787 additions and 438 deletions

View file

@ -0,0 +1,30 @@
#include <Core/Core.h>
using namespace Upp;
bool IsPrime(unsigned q)
{
for(int i = 2; i * i < q; i++)
if((q % i) == 0)
return false;
return true;
}
CONSOLE_APP_MAIN
{
int q = 32;
while(q) {
for(int w = 1; w < 256; w += w)
if(IsPrime(w + q - 1)) {
LOG(q << "+" << w - 1 << "=" << w + q - 1);
break;
}
for(int w = 1; w < 256; w += w)
if(IsPrime(w + q - 1)) {
LOG(q << "+" << w - 1 << "=" << w + q - 1);
break;
}
q = 2 * q;
}
}