How to resolve the algorithm Sequence of primorial primes step by step in the J programming language

Published on 12 May 2024 09:40 PM
#J

How to resolve the algorithm Sequence of primorial primes step by step in the J programming language

Table of Contents

Problem Statement

The sequence of primorial primes is given as the increasing values of n where primorial(n) ± 1 is prime. Noting that the n'th primorial is defined as the multiplication of the smallest n primes, the sequence is of the number of primes, in order that when multiplied together is one-off being a prime number itself.

Generate and show here the first ten values of the sequence.

Show the first twenty members of the series.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sequence of primorial primes step by step in the J programming language

Source code in the j programming language

primoprim=: [: I. [: +./ 1 p: (1,_1) +/ */\@:p:@i.


   primoprim 600x
0 1 2 3 4 5 10 12 23 65 67 74 166 170 171 286 309 351 383 456 563 589


  

You may also check:How to resolve the algorithm Amicable pairs step by step in the Phixmonti programming language
You may also check:How to resolve the algorithm Array concatenation step by step in the Factor programming language
You may also check:How to resolve the algorithm Sum of a series step by step in the Sidef programming language
You may also check:How to resolve the algorithm Read a specific line from a file step by step in the Phix programming language
You may also check:How to resolve the algorithm Pick random element step by step in the ReScript programming language