Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Magic-constant/True-BASIC/magic-constant.basic
Normal file
25
Task/Magic-constant/True-BASIC/magic-constant.basic
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
FUNCTION a(n)
|
||||
LET n = n + 2
|
||||
LET a = n*(n^2 + 1)/2
|
||||
END FUNCTION
|
||||
|
||||
FUNCTION inv_a(x)
|
||||
LET k = 0
|
||||
DO WHILE k*(k^2+1)/2+2 < x
|
||||
LET k = k + 1
|
||||
LOOP
|
||||
LET inv_a = k
|
||||
END FUNCTION
|
||||
|
||||
PRINT "The first 20 magic constants are: ";
|
||||
FOR n = 1 TO 20
|
||||
PRINT a(n);" ";
|
||||
NEXT n
|
||||
PRINT
|
||||
PRINT "The 1,000th magic constant is "; a(1000)
|
||||
|
||||
FOR e = 1 TO 20
|
||||
PRINT USING "10^##": e;
|
||||
PRINT USING": #########": inv_a(10^e)
|
||||
NEXT e
|
||||
END
|
||||
Loading…
Add table
Add a link
Reference in a new issue