### Project Euler Problem 3

I keep getting an error but I think its a stupid mistake which I cannot find o.o just started so... any help is appreciated.
Problem :
The prime factors of 13195 are 5, 7, 13 and 29.

What is the largest prime factor of the number 600851475143 ?
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283`` ``````#include using namespace std; bool isprime(long long n); long long fbp (long long n); int main() { //============================================================================= /* Euler 1 sum=0; for(int i=0;i<1000;i++) { if(i%3==0 ||i%5==0 ) { sum=sum+i; } } cout<< sum; */ //============================================================================= //============================================================================= /* Euler 2 int current, next, total,temp; current =1; next = 2; total=0; while(total<4e6) { if(current%2==0) { total+=current; } temp= current; current = next; next = temp+current; } cout << total << endl; */ //============================================================================= unsigned long long lpf = 600851475143; cout << fbp(lpf) << endl; return 0; } long long fbp(long long n) { long long factor; for(long long i = 3; i <= n; i += 2) { if(n % i == 0) { if(isprime(i)) { factor = i; cout << factor << endl; } } } return factor; } bool isprime(long long n) { if(n%2== 0) { return 0; } for(long long i = 3; i <= ((n/2)+1);i +=2) { if(n%i== 0) { return 0; } } return 1; }``````