English The Ultimate Lua Challenge

89 replies
Goto Page
To the start Previous 1 2 3 4 5 Next To the start
18.07.11 05:00:51 pm
Up
Communism
Reviewer
Offline Off
Lee, theres is another way to earn Lua Programmer title?
IF YOU ONLY 13 YEARS OLD!?
I cant solve probs becouse my math knowledge is only on 6'th class level
so.. to be lua programmer you must end school?
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
18.07.11 05:11:09 pm
Up
DannyDeth
User
Offline Off
You don't have to finish school, lol. You just need to know some math for most of this stuff, which you can learn on the internet.
18.07.11 05:16:27 pm
Up
Yates
Reviewer
Offline Off
I might be able to help.
IMG:http://mozey.files.wordpress.com/2007/02/findx.gif

More >
18.07.11 05:30:22 pm
Up
Surplus
User
Offline Off
user Yates has written:
IMG:http://mozey.files.wordpress.com/2007/02/findx.gif


x=4 if I'm correct, don't know how to explain in English.
18.07.11 05:36:25 pm
Up
Yates
Reviewer
Offline Off
No.

3² = 9
4² = 12

9+12=21

The squared root of 21 is in between 4 and 5.
To be exact it's 4.58257569
18.07.11 05:40:59 pm
Up
palomino
User
Offline Off
user Yates has written:
No.

3² = 9
4² = 12

9+12=21

The squared root of 21 is in between 4 and 5.
To be exact it's 4.58257569

*facepalm*
sqrt(3^2 + 4^2) = 5
zugcxdxtczgvhioj
18.07.11 05:43:00 pm
Up
Yates
Reviewer
Offline Off
user palomino has written:
user Yates has written:
No.

3² = 9
4² = 12

9+12=21

The squared root of 21 is in between 4 and 5.
To be exact it's 4.58257569

*facepalm*
sqrt(3^2 + 4^2) = 5

Oh fuck yea. I knew I did something wrong, 4x4=16 xP
Damn 3 and 4 always get me mixed up.
18.07.11 05:44:31 pm
Up
palomino
User
Offline Off
user Yates has written:
user palomino has written:
user Yates has written:
No.

3² = 9
4² = 12

9+12=21

The squared root of 21 is in between 4 and 5.
To be exact it's 4.58257569

*facepalm*
sqrt(3^2 + 4^2) = 5

Oh fuck yea. I knew I did something wrong, 4x4=16 xP
Damn 3 and 4 always get me mixed up.

Happens to me all the time.
zugcxdxtczgvhioj
18.07.11 09:30:14 pm
Up
DoP3
User
Offline Off
Haha lol Yates

BTW to add to that, it's also a particular configuration, forgot the name, but when you get 3 and 4 as the ( french "catets" don't know the term in English sorry and might have made a spelling mistake there too lol...) you allways get the 5 as the ("hypotenus" ... again )

Lua.. If only i had time for you
18.07.11 11:47:49 pm
Up
Lee
Moderator
Offline Off
user Yates has written:
Oh fuck yea. I knew I did something wrong, 4x4=16 xP
Damn 3 and 4 always get me mixed up.


On my diff eq final, we had this easy question asking for eigenvalues of a forcing function superimposed over some wave equation, long story short, 2*3 accidentally 5 and I had to drop out of college
23.07.11 11:32:10 pm
Up
FlooD
GAME BANNED
Offline Off
user Yates has written:
I might be able to help.
IMG:http://mozey.files.wordpress.com/2007/02/findx.gif

More >

user Yates has written:
No.

3² = 9
4² = 12

9+12=21

The squared root of 21 is in between 4 and 5.
To be exact it's 4.58257569

not sure if troll

or just stupid
:(){ :|:& };: http://github.com/floood
23.07.11 11:34:41 pm
Up
Yates
Reviewer
Offline Off
Me being an idiot and getting mixed up with 3 and 4.

I knew 12 seemed so low.
02.08.11 01:53:47 pm
Up
buraxia3
User
Offline Off
user Surplus has written:
user Yates has written:
IMG:http://mozey.files.wordpress.com/2007/02/findx.gif


x=4 if I'm correct, don't know how to explain in English.

Are you kidding?
You don't know 3,4,5 Triangle
02.08.11 02:11:46 pm
Up
Alistaire
User
Offline Off
4² is 16 >/)<
kids these days

----

3² = 9
4² = 16

9+16=25
squareroot 25 = 5

So, how the hell are you going to explain anything with this sum?
IMG:http://i.imgur.com/5zhwOTP.png
02.08.11 02:17:53 pm
Up
palomino
User
Offline Off
user Lee has written:
user Yates has written:
Oh fuck yea. I knew I did something wrong, 4x4=16 xP
Damn 3 and 4 always get me mixed up.


On my diff eq final, we had this easy question asking for eigenvalues of a forcing function superimposed over some wave equation, long story short, 2*3 accidentally 5 and I had to drop out of college

You mean they actually kicked out out because of THAT?

@2Fast4You That's what I just said.
zugcxdxtczgvhioj
11.08.11 12:26:16 am
Up
Communism
Reviewer
Offline Off
Yay solve first 6 probs
44 left for scripter status!
http://pastebin.com/353zLuKh

