Talk:Find largest left truncatable prime in a given base: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "==Hint for base 10, 12, 14 etc== Where the maximum left truncatable prime in a base is say 24 digits or more, to solve this task fully, try using a quick test for probable pri...")
 
Line 4: Line 4:
==Number of left truncatable primes in a given base==
==Number of left truncatable primes in a given base==
You nay wish to keep a count of the number of left truncatable primes in a given base.--[[User:Nigel Galloway|Nigel Galloway]] 11:50, 15 September 2012 (UTC)
You nay wish to keep a count of the number of left truncatable primes in a given base.--[[User:Nigel Galloway|Nigel Galloway]] 11:50, 15 September 2012 (UTC)

I modified the Ruby example to print the number of left truncatable primes by digit count:
<pre>
1 1 1
The largest left truncatable prime in base 3 is 23

2 2 3 3 3 3
The largest left truncatable prime in base 4 is 4091

2 4 4 3 1 1
The largest left truncatable prime in base 5 is 7817

3 4 12 25 44 54 60 62 59 51 35 20 12 7 3 2 1
The largest left truncatable prime in base 6 is 4836525320399

3 6 6 4 1 1 1
The largest left truncatable prime in base 7 is 817337

4 12 29 50 66 77 61 51 38 27 17 8 3 2 1
The largest left truncatable prime in base 8 is 14005650767869

4 9 15 17 24 16 9 6 5 3
The largest left truncatable prime in base 9 is 1676456897

4 8 15 18 15 8 4 2 1
The largest left truncatable prime in base 11 is 2276005673

5 13 20 23 17 11 7 4
The largest left truncatable prime in base 13 is 812751503

For base 10
4 11 39 99 192 326 429 521 545 517 448 354 276 212 ???.

To determine the primality of 9 * 354 = 3186 13 digit numbers took 8 mins.
To determine the primality of 9 * 276 = 2484 14 digit numbers took 17 mins.

I decides that 9 * 212 15 digit numbers is beyond the ability of Ruby's supplied prime? function.
</pre>--[[User:Nigel Galloway|Nigel Galloway]] 12:41, 16 September 2012 (UTC)

Revision as of 12:41, 16 September 2012

Hint for base 10, 12, 14 etc

Where the maximum left truncatable prime in a base is say 24 digits or more, to solve this task fully, try using a quick test for probable primality. Then only test for actual primality with your final candidate.--Nigel Galloway 11:50, 15 September 2012 (UTC)

Number of left truncatable primes in a given base

You nay wish to keep a count of the number of left truncatable primes in a given base.--Nigel Galloway 11:50, 15 September 2012 (UTC)

I modified the Ruby example to print the number of left truncatable primes by digit count:

1 1 1
The largest left truncatable prime in base 3 is 23

2 2 3 3 3 3
The largest left truncatable prime in base 4 is 4091

2 4 4 3 1 1
The largest left truncatable prime in base 5 is 7817

3 4 12 25 44 54 60 62 59 51 35 20 12 7 3 2 1
The largest left truncatable prime in base 6 is 4836525320399

3 6 6 4 1 1 1
The largest left truncatable prime in base 7 is 817337

4 12 29 50 66 77 61 51 38 27 17 8 3 2 1
The largest left truncatable prime in base 8 is 14005650767869

4 9 15 17 24 16 9 6 5 3
The largest left truncatable prime in base 9 is 1676456897

4 8 15 18 15 8 4 2 1
The largest left truncatable prime in base 11 is 2276005673

5 13 20 23 17 11 7 4
The largest left truncatable prime in base 13 is 812751503

For base 10
4 11 39 99 192 326 429 521 545 517 448 354 276 212 ???.

To determine the primality of 9 * 354 = 3186 13 digit numbers took 8 mins.
To determine the primality of 9 * 276 = 2484 14 digit numbers took 17 mins.

I decides that 9 * 212 15 digit numbers is beyond the ability of Ruby's supplied prime? function.

--Nigel Galloway 12:41, 16 September 2012 (UTC)