Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Magic-constant/Yabasic/magic-constant.basic
Normal file
23
Task/Magic-constant/Yabasic/magic-constant.basic
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
sub a(n)
|
||||
n = n + 2
|
||||
return n*(n^2 + 1)/2
|
||||
end sub
|
||||
|
||||
sub inv_a(x)
|
||||
k = 0
|
||||
while k*(k^2+1)/2+2 < x
|
||||
k = k + 1
|
||||
wend
|
||||
return k
|
||||
end sub
|
||||
|
||||
print "The first 20 magic constants are: "
|
||||
for n = 1 to 20
|
||||
print a(n), " ";
|
||||
next n
|
||||
print "\nThe 1,000th magic constant is ", a(1000), "\n"
|
||||
|
||||
for e = 1 to 20
|
||||
print "10^", e using"##", ": ", inv_a(10^e) using "#########"
|
||||
next e
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue