Chowla numbers: Difference between revisions

Content added Content deleted
(→‎{{header|J}}: simpler)
Line 517: Line 517:
=={{header|J}}==
=={{header|J}}==
'''Solution:'''
'''Solution:'''
<lang j>uniqFactors=: (}.@i.@# -.&0@~.@,@(*/\ , */\.) ])@q:
<lang j>chowla=: >: -~ >:@#.~/.~&.q: NB. sum of factors - (n + 1)
chowla=: +/@uniqFactors


intsbelow=: (2 }. i.)"0
intsbelow=: (2 }. i.)"0
Line 563: Line 562:
37 0
37 0
countPrimesbelow 100 1000 10000 100000 1000000 10000000
countPrimesbelow 100 1000 10000 100000 1000000 10000000
25 168 1229 9592 78498
25 168 1229 9592 78498 664579
findPerfectsbelow 35000000
findPerfectsbelow 35000000
6 28 496 8128 33550336</lang>
6 28 496 8128 33550336</lang>

=={{header|Julia}}==
=={{header|Julia}}==
<lang julia>using Primes, Formatting
<lang julia>using Primes, Formatting