Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
25
Task/Generator-Exponential/R/generator-exponential.r
Normal file
25
Task/Generator-Exponential/R/generator-exponential.r
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
powers = function(m)
|
||||
{n = -1
|
||||
function()
|
||||
{n <<- n + 1
|
||||
n^m}}
|
||||
|
||||
noncubic.squares = local(
|
||||
{squares = powers(2)
|
||||
cubes = powers(3)
|
||||
cube = cubes()
|
||||
function()
|
||||
{square = squares()
|
||||
while (1)
|
||||
{if (square > cube)
|
||||
{cube <<- cubes()
|
||||
next}
|
||||
else if (square < cube)
|
||||
{return(square)}
|
||||
else
|
||||
{square = squares()}}}})
|
||||
|
||||
for (i in 1:20)
|
||||
noncubic.squares()
|
||||
for (i in 1:10)
|
||||
message(noncubic.squares())
|
||||
Loading…
Add table
Add a link
Reference in a new issue