Go Back > Extra Stuff > Miscellaneous Math

Thread Tools
Old 2020-09-09, 03:53   #56
Romulan Interpreter
LaurV's Avatar
Jun 2011

34·113 Posts

Originally Posted by mart_r View Post
one in Pari... I'm not yet familiar with coding in Perl or C
Man, if you wrote such thing in pari, then you are already "familiar" with C more than you imagine. You can give it a try using either libpari or gwnum, to avoid implementing some things from scratch (but sieving and such, there are a lot of functions and ready-made implementations already). C is extremely simple, only few instructions to learn, haha, it will be the OS you will have to struggle with (like, writing C for Windows or for Linux may be sometimes two different worlds). But you don't know until you try. Give it a try, and there are many guys here who can help you (me included). Just ask.

Perl, on the other hand, is a different animal. It took me some time and effort to learn to deal with regex-es, even after 20 or 30 years of programming experience, and even so, I never wrote more than few scripts in Perl (and I consider myself a very strong programmer in C, many flavors of assembler, Pascal, Fortran, Basic, Lisp). Of course, your mileage may vary, some people here (like Chalsall and DanaJ, who both of them eat Perl on butter every morning for breakfast, I assume) will tell you a different story.

But you have to try first. While you don't buy that lottery ticket, you can't win.

Last fiddled with by LaurV on 2020-09-09 at 04:00
LaurV is offline   Reply With Quote
Old 2020-09-10, 17:54   #57
Jul 2014

1000002 Posts

To test the correctness of your implementation, first search for known large Twins (I assume that's what your looking for) to verify it finds them. Once you know the structure of the program is correct you can use any generator you want, dependent upon the capacity of your hardware to accommodate it.

If you use P23 or P29 you ideally want as many parallel threads as possible. GPUs would be very nice to use in this case, though a Super Computer would be the most ideal platform, more for its memory capacity than just pure speed and threads.

If you are concerned about speed, you need to use a compiled language that has good/mature multi-threading capability, though you can use Perl, etc, to code a proof-of-concept design to get working. All my original coding was done in Ruby, which allowed my to easily and quickly play with different implementations. I then translated that code into Rust, Nim, Crystal, and D multi-threaded versions, and tested their results to Ruby.

First, study my code to know exactly what and why its doing. Then start slow. Know what and why the results should be at each stage of your code for each section. The algorithm is very simple, if you understand it. Once you do, you can run it on any platform in your language(s) of choice.

If you need help post code on git[hub|lab], or a gist, or email me.
jzakiya is offline   Reply With Quote
Old 2020-10-24, 14:20   #58
Jul 2014

25 Posts

There's a Rust forum post (2020/10/22) about a package to use Rust on GPUs.

I don't have a GPU, so I don't have the hardware to play with it.
For those who do, this package should (?) provide the basics to implement the algorithm on GPUs, which (if properly done) increase performance significantly, while extending the number space range too.
jzakiya is offline   Reply With Quote

Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Twin Prime Constellations robert44444uk Prime Gap Searches 21 2019-06-09 12:51
How do you efficiently sieve for prime 3/4-tuples? Puzzle-Peter Software 156 2019-06-03 20:19
find very easy twin prime in the infamy twin primes hal1se Miscellaneous Math 13 2018-11-05 16:34
Highest Prime is also a twin prime... NOT hydeer Lone Mersenne Hunters 9 2018-04-03 22:54
Twin Prime Days, Prime Day Clusters cuBerBruce Puzzles 3 2014-12-01 18:15

All times are UTC. The time now is 14:58.

Sat Jan 23 14:58:53 UTC 2021 up 51 days, 11:10, 0 users, load averages: 1.50, 2.00, 2.21

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.