Hi
I have written this code:
but it will show this error for this line : obj.function(600851475143);
public class Three {
public static void main(String[] args) {
Three obj = new Three();
obj.function(600851475143);
}
private Long function(long i) {
Stack<Long> stack = new Stack<Long>();
fo...
Hi
this is the question ,really I have thought a lot but I think that we can not answer such a question in java.is it correct?
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit n...
I'm working on problem 12 regarding the first triangle number with 500 divisors. I tried to brute force the solution. I get 300 divisors in about 35 seconds and can't get 400 within 10 minutes. I'm going to alter my solution to use the prime factor method but I've seen now that people are still getting this solution with brute force i...
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
I have the following code but the answer does not match.
#include<stdio.h>
int main()
{
long unsigned int i,sum=0;
clrscr();
for(i=0;i<=1000;i++)
{
if((i%5==0)||(i%3==0))
{
...
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
I made the program but my answer doesnt match.
#include<stdio.h>
int main()
{
long unsigned int i,sum=0,x=1,y=2,num;
for(i=0;i<4000000;i++)
{
num=x+y;
...
Problem # 305
Let's call S the (infinite) string
that is made by concatenating the
consecutive positive integers
(starting from 1) written down in base
10.
Thus, S =
1234567891011121314151617181920212223242...
It's easy to see that any number will
show up an infinite number of times in
S.
Let's call f(n...
I take no credit for this challenge at all. It's Project Euler problem 6:
The sum of the squares of the first ten natural numbers is,
1^(2) + 2^(2) + ... + 10^(2) = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)^(2) = 55^(2) = 3025
Hence the difference between the sum of the squares of the first ten ...
Project Euler is a site with general algorithmic challenges that can be a part of just about any software but is there any challenges that focus on the overall end result of web apps? It should be compatible with just about any web framework in a similar way that project Euler can be done in any language.
...
Possible Duplicates:
Is there a bignum library for JavaScript?
Strange syntax of Number methods in JavaScript
I just wrote some code to figure out a Project Euler question.
I kept getting...
Uncaught SyntaxError: Unexpected token ILLEGAL
I couldn't see the syntax error in my code...
The number I'm using is 1000 digi...
I'm trying to do a Project Euler question.
I'm looking for the sum of all prime numbers under 2,000,000.
This is what I have...
int main(int argc, char *argv[]) {
unsigned long int sum = 0;
for (unsigned long int i = 0; i < 2000000; i++) {
if (isPrime(i)) {
sum += i;
}
}
printf("sum =>...