Sequence: nth number with exactly n divisors: Difference between revisions
Content added Content deleted
(Add Factor example) |
(→{{header|Factor}}: fix prime function, update output) |
||
Line 16: | Line 16: | ||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
This makes use of most of the optimizations discussed in the |
This makes use of most of the optimizations discussed in the Go example. |
||
<lang factor>USING: combinators formatting fry kernel lists lists.lazy |
<lang factor>USING: combinators formatting fry kernel lists lists.lazy |
||
lists.lazy.examples math math.functions math.primes |
lists.lazy.examples literals math math.functions math.primes |
||
math.primes.factors math.ranges sequences ; |
math.primes.factors math.ranges sequences ; |
||
IN: rosetta-code.nth-n-div |
IN: rosetta-code.nth-n-div |
||
: |
CONSTANT: primes $[ 100 nprimes ] |
||
: prime ( m -- n ) 1 - [ primes nth ] [ ^ ] bi ; |
|||
: (non-prime) ( m quot -- n ) |
: (non-prime) ( m quot -- n ) |
||
Line 51: | Line 53: | ||
1 : 1 |
1 : 1 |
||
2 : 3 |
2 : 3 |
||
3 : |
3 : 25 |
||
4 : 14 |
4 : 14 |
||
5 : |
5 : 14641 |
||
6 : 44 |
6 : 44 |
||
7 : |
7 : 24137569 |
||
8 : 70 |
8 : 70 |
||
9 : 1089 |
9 : 1089 |
||
10 : 405 |
10 : 405 |
||
11 : |
11 : 819628286980801 |
||
12 : 160 |
12 : 160 |
||
13 : 22563490300366186081 |
|||
13 : 6582952005840035281 |
|||
14 : 2752 |
14 : 2752 |
||
15 : 9801 |
15 : 9801 |
||
16 : 462 |
16 : 462 |
||
17 : 21559177407076402401757871041 |
|||
17 : 3876269050118516845397872321 |
|||
18 : 1044 |
18 : 1044 |
||
19 : 740195513856780056217081017732809 |
|||
19 : 136753052840548005895349735207881 |
|||
20 : 1520 |
20 : 1520 |
||
21 : 141376 |
21 : 141376 |
||
22 : 84992 |
22 : 84992 |
||
23 : 1658509762573818415340429240403156732495289 |
|||
23 : 559494740587480879172162808385362976196641 |
|||
24 : 1170 |
24 : 1170 |
||
25 : 52200625 |
25 : 52200625 |
||
Line 77: | Line 79: | ||
27 : 52900 |
27 : 52900 |
||
28 : 9152 |
28 : 9152 |
||
29 : 1116713952456127112240969687448211536647543601817400964721 |
|||
29 : 664883836375406516433586250657527435394385613490936917201 |
|||
30 : 6768 |
30 : 6768 |
||
31 : 1300503809464370725741704158412711229899345159119325157292552449 |
|||
31 : 39115897957341730208009052194412390955771656152457329084502049 |
|||
32 : 3990 |
32 : 3990 |
||
33 : 12166144 |
33 : 12166144 |
||
Line 85: | Line 87: | ||
35 : 446265625 |
35 : 446265625 |
||
36 : 5472 |
36 : 5472 |
||
37 : 11282036144040442334289838466416927162302790252609308623697164994458730076798801 |
|||
37 : 2774406559237649514373597245387098526607420602299133512933658553632174767930401 |
|||
38 : 43778048 |
38 : 43778048 |
||
39 : 90935296 |
39 : 90935296 |
||
40 : 10416 |
40 : 10416 |
||
41 : 1300532588674810624476094551095787816112173600565095470117230812218524514342511947837104801 |
|||
41 : 332540178180616289194509686159107063111500537850642030367642480439906210197179331394602401 |
|||
42 : 46400 |
42 : 46400 |
||
43 : 635918448514386699807643535977466343285944704172890141356181792680152445568879925105775366910081 |
|||
43 : 66450789401396266861985003360578832766171215212266995967429417229964093893359523047678782463961 |
|||
44 : 240640 |
44 : 240640 |
||
45 : 327184 |
45 : 327184 |