Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
39
Task/Anti-primes/FutureBasic/anti-primes.basic
Normal file
39
Task/Anti-primes/FutureBasic/anti-primes.basic
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
local fn DivisorCount( v as long ) as long
|
||||
long total = 1, n = v, p, count
|
||||
|
||||
while ( n mod 2 ) == 0
|
||||
total++
|
||||
n = int( n / 2 )
|
||||
wend
|
||||
p = 3
|
||||
while ( p * p ) <= n
|
||||
count = 1
|
||||
while ( n mod p ) == 0
|
||||
count++
|
||||
n = int( n / p )
|
||||
wend
|
||||
p = p + 2
|
||||
total = total * count
|
||||
wend
|
||||
if n > 1 then total = total * 2
|
||||
end fn = total
|
||||
|
||||
void local fn AntiPrimes( howMany as long )
|
||||
long n = 0, count = 0, divisors, max_divisors = 0
|
||||
|
||||
printf @"The first %ld anti-primes are:", howMany
|
||||
|
||||
while ( count < howMany )
|
||||
n++
|
||||
divisors = fn DivisorCount( n )
|
||||
if ( divisors > max_divisors )
|
||||
printf @"%ld \b", n
|
||||
max_divisors = divisors
|
||||
count++
|
||||
end if
|
||||
wend
|
||||
end fn
|
||||
|
||||
fn AntiPrimes( 20 )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue