for(long i = 1;i< 600851475143; i++ ){

The rest of the code works however I am testing against this number and I get an error: Out of range of int.

How can I create boolean tests against a larger variable.

Thank you.

What do you want to test? What is the biggest value it can hold?

literal numbers like that default to int. For bigger numbers append an "L" to indicate that you want a long value.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.