RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g)
07-03-2019, 10:33 PM
Post: #21
 Claudio L. Senior Member Posts: 1,883 Joined: Dec 2013
RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g)
(07-03-2019 08:00 PM)Gerson W. Barbosa Wrote:  Thank you all for your interest, comments and great contributions!

Wait, wait!

I have 2 more... neither will be winners of anything, just different approaches to those presented before.

The first one is literal translation of the algorithm you just revealed, except 'q' counts with step 1 and NEXTPRIME is done in pairs:
Code:
 «   0 SWAP 2 0 ROT START     SWAP OVER 0 PICK3     START       NEXTPRIME NEXTPRIME     NEXT     SWAP 1 + SWAP    NEXT   DROP →LIST  »

The second one is inspired by the OEIS website, where it shows the highest number is ithPrime(k^2+k+1), so we can just do NEXTPRIME k^2+k+1 times, but keeping (with DUP) just the ones we are interested in, that have an index 'i' of the form 'i^2+i+1':
Code:
 «   0 →      i « 1 + DUPDUP *     + 2 1 ROT     FOR 'K'       IF i DUPDUP * +       1 + K == THEN         DUP 1 'i' STO+       END       NEXTPRIME      NEXT     DROP i →LIST    » »
 « Next Oldest | Next Newest »

 Messages In This Thread RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 06-30-2019, 08:41 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 06-30-2019, 08:53 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Valentin Albillo - 06-30-2019, 09:10 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 06-30-2019, 11:05 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Thomas Okken - 06-30-2019, 11:57 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 07-01-2019, 12:28 AM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 07-01-2019, 04:49 AM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Didier Lachieze - 07-01-2019, 11:13 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 07-02-2019, 12:07 AM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Paul Dale - 07-01-2019, 12:25 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Didier Lachieze - 07-01-2019, 01:44 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - John Keith - 07-01-2019, 12:49 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Claudio L. - 07-01-2019, 01:52 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - John Keith - 07-01-2019, 05:05 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 07-01-2019, 05:20 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Claudio L. - 07-01-2019, 09:45 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Paul Dale - 07-02-2019, 12:40 AM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - DavidM - 07-02-2019, 02:21 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - DavidM - 07-03-2019, 05:05 AM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 07-03-2019, 08:00 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Claudio L. - 07-03-2019 10:33 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Gerson W. Barbosa - 07-04-2019, 03:17 AM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - DavidM - 07-04-2019, 08:21 PM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Claudio L. - 07-05-2019, 02:45 AM RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Paul Dale - 07-05-2019, 09:47 AM

User(s) browsing this thread: 1 Guest(s)