![]() |
CRG I got gp2c but can't understand where the install is am I missing something ?
|
<table><tr>
<td>2:4</td><td>3:13</td><td>5:38</td><td>7:87</td><td>11:208</td><td>13:377</td><td>17:666</td><td>19:1027</td><td>23:1556</td><td>29:2397</td></tr> <tr><td>31:3358</td><td>37:4727</td><td>41:6408</td><td>43:8257</td><td>47:10466</td><td>53:13275</td><td>59:16756</td><td>61:20477</td><td>67:24966</td><td>71:30007</td></tr> <tr><td>73:35336</td><td>79:41577</td><td>83:48466</td><td>89:56387</td><td>97:65796</td><td>101:75997</td><td>103:86606</td><td>107:98055</td><td>109:109936</td><td>113:122705</td></tr> <tr><td>127:138834</td><td>131:155995</td><td>137:174764</td><td>139:194085</td><td>149:216286</td><td>151:239087</td><td>157:263736</td><td>163:290305</td><td>167:318194</td><td>173:348123</td></tr> <tr><td>179:380164</td><td>181:412925</td><td>191:449406</td><td>193:486655</td><td>197:525464</td><td>199:565065</td><td>211:609586</td><td>223:659315</td><td>227:710844</td><td>229:763285</td></tr> <tr><td>233:817574</td><td>239:874695</td><td>241:932776</td><td>251:995777</td><td>257:1061826</td><td>263:1130995</td><td>269:1203356</td><td>271:1276797</td><td>277:1353526</td><td>281:1432487</td></tr> <tr><td>283:1512576</td><td>293:1598425</td><td>307:1692674</td><td>311:1789395</td><td>313:1887364</td><td>317:1987853</td><td>331:2097414</td><td>337:2210983</td><td>347:2331392</td><td>349:2453193</td></tr> <tr><td>353:2577802</td><td>359:2706683</td><td>367:2841372</td><td>373:2980501</td><td>379:3124142</td><td>383:3270831</td><td>389:3422152</td><td>397:3579761</td><td>401:3740562</td><td>409:3907843</td></tr> <tr><td>419:4083404</td><td>421:4260645</td><td>431:4446406</td><td>433:4633895</td><td>439:4826616</td><td>443:5022865</td><td>449:5224466</td><td>457:5433315</td><td>461:5645836</td><td>463:5860205</td></tr> <tr><td>467:6078294</td><td>479:6307735</td><td>487:6544904</td><td>491:6785985</td><td>499:7034986</td></tr></table> webs.com might give you a subdomain just put it on there and go back to it every so often so the page doesn't get deleted lol |
<table>
<tr><td>907:37464550</td><td>967:44505630</td><td>977:46403000</td><td>991:48351370</td><td>1009:50363460</td><td>1019:52427990</td><td>1217:87283170</td><td>1229:90289340</td><td>1237:93334870</td><td>1697:229106580</td></tr> <tr><td>1753:253003820</td><td>1777:259255630</td><td>1801:272072210</td><td>1823:278675260</td><td>1847:285439230</td><td>1867:292388240</td><td>1873:299397010</td><td>1879:306450780</td><td>1913:320929120</td><td>1933:328394370</td></tr> <tr><td>1993:351728760</td><td>1999:359712770</td><td>2011:367768900</td><td>2039:384220280</td><td>2081:401302380</td><td>2099:418766560</td><td>2113:427687650</td><td>2153:455139960</td><td>2207:474281980</td><td>2221:484112190</td></tr> <tr><td>2239:494129480</td><td>2251:504227530</td><td>2269:514515180</td><td>2281:524884670</td><td>2341:567715390</td><td>2351:578751000</td><td>2371:589928090</td><td>2381:601247380</td><td>2389:612633390</td><td>2399:624115040</td></tr> <tr><td>2417:635769850</td><td>2591:748757620</td><td>2609:762288150</td><td>2621:776006480</td><td>2749:921060460</td><td>3109:1281241630</td><td>3163:1320555770</td><td>3169:1340628220</td><td>3187:1360903950</td><td>3203:1381345640</td></tr> <tr><td>3217:1401992410</td><td>3847:2377194760</td><td>3853:2406870570</td><td>3889:2467010950</td><td>3911:2497571520</td><td>3919:2528272970</td><td>3929:2559099940</td><td>3943:2590099950</td><td>4001:2653335970</td><td>4051:2782862730</td></tr> <tr><td>4091:2849285830</td><td>4099:2882840280</td><td>4127:2916772730</td><td>4133:2950903060</td><td>4153:2985281790</td><td>4159:3019859720</td><td>4201:3054955450</td><td>4217:3090471060</td><td>4373:3458548520</td><td>4397:3497163010</td></tr> <tr><td>4463:3654803370</td><td>4483:3694980020</td><td>5881:8220837810</td><td>6353:10186360510</td><td>6373:10348413530</td><td>6691:11720995930</td><td>6703:11810829540</td><td>6737:11991705640</td><td>6763:12083154930</td><td>6823:12360188400</td></tr> <tr><td>6829:12453431570</td><td>6841:12546920740</td><td>6871:12735433760</td><td>6899:12830405650</td><td>6911:12925874220</td><td>6959:13118696200</td><td>6967:13215690810</td><td>6977:13312964180</td><td>6991:13410600550</td><td>7001:13508572560</td></tr> <tr><td>7019:13607021090</td><td>7039:13705947340</td><td>7079:13905435440</td><td>7109:14006425930</td><td>7127:14107928700</td><td>7193:14416040970</td><td>7211:14519980340</td><td>7219:14624121670</td><td>7237:14728754280</td><td>7699:17648527780</td></tr> <tr><td>7937:19241884950</td><td>7993:19495587370</td><td>8563:23607322390</td><td>8581:23754452280</td><td>8599:23902303490</td><td>8623:24050774500</td><td>8629:24199659270</td><td>8647:24349096760</td><td>8669:24499295890</td><td>8681:24649945980</td></tr> <tr><td>8693:24801012950</td><td>8707:24952497400</td><td>8719:25104434730</td><td>8737:25257000260</td><td>8747:25409915350</td><td>8761:25563285480</td><td>8783:25717497410</td><td>8821:26028138270</td><td>8837:26184217400</td><td>8887:26655322670</td></tr> <tr><td>8951:27133615460</td><td>8969:27294393790</td><td>9851:36170702450</td><td>9859:36365062780</td><td>9883:36560173110</td><td>9901:36755955680</td><td>9931:37149780060</td><td>9973:37546387960</td></tr></table> heres the one I got for axn's code. this isn't exactly A174862 though I'd need to know how to modify it to make a table for that sequence. |
1 Attachment(s)
It's very easy to read html-code here!
Perhaps you should do that like in the attachment! (Delete the extension '.txt'!) |
1 Attachment(s)
thanks I'll write it to a .htm.txt
print1("<table>\n<tr>");d=0;s=0;forprime(p=2,5000,s=s+p^2;d=d+1;print1("<td>"p ":"s"</td>");if(d==10,print1("</tr>\n<tr>");d=0));print1("</tr></table>") that's how I made it. stuff like that. the other thing I wanted to attach was to big even when put to zip it's 1274KB of A024450 |
1274 KB unzipped still was over 400 when zipped/RAR
|
[QUOTE=science_man_88;212701]CRG I'd go with axn's if you don't plan to translate yafu my pari code is worse than axn's from what I have tried. his works faster so you could try that.[/QUOTE]
OK. Here's the gp2c result for [code]gp2c -g del.gp[/code] using code [code]s=0;forprime(p=2,1000,s=s+p^2;if(Mod(s,10)==0, print(p, ":",s)))[/code] [code]/*-*- compile-command: "/usr/bin/gcc -c -o del.gp.o -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -I"/usr/local/include" del.gp.c && /usr/bin/gcc -o del.gp.so -shared -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -Wl,-shared del.gp.o -lc -lm -L"/usr/local/lib" -lpari"; -*-*/ #include <pari/pari.h> /* GP;install("init_del","v","init_del","./del.gp.so"); */ void init_del(void); /*End of prototype*/ static GEN s; /*End of global vars*/ void init_del(void) /* void */ { pari_sp ltop = avma; s = pol_x(fetch_user_var("s")); s = gen_0; { pari_sp btop = avma; long p = 0; byteptr primepointer = diffptr; /* bptr */ if (1000 > maxprime()) pari_err(primer1); for (;;) { NEXT_PRIME_VIADIFF(p, primepointer); if (p > 1000) break; s = gadd(s, sqri(stoi(p))); if (gequal0(gmodulo(s, stoi(10)))) pariprintf("%ld:%Ps\n", p, s); s = gerepileupto(btop, s); } } s = gerepilecopy(ltop, s); return; }[/code] and here's an improved (type-specialized, etc.) version: [code]/*-*- compile-command: "/usr/bin/gcc -c -o del.gp.o -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -I"/usr/local/include" del.gp.c && /usr/bin/gcc -o del.gp.so -shared -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -Wl,-shared del.gp.o -lc -lm -L"/usr/local/lib" -lpari"; -*-*/ #include <pari/pari.h> /* GP;install("init_del","v","init_del","./del.gp.so"); */ void init_del(void); void init_del(void) { pari_sp ltop = avma; GEN s = gen_0; { pari_sp btop = avma; long p = 0; byteptr primepointer = diffptr; /* bptr */ for (;;) { NEXT_PRIME_VIADIFF(p, primepointer); if (p > 1000) break; s = addis(s, p*p); if (!smodis(s, 10)) pariprintf("%ld:%Ps\n", p, s); s = gerepileupto(btop, s); } } s = gerepilecopy(ltop, s); return; }[/code] although technically, [code] /*-*- compile-command: "/usr/bin/gcc -c -o del.gp.o -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -I"/usr/local/include" del.gp.c && /usr/bin/gcc -o del.gp.so -shared -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -Wl,-shared del.gp.o -lc -lm -L"/usr/local/lib" -lpari"; -*-*/ #include <pari/pari.h> /* GP;install("init_del","v","init_del","./del.gp.so"); */ void init_del(void); void init_del(void) /* void */ { pari_printf("907:37464550\n967:44505630\n977:46403000\n991:48351370"); }[/code] is also an optimization... |
wow this is weird I don't find pari.h in my download ( which i haven't figured out how to install). this must be pari C as it seems to use only pari functions that I know of wish i got it in real C I know bytes.com has a forum for these languages but I'd rather be able to translate all this myself lol apparently assembly isn't fastest but can't you compile the C from there or get it fastest possible ?
|
[url]http://bytes.com/topic/c/answers/872854-loop-finding-possible-odd-divisors[/url] this was my first post there ( surprised it wasn't my last) maybe this can be used as the isprime() part of the pari code.
|
[QUOTE=science_man_88;212783]wow this is weird I don't find pari.h in my download[/QUOTE]
It's part of Pari, not part of gp2c. gp2c just creates source code like what I posted. [QUOTE=science_man_88;212783]this must be pari C as it seems to use only pari functions that I know of wish i got it in real C[/QUOTE] C doesn't support large numbers, so you either need to write routines to work with large numbers or use an existing library. In this case the code is using Pari's library. Notice that in my modification of the code I changed the code in several places to do math directly in C rather than through the Pari library, in places where I knew the numbers would be small enough. (Actually for this program everything could be done in C, using Pari only for the list of primes. But that won't typically be the case.) Of course if you know you will be working only with small numbers you might not need the Pari library. But in that case gp2c won't be useful to you. [QUOTE=science_man_88;212783]apparently assembly isn't fastest but can't you compile the C from there or get it fastest possible ?[/QUOTE] The main problem with assembly is not speed but the time it takes to write and read it. Most of the time it's best to write in an easier language with just key parts in assembly. |
[QUOTE=science_man_88;212784]this was my first post there ( surprised it wasn't my last)[/QUOTE]
Your code only works below 2319529. It uses 32-bit signed integers, so even if you added the next 4623 primes you could only use it for numbers up to 2147483647. To check the primes up to 18 quintillion, you would need to change to 64-bit unsigned integers and add 200915556 primes beyond what you'd need for the above. (This would bloat your source code to about 6 gigs if you drop spacing and indentation.) Checking a single (64-bit) number for primality with that algorithm would take about 2 seconds on a 3 GHz machine, so checking up to 18 quintillion would take about a quintillion seconds (most composites will drop out quickly.) Assuming you have a billion computers, this would take about 32 years. Oh, and storing all the primes up to 18 quintillion (as a 64-bit uints) would take 2,953,910 terabytes. At current prices this would run a quarter-billion dollars to buy the storage (maybe less if you just want to rent). [QUOTE=science_man_88;212784]maybe this can be used as the isprime() part of the pari code.[/QUOTE] Pari's code is much faster than yours for large numbers, and a bit faster for small numbers. |
| All times are UTC. The time now is 05:34. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.