|
| 19 May 2013 05:15 AM |
| Make something that goes from one number to another in the least ammount of iterations possible and the fastest time possible. Record the results in a table. You can only use division and multiplication. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 19 May 2013 05:29 AM |
| How does one go from number to number? |
|
|
| Report Abuse |
|
|
| |
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 19 May 2013 06:00 AM |
What kind of pattern you want? I can get from number to number in infinite ways.
n^2 n+1 n*n n-n^2 sqrt(n)*n^2 |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 19 May 2013 06:24 AM |
... surely this is harder than I am thinking it is.
local a = 20134 local b = 72
print(a,b) 20134, 72
a = (a/a)*b print(a,b) 20134, 72
|
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 19 May 2013 06:24 AM |
| Oops, made a mistake at the end 20134, 72 should be 72, 72 |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 19 May 2013 06:30 AM |
a = (a/a)*b
==
a = 1*b
==
a = b
._. |
|
|
| Report Abuse |
|
|
lah30303
|
  |
| Joined: 15 Feb 2008 |
| Total Posts: 10027 |
|
|
| 19 May 2013 07:33 AM |
Are you saying you don't want us to use a for loop, can't use addition/subtraction, and have to print out every integer between the two numbers? Does it have to print them in order? You should have explained better.
|
|
|
| Report Abuse |
|
|
|
| 19 May 2013 07:49 AM |
| No, I am saying that you have to get from one number to another with the least ammount of iterations possible. You should use while loops. |
|
|
| Report Abuse |
|
|
lah30303
|
  |
| Joined: 15 Feb 2008 |
| Total Posts: 10027 |
|
|
| 19 May 2013 07:54 AM |
a = 4 b = 1395
while (a ~= b a = b end
print(a) 1395
cookie? |
|
|
| Report Abuse |
|
|
lah30303
|
  |
| Joined: 15 Feb 2008 |
| Total Posts: 10027 |
|
| |
|
|
| 19 May 2013 07:56 AM |
| You forgot to record your results in a table, lah30303. |
|
|
| Report Abuse |
|
|
lah30303
|
  |
| Joined: 15 Feb 2008 |
| Total Posts: 10027 |
|
|
| 19 May 2013 08:00 AM |
| Gah, how could I be so clumsy? |
|
|
| Report Abuse |
|
|
1waffle1
|
  |
| Joined: 16 Oct 2007 |
| Total Posts: 16381 |
|
|
| 19 May 2013 10:06 AM |
"Make something that goes from one number to another in the least ammount of iterations possible and the fastest time possible. Record the results in a table. You can only use division and multiplication."
`t = {1*2}`
Went from 1 to 2 using multiplication in 0 iterations and 0 seconds. |
|
|
| Report Abuse |
|
|
|
| 19 May 2013 01:21 PM |
local a = 4 local b = 10
local t = {}
while b ~= a do a = a * (b/a) table.insert(t, a) end
print(a) |
|
|
| Report Abuse |
|
|
Parthax
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 6941 |
|
| |
|