project-euler

How can I represent a very large integer in .NET?

Does .NET come with a class capable of representing extremely large integers, such as 100 factorial? If not, what are some good third party libraries to accomplish this? ...

Simple Lisp Program Causing Computer To Hang

NOTE: I've closed this question because it turns out that there was nothing wrong with my program that should have caused it to behave as it did, and it was likely a compiler bug or something. I'm also now using the style that John recommended, it looks much nicer than the code I posted here. - - -- --- ----- -------- ------------- I'...

Concurrent Prime Generator

I'm going through the problems on projecteuler.net to learn how to program in Erlang, and I am having the hardest time creating a prime generator that can create all of the primes below 2 million, in less than a minute. Using the sequential style, I have already written three types of generators, including the Sieve of Eratosthenes, and ...

Mathematics / Algorithmic Resources: ProjectEuler.net puzzles

I've used brute force for the most part for the ProjectEuler.net problems that I have been able to solve. One thing I'm finding is that, for some of the puzzles, I'm not able to find good resources for 'backfilling' my understanding of the problem domains the puzzles represent. What are suggested resources for learning about those topi...

Beginner practical programming problems?

Where can I find lists of practical programming problems for a novice? Something similar to http://www.projecteuler.net, but for practical problems. I am asking for problems even less complex than this question ...

Finding the LCM of a range of numbers

I read an interesting DailyWTF post today, "Out of All The Possible Answers..." and it interested me enough to dig up the original forum post where it was submitted. This got me thinking how I would solve this interesting problem - the original question is posed on Project Euler as: 2520 is the smallest number that can be divided by...

Is there a simple algorithm that can determine if X is prime, and not confuse a mere mortal programmer?

I have been trying to work my way through Project Euler, and have noticed a handful of problems ask for you to determine a prime number as part of it. 1) I know I can just divide x by 2, 3, 4, 5, ..., square root of X and if I get to the square root, I can (safely) assume that the number is prime. Unfortunately this solution seems quite...

Why is Erlang crashing on large sequences?

I have just started learning Erlang and am trying out some Project Euler problems to get started. However, I seem to be able to do any operations on large sequences without crashing the erlang shell. Ie.,even this: list:seq(1,64000000). crashes erlang, with the error: eheap_alloc: Cannot allocate 467078560 bytes of memory (of type ...

A Project Euler Puzzler (specifically in PHP)

There is another recent Project Euler question but I think this is a bit more specific (I'm only really interested in PHP based solutions) so I'm asking anyway. Question #5 tasks you with: "What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?" Now, I have solved it twice. Once very inefficiently and ...

What do you think about using the Project Euler website as a candidate profiling tool?

I've read a thread around here about people using FizzBuzz to filter out completely clueless candidates for programming positions. To be honest, I find it hard to believe many candidates won't pass that (although i CAN believe it), but one way or another, even for a very simple first filter, it seems like that bar it set too low. I rec...

How do I check if a number is a palindrome?

Any language. Any algorithm (except making the number a string and then reversing the string). Also, I actually have to do this, and I'll be posting my solution too. ...

Project Euler Question 3 Help

I'm trying to work through Project Euler and I'm hitting a barrier on problem 03. I have an algorithm that works for smaller numbers, but problem 3 uses a very, very large number. Problem 03: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143? Here is my solution in C# and it's b...

Print really big numbers

Hey! I have this code #include <iostream> using namespace std; int main(int argc,char **argv) { unsigned long long num1 = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999...

How do I memoize a recursive function in Lisp?

I'm a Lisp beginner. I'm trying to memoize a recursive function for calculating the number of terms in a Collatz sequence (for problem 14 in Project Euler). My code as of yet is: (defun collatz-steps (n) (if (= 1 n) 0 (if (evenp n) (1+ (collatz-steps (/ n 2))) (1+ (collatz-steps (1+ (* 3 n))))))) (defun ...

How to avoid scientific notation for large numbers?

I am doing 2^1000 and am getting this: 1.07151e+301 Is there any way to actually turn this into a proper number without the e+301 or at least can anyone show me where I can see how to turn this in to a real number, by some way working with the e+301 part Thanks ...

What's the smallest device I can program on?

I'm thinking of something smaller than a laptop that i can spend my hours on the way to work doing project euler problems or such. Any ideas? ...

Euler Project Help (Problem 12) - Prime Factors and the like

I hate to have to ask, but I'm pretty stuck here. I need to test a sequence of numbers to find the first which has over 500 factors: http://projecteuler.net/index.php?section=problems&amp;id=12 -At first I attempted to brute force the answer (finding a number with 480 after a LONG time) -I am now looking at determining the prime facto...

working with incredibly large numbers in .NET

I'm trying to work through the problems on projecteuler.net but I keep running into a couple of problems. The first is a question of storing large quanities of elements in a List<t>. I keep getting OutOfMemoryException's when storing large quantities in the list. Now I admit I might not be doing these things in the best way but, is the...

Triangle problem

Hey!! I am trying to resolve Euler Problem 18 -> http://projecteuler.net/index.php?section=problems&amp;id=18 I am trying to do this with c++ (I am relearning it and euler problems make for good learning/searching material) #include <iostream> using namespace std; long long unsigned countNums(short,short,short array[][15],short,boo...

Fastest way to determine if an integer's square root is an integer

I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is another integer). I've done it the easy way, by using the built-in Math.sqrt() function, but I'm wondering if there is a way to do it faster by restricting yourself to integer-only domain. Maintaining a lookup table is impratical (...