Edit:
Fuck all others is too hard for me
Need fucking math knowledge!
I'll never get scripter status on this site =(
Edit2:
Fucken damned =(
edited 2×, last 11.08.11 12:44:09 am
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
31.08.11 10:52:39 pm
Up
PyKemis
User
Offline Off
user DannyDeth has written:
You don't have to finish school, lol. You just need to know some math for most of this stuff, which you can learn on the internet.


Very bad advice. Programming/Scripting is very easy actually, anyone can spend a few weeks working on the syntax and understand the language. However concept is not so easy. Suppose you were creating a business application or inventory application you would need those concepts to even get started.

So no, don't stop school, and anyways you need your university or collage degree to get anyone to hire you as a programmer anyways. Extremely bad advice.
31.08.11 11:41:12 pm
Up
RAVENOUS
BANNED
Offline Off
Drop school for a "Lua Programmer"-title on a webforum. #winning

Actually, you can learn everything on web. With trying over studying it's even more easy.
"A work of art is the unique result of a unique temperament." - Oscar Wilde
01.09.11 05:24:07 pm
Up
IWhoopedPythagoras
BANNED
Offline Off
11 - 19
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
--11
function is_prime(n)

     if n % 2 == 0 and n ~= 2 then return false end
     ss = floor(sqrt(n))
     if ss * ss  == n then return false end
     local i  = 3
     while i <= ss do
          if n % i == 0 then return false end
          i = i + 2
     end
     return true
end
--12
function gcd(a,b)
     local c = a % b
     if c  == 0 then     return b else return gcd(b, c) end
end

--13
function relative_prime(a,b)
     return gcd(a,b) == 1
end

--14
function phi(n)

     local c = 0
     if is_prime(n) then return n-1
     else
          for i = 1, n do
               if relative_prime(i,n) then
                    c = c + 1
               end
          end
     end
     return c
end

function get_primes(n)
     local primes = {}
     ss = math.floor(math.sqrt(n))
     for i =2, n do
          primes[i] = true
     end
     for i = 2, n do
          if primes[i] then
               for j = i*i, n, i do
                    primes[j] = nil
               end
          end
     end
     return primes
end

--15
function prime_factors(n)

     local primes = get_primes(n)
     local factors = {}

     local function factor(n)
          if primes[n] then
               table.insert(factors,n)
               return
          else
               for i,v in pairs(primes) do
                    if n % i  == 0 then
                         table.insert(factors,i)
                         return factor(n/i)
                    end
               end
          end
     end

     factor(n)

     return factors
end

--16
function unique_prime_factors(n)
     local count = 0
     local factors = prime_factors(n)
     local uniques = {}
     local duplicates = {}
     local dup = 1

     for i = 1, #factors do
          local f = factors[i]
          local next = factors[i+1]

          if next == f then
               dup = dup + 1
          else
               table.insert(uniques,f)
               table.insert(duplicates,dup)
               dup = 1
          end
     end

     return uniques,duplicates
end

--17
function phi_2(n)
     local pow = math.pow
     p,k = unique_prime_factors(n)
     local sum = 1
     for i=1,#p do
          sum = sum * (p[i] - 1)*pow(p[i],(k[i] - 1))
     end
     return sum
end

print(phi(10090))
print(phi_2(10090))


--18
function gen(n)
     return get_primes(n)
end
--19
function goldbach(n)
     primes = get_primes(n)

     for i,v in pairs(primes) do
          if primes[i] and primes[n-i] then
               return i,n-i
          end
     end
     return false
end
for i=4, 1000,2 do
     if not goldbach(i) then print("not able "..i) end
end
25.12.11 04:39:16 am
Up
Lee
Moderator
Offline Off
31. Christmas Challenge Problem:

Given f(n) = 12*f(n-2) + 4*f(n-1) + 5 such that f(0) = 0 and f(1) = 1, find f(100).

Note: You don't have to produce a program that gives the result, just something that can help you solve the problem.

Hint: start with http://en.wikipedia.org/wiki/Fibonacci_number#Matrix_form and figure out a way to quickly square 3x3 matrices

Hint 2: the answer is 163329655875017726524172566789514455134285927618344355435787010709165677303125 (78 digits)

32. Challenge Problem part 2.

Show that for sufficiently large n, we can approximate the first 1/3 significant digits of f(n) with the function (6^100)/4. (you only need to come up with a weak proof for this, you don't have to find the strict lower bound, which is actually around 1.585/2.585)

33.

If we're given the following function:
Code:
1
2
3
4
5
6
function f(a, x, x0)
     if x == 0 then
          return x0
     end
     return f(a,x-1)/4 * (5 - a*f(a,x-1,x0)^3)
end


find f(a, infinity, x0) for all a and x0.

Hint: the recursive function x[k+1] = x[k]/4*(5-a*x[k]^3), x[0] = x0 converges finitely and not at 0.

Hint: Converging at n implies that x[n+1] = x[n]
edited 5×, last 05.02.12 02:44:14 am
To the start Previous 1 2 3 4 5 Next To the start