How to resolve the algorithm Sequence: nth number with exactly n divisors step by step in the J programming language

Published on 12 May 2024 09:40 PM
#J

How to resolve the algorithm Sequence: nth number with exactly n divisors step by step in the J programming language

Table of Contents

Problem Statement

Calculate the sequence where each term an is the nth that has n divisors. Show here, on this page, at least the first 15 terms of the sequence.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sequence: nth number with exactly n divisors step by step in the J programming language

Source code in the j programming language

A073916=: {{
  if.1 p: y do. (p:^x:)y-1 return.
  elseif.1|y do.
    f= *:
  else.
    f=. ]
  end. r=.i.0
  off=. 1
  while. y>#r do.
    r=. r,f off+I.y=*/|:1+_ q:f off+i.y
    off=. off+y
  end.
  (y-1){r
}}"0


   (,. A073916) 1+i.20
 1                                 1
 2                                 3
 3                                25
 4                                14
 5                             14641
 6                                44
 7                          24137569
 8                                70
 9                              1089
10                               405
11                   819628286980801
12                               160
13              22563490300366186081
14                              2752
15                              9801
16                               462
17     21559177407076402401757871041
18                              1044
19 740195513856780056217081017732809
20                              1520


  

You may also check:How to resolve the algorithm Hello world/Text step by step in the Pure programming language
You may also check:How to resolve the algorithm Multiple distinct objects step by step in the Oforth programming language
You may also check:How to resolve the algorithm Averages/Median step by step in the C# programming language
You may also check:How to resolve the algorithm JortSort step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Classes step by step in the Bracmat programming language