Search found 235 matches

by Lord_Farin
Thu Jul 21, 2011 10:55 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 001
Replies: 149
Views: 59757

Re: Problem 001

Hibernatus34 wrote: I have yet to understand why so many people want to post their useless code.
I wish there was a page dedicated to that, separate from the forums, so everyone would be satisfied.
Cf. viewtopic.php?f=5&t=1421&p=26961#p26961
by Lord_Farin
Mon Jul 18, 2011 11:13 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 012
Replies: 99
Views: 38119

Re: Problem 012

What about n = 24? 12 has more divisors than 25 (6 vs. 3). Still, you are not too far off. Try to think in prime factorisations.
by Lord_Farin
Mon Jul 18, 2011 8:42 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 016
Replies: 28
Views: 11424

Re: Problem 016

Hey, can someone help me out in this? I'm not an experienced programmer and I don't know how to put the the digits of 2^1000 into an array. I mean, I know arrays and how to get digits and everything, but how do you put this specific number into the form of an array? Iterate the following: Take modu...
by Lord_Farin
Sat Jul 16, 2011 7:42 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 126
Replies: 28
Views: 12553

Re: Problem 126

This question confuses me. What's the difference between the 3X2X1 with 2 layers cuboid, and a 3X2X2 cuboid. I don't seem to be grasping how a 3X2X1 cuboid with 1 layer requires 22 cubes, but that same cuboid with 2 layers requires 46 and that same cuboid at 3 layers requires 78. How are these cubo...
by Lord_Farin
Mon Jul 11, 2011 8:17 am
Forum: Recreational
Topic: Help with a non-Project Euler problem
Replies: 16
Views: 8987

Re: Help with a non-Project Euler problem

