Jump to content

Talk:Twin primes

From Rosetta Code
(Redirected from Talk:Twin Prime Conjecture)

Conjecture?

So... what part of the task is about a conjecture? How is finding twin primes up to a finite number proving / disproving or even exercising Polignac's conjecture? Why is Conjecture even in the task title? --Thundergnat (talk) 11:38, 26 July 2020 (UTC)

Deja vu all over again

Did we not cover and become bored with this with Successive prime differences and Sexy Primes plus a further one the name of which I forget which was deleted as we had had enough?--Nigel Galloway (talk) 14:38, 27 July 2020 (UTC)

Brun's Theorem Extention?

Even though the task currently isn't testing the conjecture, it prompted me to read about the it on the Wikipedia.

I see that that Viggo Brun proved that the sum of the reciprocals of the twin primes converges as the twin primes approach infinity.
Testing this lead to the discovery of the division bug in the early Pentium chips by Thomas Nicely (according the Wikipedia page on Brun's Theorem).

It would be simple to add calculating the sum of the reciprocals of the twin primes. The sum is thought to approximate 1.902.... Apparently convergence is *very* slow. I didn't get very close to that with twins up to 10 000 000.
NB: 5 is the only prime in two twin pairs.

--Tigerofdarkness (talk) 14:53, 27 July 2020 (UTC)

Primesieve is broken for Perl and Raku

Primesieve is broken for Perl and Raku

No Rosetta Code Tasks for Perl or Raku can be executed because I can't install the module.

If this is based on the GitHub Primesieve package, I can't build that one either.

I don't know how to report broken Perl Modules to CPAN

Primesieve.h can't be found.


Excerpt from my attempt to install Primesieve using cpanm (same error using cpan)...

Primesieve.xs:9:10: fatal error: 'primesieve.h' file not found

#include <primesieve.h>

         ^~~~~~~~~~~~~~

1 error generated.

make: *** [Primesieve.o] Error 1

-> FAIL Installing Primesieve failed. Retired Build Engineer (talk) 03:47, 11 December 2023 (UTC)

Primesieve is not broken for Raku. I literally, just yesterday, did a fresh install of Linux Mint, built from source and installed Raku and (among many other modules,) Math::Primesieve, so it was working as of yesterday. Did you follow the Math::Primesieve Readme directions and install the primesieve development package first? It contains the various header files needed for the module to function. sudo apt install libprimesieve-dev for Debian based distributions. --Thundergnat (talk) 22:58, 11 December 2023 (UTC)
concurring here: Perl's xs file in the package wants the C compiler's primesieve package installed first, since that is where compiling C for the Perl package gets that missing header file. You might also want to see if you can find a precompiled CPAN package for your OS. --Wherrera (talk) 02:04, 12 December 2023 (UTC)

Hi All;

 I was able to get Primesieve Perl module installed, but still unable to get Math::Primesieve installed for Raku.
 
 I was logged in to the Raku IRC for sometime and somebody verified that for one of the dependencies for Math::Primesieve had been versioned ahead of the allowed versions Math::Primesieve was expecting.  Therefore the install would fail because that version could not be found.
 
 This problem still exists for me.
 
 I'm on a Mac, not Linux.
 
 --Retired Build Engineer (talk) 02:57, 27 November 2024 (UTC)
Hi Retired Build Engineer, glad to see your interest in trying out the Perl/Raku entries. As for the Math::Primesieve installation, please consult this github issue, opened by Thundergnat at year 2020, for some historical context. Personally I've used this module once only for the "Lucas-Carmichael numbers" task last year. I just followed what SqrtNegInf mentioned in the issue by adding "v12" to Primesieve.rakumod then with a manual install and it worked. Now I try it again today and some of the tests failed. By the way I am using Debian/Sid where everything is bleeding edge so that might be the cause. Anyway if all you need is to run/test this Raku entry and don't mind applying some workarounds I guess it is still possible ..
# install the latest version of Raku and friends
rakubrew build moar
rakubrew switch moar-2024.10
rakubrew build zef
# Test::META shouldn't be necessary but then just for the peace of mind ..
zef install Test::META
# fetch the package
git clone https://github.com/CurtTilmes/raku-primesieve.git
# make a copy of the needful file
cp raku-primesieve/lib/Math/Primesieve.rakumod raku-primesieve/lib/Math/Primesieve.rakumod.orig
# now you should modify and add v12 to the this line "for v12, v9, v8, v7 -> $version" at raku-primesieve/lib/Math/Primesieve.rakumod
# you may reconfirm the modification
diff raku-primesieve/lib/Math/Primesieve.rakumod raku-primesieve/lib/Math/Primesieve.rakumod.orig
# now remove all tests so that you don't need to do a --force-install
rm raku-primesieve/t/*.t
# actual installation 
zef install ./raku-primesieve
If everything goes well you should be able to test this entry without any problem. Otherwise you may also try this repo for Mac where I came across from the IRC conversation you had earlier this month. If you do encounter any error along the way just post it here and we can troubleshoot together. Good luck and have fun. --Hkdtam (talk) 17:07, 28 November 2024 (UTC)

Thank you for the detailed suggestions. I will try to follow them and see if it works.

It would be nice if this were to be fixed so that the workarounds were unnecessary.

Update: Insufficient patience for this. I'm on a Mac with an Mi chip. I'd like to use Raku without needing gynmastics training for the Olympics. I'm too old to do all this legwork.

---Retired Build Engineer (talk) 01:13, 29 November 2024 (UTC)

Cookies help us deliver our services. By using our services, you agree to our use of cookies.