Data update
This commit is contained in:
parent
8f05c7136f
commit
0bf4da02c3
82 changed files with 2194 additions and 118 deletions
34
Task/Mertens-function/FutureBasic/mertens-function.basic
Normal file
34
Task/Mertens-function/FutureBasic/mertens-function.basic
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
void local fn MertensFunction
|
||||
long mertens(1000), n, k, crossesTotal = 0, zerosTotal = 0
|
||||
|
||||
mertens(1) = 1
|
||||
|
||||
for n = 2 to 1000
|
||||
mertens(n) = 1
|
||||
for k = 2 to n
|
||||
mertens(n) = mertens(n) - mertens(n/k)
|
||||
next
|
||||
next
|
||||
|
||||
printf @"First 99 Mertens numbers:\n \b"
|
||||
|
||||
for n = 1 to 99
|
||||
printf @"%3ld \b", mertens(n)
|
||||
if ( n mod 10 == 9 ) then print
|
||||
next
|
||||
|
||||
for n = 1 to 1000
|
||||
if ( mertens(n) == 0 )
|
||||
zerosTotal++
|
||||
if mertens(n-1) != 0 then crossesTotal++
|
||||
end if
|
||||
next
|
||||
|
||||
print
|
||||
printf @"mertens(n) array is zero %ld times.", zerosTotal
|
||||
printf @"mertens(n) array crosses zero %ld times.", crossesTotal
|
||||
end fn
|
||||
|
||||
fn MertensFunction
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue