Multiplicatively perfect numbers: Difference between revisions

m
→‎{{header|J}}: easier to read
m (→‎{{header|ALGOL 68}}: fix comment)
m (→‎{{header|J}}: easier to read)
Line 325:
For the stretch goal, we need to determine the number of semi-primes, given the number of multiplicatively perfect numbers less than N:
 
<syntaxhighlight lang=J>adjSemiPrime=: + _1 + %: -&(p:inv) 3&%:</syntaxhighlight>
 
Thus (first number in following results is count of multiplicatively perfect numbers, second is count of semiprimes):
 
<syntaxhighlight lang=J> {{ (, (adjSemiPrime &y)+]) +/isMPerfect i.y}} 500
150 153
{{ (, (adjSemiPrime &y)+]) +/isMPerfect i.y}} 5000
1354 1365
{{ (, (adjSemiPrime &y)+]) +/isMPerfect i.y}} 50000
12074 12110
{{ (, (adjSemiPrime &y)+]) +/isMPerfect i.y}} 500000
108223 108326</syntaxhighlight>
 
6,951

edits