Search found 55 matches

by wrongrook
Mon Nov 22, 2010 10:23 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 311
Replies: 7
Views: 3012

Re: Problem 311

I think the problem setters were trying to give a hint by choosing N=10000 rather than some other value; I would recommend careful examination of N=10000 and N=5000.
by wrongrook
Sun Nov 21, 2010 9:08 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 311
Replies: 7
Views: 3012

Re: Problem 311

Thank you very much, that was very helpful.

I get the correct answer now (for B(10,000) and B(1,000,000) at any rate), (I'd missed the C0<=B0 inequality, whoops)
by wrongrook
Sun Nov 21, 2010 7:28 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 311
Replies: 7
Views: 3012

Problem 311

Are quadrilaterals distinct if: 1) Side lengths are different? 2) Angles are different? 3) Both side lengths and angles are different? (my initial assumption) I've tried computing B(10,000) for each of these but none of them match the answer given (cases 2 and 3 give answers too high, and 1 gives an...
by wrongrook
Wed May 26, 2010 12:20 pm
Forum: Recreational
Topic: Nice set theory exercise
Replies: 20
Views: 7068

Re: Nice set theory exercise

Whoops, nice spot Doraki!

Does anyone know of any real world application (e.g. of practical use in engineering or computing) of knowing whether something is uncountable or countably infinite?
by wrongrook
Wed May 26, 2010 7:30 am
Forum: Recreational
Topic: Nice set theory exercise
Replies: 20
Views: 7068

Re: Nice set theory exercise

How about:
Elements [floor(x*10**n) for n in [1,2,3,4,...]] where x is a real number such that 0<=x<=1.
e.g. for x=0.1234567 then the element would be {1,12,123,1234,12345,123456,1234567}.

Does this work?
by wrongrook
Thu May 13, 2010 9:25 pm
Forum: News, Suggestions, and FAQ
Topic: how do I .... generate a "natural number"
Replies: 3
Views: 1887

Re: how do I .... generate a "natural number"

Hi, I'm not sure I have really understood your question, but you may also be interested in investigating numbers such as: 679/500005 = 0.001357986420135... or 13580/100001 = 0.1357986420135.... It is straightforward to generate such numbers by using continued fractions. (Python code) import fraction...
by wrongrook
Sat Mar 20, 2010 1:52 pm
Forum: Combinatorics
Topic: Counting solitaire
Replies: 2
Views: 8692

Re: Counting solitaire

Interesting problem to think about, I make the answer 1309302175551177162931045000259922525308763433362019257020678406144 using the Python code (0.03seconds): def derange_cards(J,C): if C==0: return J==0 return sum(nCr(4,k)*nCr(4,j)*nPr(J,j)*nPr(J,k)*derange_cards(J-j+4-k,C-4) for j in range(min(4,J...
by wrongrook
Sun Feb 28, 2010 4:27 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 179
Replies: 43
Views: 12118

Re: Problem 179

26 has factors of 1,2,13,26
25 has factors of 1,5,25
so this pair should not be in your list.
by wrongrook
Sun Feb 28, 2010 1:21 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 179
Replies: 43
Views: 12118

Re: Problem 179

Does this miss the case n=2 as both 2 and 3 are prime?
by wrongrook
Wed Feb 17, 2010 10:15 am
Forum: News, Suggestions, and FAQ
Topic: Categorize Solutions for Different Languages
Replies: 1
Views: 1171

Re: Categorize Solutions for Different Languages

This sounds almost like a Project Euler challenge in itself :) Here's my Python attempt (it's a bit dodgy as it won't always produce correctly formatted html): def forum(problem_id, username, password, lang): params = urllib.urlencode({'username': username, 'password': password, 'login':'Login'}) pa...
by wrongrook
Sun Jan 24, 2010 10:29 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 248
Replies: 6
Views: 3207

Re: Problem 248

I agree with your value for 10. By the way I hope you didn't read the reply too early as I had off by 1 errors in them the first time! I've been really enjoying this site and probably spending far too much time on it. I've been amazed by how much interesting and understandable mathematics I was able...
by wrongrook
Sun Jan 24, 2010 10:08 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 248
Replies: 6
Views: 3207

Re: Problem 248

I make these:
100th is 6239393627
1000th is 6359386477
Good luck!

This probably sounds incredibly patronising, so please understand that no offence is intended, but I suspect you will find it helpful to write a simple bruteforce algorithm to check the results for small numbers :)
by wrongrook
Sat Jan 09, 2010 8:51 am
Forum: Recreational
Topic: Easy and nice
Replies: 13
Views: 4489

Re: Easy and nice

Hmm, have to look into this Y-combinator thing as well :)

My 2 liner is a bit of a cheat as the first line is quite long, but anyway:

Code: Select all

def rec2(x,n): return max([x]+[rec2(10*x+d,n+1) for d in range(10) if (n>1 or d>1) and not (10*x+d)%n])
print rec2(0,1)
by wrongrook
Wed Jan 06, 2010 9:32 pm
Forum: Recreational
Topic: Easy and nice
Replies: 13
Views: 4489

Re: Easy and nice

That was fun, I get:
36840 for the central 5 digits of the answer (with a Python 2 line program)
by wrongrook
Sun Nov 22, 2009 5:08 pm
Forum: Combinatorics
Topic: Gambling
Replies: 4
Views: 4445

Re: Gambling

Pondered this as going to sleep, interesting question :) Spoiler I think a line fits the first regression and a quadratic the second to give the formulae: B/(A+B) and let M=(A-B)/2 -(x-M)^2+(A-M)^2=expected goes when starting from x =>-M^2+A^2-2AM+M^2=A(-2*M+A)=AB when starting from 0. Is this right?