Even though for example 1/3 is not an integer, you can still divide by 3 modulo 29. This is because 3*10==30==1 (29), so 10 acts just like 1/3 in that if you multiply it by 3 you get 1. Could you then say $\frac{1}{3} \equiv 10 \pmod{29}$ In some sense yes, but I would always prefer to write $3^{-1...
by Lord_Farin
Sat Jul 09, 2011 11:08 am
Forum: Number
Topic: Tiling a rectangle with polyomino
Replies: 2
Views: 3500

Re: Tiling a rectangle with polyomino

I'm sure this is not what you are asking, but why not take a single row of n rectangular polyominoes? (or is there a fixed rectangle? if so, why are the two example rectangles not identical?)
by Lord_Farin
Sat Jul 09, 2011 10:15 am
Forum: Recreational
Topic: Help with a non-Project Euler problem
Replies: 16
Views: 8987

Re: Help with a non-Project Euler problem

For completeness' sake, I think you find it useful to know that $a\pmod{b}$ is invertible (has a solution $c$ to $ac\equiv 1\pmod{b}$) precisely when $\gcd(a,b)=1$. For determining (existence of) square roots, there is a useful tool called the Legendre symbol, or more generally the Jacobi symbol. Fo...
by Lord_Farin
Sat Jul 09, 2011 10:10 am
Forum: News, Suggestions, and FAQ
Topic: Functional requests
Replies: 194
Views: 63685

Re: Functional requests

+1 from me for this initiative. I think however that it might be easiest to implement if just every (locked) problem gets such a forum. A range of 10 problems would be hard to manage as to whom gets to see what.
by Lord_Farin
Fri Jul 08, 2011 7:38 am
Forum: Recreational
Topic: Help with a non-Project Euler problem
Replies: 16
Views: 8987

Re: Help with a non-Project Euler problem

Yes, entirely correct. Usually I skip to calculating all the cubes (or other expressions) for 0..n-1 (mod n) as you did. Note that for squares, you would only have to check half of them, as $(-x)^2 = x^2$
by Lord_Farin
Wed Jul 06, 2011 6:50 pm
Forum: Recreational
Topic: Math is like Theism?
Replies: 1
Views: 1757

Re: Math is like Theism?

Having recently followed a course that briefly touched the incompleteness theorems, let me try to explain them. The first theorem says, that there exist sentences (propositions, if you wish) which are true, precisely when there is no proof that they are true (the notion of proof can be precisely def...
by Lord_Farin
Wed Jul 06, 2011 3:41 pm
Forum: News, Suggestions, and FAQ
Topic: How do I use bignum libraries
Replies: 6
Views: 2912

Re: How do I use bignum libraries

Oh, I'm awfullyy sorry. I will never do that again. How stupid of me. It is not really stupid. It is comparable to someone asking how to make $5000 in 4 days because he has to make a tax payment by then, and you tell him how to request extension of the payment deadline. There's nothing wrong with s...
by Lord_Farin
Tue Jul 05, 2011 8:45 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 196
Replies: 34
Views: 15374

Re: Problem 196

The problem says nothing about being part of more than one prime triplet :). A prime quadruple is just two triplets that aren't disjoint.
by Lord_Farin
Sat Jul 02, 2011 10:46 pm
Forum: Programming languages
Topic: Matlab vs Java, HELP!
Replies: 9
Views: 5053

Re: Matlab vs Java, HELP!

I'm still not sure I understand! I think I understand type casting, but what is the point of adding 0.5? How does (int)( 0.5 + Math.sqrt(inn) ) differ from (int)( Math.sqrt(inn) ) ? And isn't it necessary to use (double)inn as the argument in the Math.sqrt-function? Will Math.sqrt(16) (or any other...
by Lord_Farin
Sat Jul 02, 2011 8:23 pm
Forum: Programming languages
Topic: Matlab vs Java, HELP!
Replies: 9
Views: 5053

Re: Matlab vs Java, HELP!

jaap's code works around the Java 'rounding' which is actually truncating the decimal part. That's where the 0.5 is coming from. The (int) signifies a type cast from double to int. Make sure you look up type casting and understand it, as it is important in almost every programming language. As for d...
by Lord_Farin
Sat Jul 02, 2011 7:11 pm
Forum: Programming languages
Topic: Matlab vs Java, HELP!
Replies: 9
Views: 5053

Re: Matlab vs Java, HELP!

In the Java code, you add 'susu' to sum as opposed to 'su' in the MatLab code. The latter makes more sense because otherwise, you could substitute 'i' for 'susu'. Unfortunately, this forum being publicly visible is not meant to post solutions to PE problems (not even without mentioning the number). ...
by Lord_Farin
Wed Jun 29, 2011 8:37 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 003
Replies: 128
Views: 56759

Re: Problem 003

You are dividing integers, meaning that the resulting expression will be typecast to an integer internally (or, simpler, that it will be rounded to return an integer). The fact that the result displayed is similar to the actual result tells you that the size of the number is not a problem. I have su...
by Lord_Farin
Tue Jun 21, 2011 6:27 pm
Forum: News, Suggestions, and FAQ
Topic: How do I ... get better at algorithms/mathematics?
Replies: 2
Views: 2696

Re: How do I ... get better at algorithms/mathematics?

Quite generally, when one gets to a certain amount of solved problems, there come available more and more solution PDFs and forums. These can be treasures of information if read thoroughly. Most general techniques and algorithms also have a decent Wikipedia page. From there, usually there are also l...
by Lord_Farin
Tue Jun 21, 2011 11:08 am
Forum: Clarifications on Project Euler Problems
Topic: Problem 020
Replies: 42
Views: 14539

Re: Problem 020

Hmmm...okay, here's the thing... This problem is identical in nature to problem 16 (same deal with a huge number that you need to store and add up digit by digit), yet while my code worked for problem 16, after it spit out the answer for problem 20, the checker rejected it. Now I know it's against ...
by Lord_Farin
Thu Jun 16, 2011 10:01 pm
Forum: News, Suggestions, and FAQ
Topic: Added feature suggestion for problem pages :
Replies: 1
Views: 1012

Re: Added feature suggestion for problem pages :

Many people already have suggested this. However, I think this feature will take it's time before being implemented. I can even imagine the solution forum being completely reworked somewhere in the future. But that's more a decision for euler c.s..
by Lord_Farin
Thu Jun 16, 2011 4:44 pm
Forum: Clarifications on Project Euler Problems
Topic: Problem 018
Replies: 50
Views: 19936

Re: Problem 018

... The left child simply takes in the same list but starting at the next row. The right child takes in the same list but with the first element of each row removed. It's an ugly loop. Can anyone suggest a better approach? I read this as if you are duplicating elements since they mostly occur both ...