Talk:Find prime numbers of the form n*n*n+2

From Rosetta Code

"where 0 < n" Why is that ? n==0 produces a prime.--Steenslag (talk) 23:17, 11 March 2023 (UTC)

Also perhaps worth asking why this is a task at all. We already have quite a number of "find prime numbers" tasks, so this one isn't very interesting. --Rdm (talk) 05:19, 16 March 2023 (UTC)

Perl solution fails due to missing is_prime subroutine

Perl solution fails due to missing is_prime subroutine.

No mention of an is_prime subroutine to be found elsewhere on Rosetta Code.

Retired Build Engineer

I have not actually run the Perl example, but I noted that the function is in Math::AnyNum, imported by the code it seems. See https://metacpan.org/pod/Math::AnyNum. --Wherrera (talk) 16:35, 12 September 2024 (UTC)

The error I get is:

Can't locate object method "is_prime" via package "3" (perhaps you forgot to load "3"?) at ./find_prime_numbers_of_the_form_n^3+2.pl line 6.

Perhaps the use clause needs to be above the call?

In any case, the code, as is, fails.

Retired Build Engineer

In my local copy of the script, I moved the use clause above the call to the is_prime subroutine, and it works. (Using Perl 5.38.0)

Retired Build Engineer

Great! Are you going to update the Perl solution, then ? --Tigerofdarkness (talk) 21:53, 12 September 2024 (UTC)

Yes :-)

Thanks for the observation and the edit :) --Wherrera (talk) 01:52, 13 September 2024 (UTC)