This looks awfully obfuscated and overly complicated. Lets first change to a for loop:

Code:

for(whereIam = 6, numberHouses = 0; numberHouses < 10; whereIam++){
sum1 = (whereIam*(whereIam-1))/2;
lastHouse = static_cast<int>(-0.5 + 0.5*sqrt(1 + 8*whereIam*whereIam));
sum3 = (whereIam*(whereIam+1))/2;
sum2 = lastHouse*(lastHouse+1)/2 - sum3;
while(sum1 > sum2){
lastHouse++;
sum2 = lastHouse*(lastHouse+1)/2 - sum3;
}
if(sum1 == sum2){
numberHouses++;
std::cout << std::setw(10) << whereIam << std::setw(10) << lastHouse << std::endl;
}
}

Now we don't subtract sum3 from sum2 anymore; you will see why soon:

Code:

for(whereIam = 6, numberHouses = 0; numberHouses < 10; whereIam++){
sum1 = (whereIam*(whereIam-1))/2;
sum3 = (whereIam*(whereIam+1))/2;
lastHouse = static_cast<int>(-0.5 + 0.5*sqrt(1 + 8*whereIam*whereIam));
sum2 = lastHouse*(lastHouse+1)/2;
while(sum1 > sum2 - sum3){
lastHouse++;
sum2 = lastHouse*(lastHouse+1)/2;
}
if(sum1 == sum2 - sum3){
numberHouses++;
std::cout << std::setw(10) << whereIam << std::setw(10) << lastHouse << std::endl;
}
}

Now I move sum3 to the other side of the comparison and don't store sum2 at all:

Code:

for(whereIam = 6, numberHouses = 0; numberHouses < 10; whereIam++){
sum1 = (whereIam*(whereIam-1))/2;
sum3 = (whereIam*(whereIam+1))/2;
lastHouse = static_cast<int>(-0.5 + 0.5*sqrt(1 + 8*whereIam*whereIam));
while(sum1 + sum3 > lastHouse*(lastHouse+1)/2)
lastHouse++;
if(sum1 + sum3 == lastHouse*(lastHouse+1)/2){
numberHouses++;
std::cout << std::setw(10) << whereIam << std::setw(10) << lastHouse << std::endl;
}
}

Well, what is sum1 + sum3? It is equal to whereIam * whereIam:

Code:

for(whereIam = 6, numberHouses = 0; numberHouses < 10; whereIam++){
sum = whereIam*whereIam;
lastHouse = static_cast<int>(-0.5 + 0.5*sqrt(1 + 8*sum));
while(sum > lastHouse*(lastHouse+1)/2)
lastHouse++;
if(sum == lastHouse*(lastHouse+1)/2){
numberHouses++;
std::cout << std::setw(10) << whereIam << std::setw(10) << lastHouse << std::endl;
}
}

Now wait a second... What are you doing here? You are checking in some rather complex way whether x (x+1) is twice a square. That would happen very rarely, and you are searching for ten solutions. I suspect that things go wrong rather soon when whereIam > 23170 and the expression in the square root exceeds 32 bits. I guess you are compiling for a 64 bit machine on the Debian box. As evidence, see the output by another poster: The second column should be roughly equal to the first column times 1.4142; after the fifth value it is nowhere near.

I'd first switch to 64 bit arithmetic, using unsigned long long instead of unsigned long. The static_cast should cast to unsigned long long as well. The expensive square root calculation is actually unnecessary: Just initialise lastHouse to 0 before the loop starts (because the square root will get bigger and bigger results). So:

Code:

for(whereIam = 6, lastHouse = 0, numberHouses = 0; numberHouses < 10; whereIam++){
sum = 2*whereIam*whereIam;
while(sum > lastHouse*(lastHouse+1))
lastHouse++;
if(sum == lastHouse*(lastHouse+1)){
numberHouses++;
std::cout << std::setw(10) << whereIam << std::setw(10) << lastHouse << std::endl;
}
}