Data update
This commit is contained in:
parent
157b70a810
commit
8e4e15fa56
78 changed files with 2016 additions and 222 deletions
31
Task/Magic-constant/FutureBasic/magic-constant.basic
Normal file
31
Task/Magic-constant/FutureBasic/magic-constant.basic
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
long def fn MagicConstant( n as long ) = n*(n^2+1)/2
|
||||
|
||||
UInt64 local fn InvA( x as double )
|
||||
UInt64 k = 0
|
||||
while ( k*(k^2+1)/2+2 < x )
|
||||
k++
|
||||
wend
|
||||
end fn = k
|
||||
|
||||
void local fn DoIt
|
||||
window 1, @"Magic constant", (0,0,640,400)
|
||||
print @"First 20 magic constants:"
|
||||
long n = 3
|
||||
while n <= 1002
|
||||
if ( n <= 22 )
|
||||
print fn MagicConstant( n );@" ";
|
||||
end if
|
||||
if ( n == 1002 ) then print @"\n\n1000th magic constant: ";fn MagicConstant(1002)
|
||||
n++
|
||||
wend
|
||||
|
||||
print
|
||||
|
||||
for long e = 1 to 20
|
||||
printf @"10^%ld: %ld",e,fn InvA(10^e)
|
||||
next
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue