Player (109)
Joined: 8/24/2006
Posts: 61
Location: Brazil
Gorash wrote:
primorial#soup wrote:
-nal
sub p{@_?map{my$e=$_;map[$e,@$_],p(grep{$e ne$_}@_)}@_:0}map{print"@$_"}p@F
def f(n,v=[]):
 if[f([j for j in n if j!=i],v+[i])for i in n]==n:print v
Usage: >>> f(list) 4 bytes shorter including line break and indentation ;)
I don't know Python (don't like the concept of indenting as block syntax), so how do you actually use this from command line? Note how the perl version also does the parsing of arguments and intial invocation of the recursion.
You have to invoke it yourself, that is just the function definition. (Invoke it like f([1, 2, 3])) Parsing the arguments would take a bit more of work. At least, importing sys and invoking sys.argv, like:
import sys
def f(n, v=[]):
 if[f([j for j in n if j!=i],v+[i])for i in n]==n:print v
f(map(int, sys.argv))
AW2 v2 progress: Two-Week Test (mission 17/25)
Joined: 5/3/2004
Posts: 1203
Dacicus wrote:
xebra wrote:
No, it's built into the language. It doesn't require the loading of any packages like <<DiscreteMath`Combinatorica`.
I interpreted Gorash's challenge to mean that you were supposed to write your own permutation function/procedure/etc.
That's how I believe he meant for it to be interpreted, as well, but I think it is our responsibility to punish him for insufficiently detailed instructions and an insufficiently limited context. In the Mathematica Programming Language, Permutation[] is not a package. <<DiscreteMath`Combinatorica` is, but luckily you don't need it!
upthorn
He/Him
Emulator Coder, Active player (392)
Joined: 3/24/2006
Posts: 1802
xebra wrote:
Dacicus wrote:
xebra wrote:
No, it's built into the language. It doesn't require the loading of any packages like <<DiscreteMath`Combinatorica`.
I interpreted Gorash's challenge to mean that you were supposed to write your own permutation function/procedure/etc.
That's how I believe he meant for it to be interpreted, as well, but I think it is our responsibility to punish him for insufficiently detailed instructions and an insufficiently limited context. In the Mathematica Programming Language, Permutation[] is not a package. <<DiscreteMath`Combinatorica` is, but luckily you don't need it!
In the context of this challenge, the Mathematica Programming Language is a package.
How fleeting are all human passions compared with the massive continuity of ducks.
Joined: 4/16/2005
Posts: 251
Punish... what a hard word. I'd just say that it's your responsibility to read my mind before you come up with easy mode solutions. :)
Joined: 5/13/2006
Posts: 283
Something that bugs me...
y=50*x*1.1^x
how do you solve for x? :/
<Zurreco> if so called professional players cant adapt to every playing field, theyre obviously not that great
Joined: 12/7/2005
Posts: 149
Location: Sweden
kwinse wrote:
y=50*x*1.1^x
how do you solve for x? :/
In general, this has no elementary solution. Using the Lambert W function, the solution can be expressed as W((1/50)*y*log(1.1))/log(1.1). But the best idea is to solve it numerically.
Joined: 5/13/2006
Posts: 283
Well, thanks, so much for not frying my spreadsheet if I ever get what I want implemented...
<Zurreco> if so called professional players cant adapt to every playing field, theyre obviously not that great
Joined: 11/26/2005
Posts: 285
I got one (It's not really a problem but more of a question that I want an answer to): Why is it that x^2-1=(x+1)*(x-1) ?
Active player (255)
Joined: 4/24/2005
Posts: 476
It's just what you get when you factor it. Or are you asking about how to factor?
[URL=http://www.youtube.com/watch?v=IcuV2JdaBYY]Streets of Rage 3 (2 players)[/url]
Joined: 10/24/2005
Posts: 1080
Location: San Jose
Swedishmartin wrote:
I got one (It's not really a problem but more of a question that I want an answer to): Why is it that x^2-1=(x+1)*(x-1) ?
Because (x+1)*(x-1) = X^2 + 1*x - 1*x + (-1*1) = X^2-1 You could also explain it visually: (x-a)(x+a) = x^2-a^2. Basically, take a square that is length x by x, and subtract an arbitrary length, and add the same arbitrary length to each side (x-a) and (x+a) repectively. Compare the two areas (x^2 and (x-a)(x+a), and you'll see that x^2 is larger than (x-a)(x+a) by an amount of a^2. Edit: I made an image
<agill> banana banana banana terracotta pie! <Shinryuu> ho-la terracotta barba-ra anal-o~
Former player
Joined: 9/20/2006
Posts: 287
Location: Singapore
Oh, I got a question! Found this in my math text and couldn't quite solve it even until now: The positive integers a and b, where a<b, satisfy the equation a^b=b^a Show that there is only 1 possible value for a and one for b, and find these values. Couldn't quite do the first part, though the second one came almost intuitively. PS. for the answer of the second part: a=2, b=4 edit: the answer was still quite visible on tiny, so I coloured it out :)
Truncated wrote:
Truncated is the most fiendish instrument of torture ever devised to bedevil the days of man. -- xoinx
Joined: 4/11/2006
Posts: 487
Location: North of Russia :[
a^b = b^a (a < b, a and b are integers) b = a^k (k>1) a^(a^k) = (a^k)^a (=a^(ak)) ak = a^k a = k^(1/k-1) so k^(1/k-1) should be integer with k>1... but (k^(1/k-1)) when increasing k goes to 1 from above, and the ony integer value it takes is 2 (you can build graph (y(x) = x^(1/x-1)) and see yourself) a = 2 ^ (1/(2-1)) = 2 b = 2^2 = 4 so, a ^ b = b ^ a only when a = 2 and b = 4 or b = 2 and a = 4 P.S. Thanks, solving this question was quite interesting )
Former player
Joined: 9/20/2006
Posts: 287
Location: Singapore
That's an interesting solution... yay i finally can submit my assignment haha.
but (k^(1/k-1)) when increasing k goes to 1 from above, and the ony integer value it takes is 2 (you can build graph (y(x) = x^(1/x-1)) and see yourself)
Though I personally hope that there is another way of working around this. It doesn't really look very convincing, unless of course i use graphamatica. Any other solutions? Thanks zefiris anyway, you showed me how to proceed past a=k^(1/k-1) :)
Truncated wrote:
Truncated is the most fiendish instrument of torture ever devised to bedevil the days of man. -- xoinx
Joined: 4/11/2006
Posts: 487
Location: North of Russia :[
Okay let's prove that k^(1/(k-1)) takes only one integer value when k>1 f(k) = k^((k-1)^-1) lim f(k) = e k -> 1 lim f(k) = 1 k -> infinity f'(k) = -k^(k-2) * (k-1)^-3 k>1 -> k^(k-2) > 0 k>1 -> (k-1)^-3 > 0 f'(k) < 0 when k > 1 therefore it takes values from e downto 1 always decreasing. We can conclude it takes values from range (1;e). 2 is the only integer there.
Joined: 4/3/2005
Posts: 575
Location: Spain
Prove that no number on the sequence: 5 15 115 1115 ... (and so on) can be divided by seven.
No.
Joined: 5/3/2004
Posts: 1203
I tried them all, it's cool.
Joined: 4/11/2006
Posts: 487
Location: North of Russia :[
DrJones wrote:
Prove that no number on the sequence: 5 15 115 1115 ... (and so on) can be divided by seven.
It's simple... N1 = 5 N1 mod 7 = 5 Nn = (Nn-1 - 4) * 10 + 5 Nn = 10*Nn-1 - 35 35 mod 7 = 0 10*Nn-1 can not be divided by 7 as Nn-1 can not and 10 can not 10*Nn-1 mod 7 = (10*Nn-1 - 35) mod 7 therefore for any n Nn can not be divided by 7
Former player
Joined: 9/20/2006
Posts: 287
Location: Singapore
zefiris: your method is sort of an induction right? not sure about your notation(function?) mod; when you use it, the value it presents is the remainder of the quotient, am I right? Nice solution though. I like how you make easy work of our questions haha. Alright, let's now take a break from all our brain wrecking math, and chill with some math humor. Enjoy :)
Truncated wrote:
Truncated is the most fiendish instrument of torture ever devised to bedevil the days of man. -- xoinx
Former player
Joined: 8/1/2004
Posts: 2687
Location: Seattle, WA
xoinx wrote:
chill with some math humor. Enjoy :)
hi nitrodon streamline: cyn-chine
Joined: 4/11/2006
Posts: 487
Location: North of Russia :[
xoinx wrote:
zefiris: your method is sort of an induction right?
I think this method is called induction, right )
not sure about your notation(function?) mod; when you use it, the value it presents is the remainder of the quotient, am I right?
correct. "mod" is used to get remainder from division in pascal. I didn't know what symbol should I use so I used one I was used to )
Nice solution though. I like how you make easy work of our questions haha.
Thanks ) I like mathematics (^_^)v
Alright, let's now take a break from all our brain wrecking math, and chill with some math humor. Enjoy :)
Thanks (^_^)v
Former player
Joined: 9/20/2006
Posts: 287
Location: Singapore
eh... anyone care to try? :)
Truncated wrote:
Truncated is the most fiendish instrument of torture ever devised to bedevil the days of man. -- xoinx
Editor, Expert player (2073)
Joined: 6/15/2005
Posts: 3282
zefiris wrote:
I think this method is called induction, right )
Mathematical induction, right.
zefiris wrote:
correct. "mod" is used to get remainder from division in pascal. I didn't know what symbol should I use so I used one I was used to )
You could also use the notation N1 ≡ 5 (mod 7).
Joined: 3/8/2004
Posts: 185
Location: Denmark
xoinx wrote:
eh... anyone care to try? :)
[Nevermind, found it out] I've got this one I think. Expect an update tomorrow.
"We observe the behaviour of simple folk, and derive pleasure from their defects." -Aristotle - Book of Humour
Joined: 7/1/2005
Posts: 56
Location: Central Pennsylvania, USA
(1 week later) So where's that update?
That's what she said!
Former player
Joined: 9/20/2006
Posts: 287
Location: Singapore
Haha... Wonder where MahaTma is. Busy with his own life I guess? Anyway, I've got another question, which probably most people here would probably be more familiar than I am. Can the binary number system denote all integers? And is there some form of reasoning behind it?
Truncated wrote:
Truncated is the most fiendish instrument of torture ever devised to bedevil the days of man. -- xoinx