Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Magic-constant/BASIC256/magic-constant.basic
Normal file
24
Task/Magic-constant/BASIC256/magic-constant.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
function a(n)
|
||||
n = n + 2
|
||||
return n*(n^2 + 1)/2
|
||||
end function
|
||||
|
||||
function inv_a(x)
|
||||
k = 0
|
||||
while k*(k^2+1)/2+2 < x
|
||||
k += 1
|
||||
end while
|
||||
return k
|
||||
end function
|
||||
|
||||
print "The first 20 magic constants are:"
|
||||
for n = 1 to 20
|
||||
print int(a(n));" ";
|
||||
next n
|
||||
print : print
|
||||
print "The 1,000th magic constant is "; int(a(1000)); chr(10)
|
||||
|
||||
for e = 1 to 20
|
||||
print "10^"; e; ": "; chr(9); inv_a(10^e)
|
||||
next e
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue