I'll give you a hint, here is the formula.
An = An-1 + An-2
Where A1 = 1 and A2 = 1.
Type: Posts; User: aesguitar
I'll give you a hint, here is the formula.
An = An-1 + An-2
Where A1 = 1 and A2 = 1.
Problem 160 - Project Euler
Problem 160. I've been working on it for a while. First attempt was to brute force the factorial using JScience's LargeInteger class and huge multi-threading. That took...
Ok, well, you can use De Polignac's formula to figure out how many factors of a prime factor there are in n!.
Could you also explain this a different way?
This is a project Euler...
For a problem I'm working on, I need to calculate some very, very large factorials; or at least the first five non-zero digits of said factorial. I've worked out the function:
F(n) =...
First repost your code in the [code=java][/code ] tags to maintain formatting and highlighting. Also, post the errors your are getting.
The only other way I could think of is to create a 2d array. I don't know how that effects how much memory is available though.
Create an arraylist of files containing the permutations, then simply get the required permutations from the containing file.
The board is called "What's wrong with my code" meaning you have to post some code here.
I'm using the LargeInteger class in JScience to calculate the first five digits after the trailing zeros of huge factorials. I keep getting a StackOverflowException when the program nears completion....
I saw you were using nested for loops
for(/*conditions blah blah blah*/)
{
for(/*conditions blah blah blah*/)
{
for(/*conditions blah blah blah*/)
{
Ok, what's your purpose is storing the combinations? Are you trying to find the number of combinations or permutations, or are you actually trying to store all the combinations for whatever reason?...
Not just an array, but any Collection or array.
OK, a few things. If you want to store every single possible combination, you're going to have to post specs, specifcally, how much RAM you have. I'll take a guess at 3 gigs. Windows 7 takes about...
Strings are not JTextFields, you need to get what's in the text field to compare with a String.
Hyper threading means each physical core acts as two logical cores.
lim = 1,000,000
threads = 32
time = 418 seconds
triplets = 163714
threads = 16
...
Thanks for that one, it reduced the 100,000 time from 25.5 seconds to 16.4 seconds. Next thing I will try is threading. I have 8 usable cores, so how does 16 or 24 Threads sound (i7 3770 @ 3.4 GHz...
Well, I've got the run-time for a lim of 100,000 down from 35.5 seconds to 24-25 seconds with a few tweaks I found, Like the maximum value of a that contains any triplets at all approaches lim/2.
...
Unfortunately, your hypothesis isn't correct. I ran the algorithm such that a+b+c<=1,000,000 but a <= 10,000 to save time. Here's the output:
a = 2000 ; tot = 2993 ; Time = 14.277 sec.
a =...
You're going to need to explain more if you want help.
I'm trying to work through problem 251 on Project Euler. Problem 251 - Project Euler
I've got a working algorithm with a few shortcuts while maintaining 100% accuracy. However, it isn't fast...
Run this. I'll give you my Timer.
public class Tester {
/**
* @param args
*/
public static void main(String[] args) {
That solved it. How fast does this algorithm run for you? I have a new computer with a very fast i7 in it. Does it run in about 10ms for you with out the debug printing? Just want to see how...
Because right triangles with perimeter 12 were the only ones found. The sides array was supposed to be added twice to perims.get(12) on two separate occasions. Which it was, but something apparently...
This is the code I'm using to print out perims.
for(int i = 0; i < perims.size(); i++)
{
System.out.print("perims:" + i +": ");
for(int[] j : perims.get(i))
{...
This is what I get when I print perims after everything is added together, before anything else happens.
Perimeter: 12 ; Sides: {3, 4, 5}
Perimeter: 12 ; Sides: {4, 3, 5}
perims:0: ...