Jump to content

Duffinian numbers: Difference between revisions

m
(Initial FutureBasic task solution added)
Line 694:
next
end fn = isPrime
 
 
local fn GCD( a as long, b as long ) as long
Line 702 ⟶ 701:
result = fn GCD( b mod a, a )
end fn = result
 
 
local fn SumDiv( num as NSUInteger ) as NSUInteger
Line 718 ⟶ 716:
result = sum + 1
end fn = result
 
 
local fn IsDuffinian( n as NSUInteger) as BOOL
BOOL result = NO
if ( fn IsPrime(n) == NO and fn GCD( fn SumDiv(n), n ) == 1 ) then exit fn = YES
result = YES
else
result = NO
end if
end fn = result
 
 
local fn FindDuffinians
Line 757 ⟶ 749:
 
CFTimeInterval t
 
t = fn CACurrentMediaTime
fn FindDuffinians
Line 792 ⟶ 783:
Compute time: 2963.753 ms
</pre>
 
 
=={{header|Go}}==
719

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.