User:RandomUndergrad/Sandbox/Square as Difference between Square and Square of Reversal

Inspired by Square which is Difference between Square and Square of Reversal.

For each integer whose square can be expressed as a difference of squares of a number and its reversal,

the program outputs the number (and eventually its reversal).

Program output for bound $i < 10^7$ :

$56, 65, 5265, 5625, 5656, 6565, 12705, 44370, 50721, 51557, 55517, 56056, 59248, 65065, 71555, 75515, 84295,$ $139755, 273728, 360145, 481610, 523908, 541063, 557931, 560056, 560439, 565656, 606056, 621770, 650065, 650606,$ $656565, 697996, 699796, 809325, 827372, 934065, 1413885, 1607364, 2014650, 2815582, 2855182, 3961595, 4285190,$ $4364584, 4637061, 4771976, 4809216, 4854634, 4855180, 5054808, 5600056, 5609439, 5771975, 5791775, 5883141,$ $5951693, 6129084, 6262576, 6500065, 6701376, 6731076, 6752626, 6791774, 7288677, 7768827, 8084505, 9349065$

''Note: This was before I saw:

Well, at least it is a good programming exercise.''

The numbers above corresponds to (below $100 \, 000$):

Program code:

int num[10];                                           //number as array void init{                                           //initialize to 10 for (int i=0;i<10;i++) num[i]=0; num[1]=1; } void add{                                            //number++; num[0]++; for (int i=0;i<10;i++) {        if (num[i]==10) {                num[i]=0; num[i+1]++; }    } } int digit{                                            //real digit-1 for (int i=9;i>=0;i--) if (num[i]!=0) return i; } long long int sum{                                             //the number int sum=0; for (int i=0;i<10;i++) sum+=num[i]*pow(10,i); return sum; } long long int mus{                                             //rebmun eht int d=0; int mus=0; for (int i=digit;i>=0;i--) {        mus+=num[i]*pow(10,d); d++; }    return mus; } unsigned long long int eval{                                             //evaluate num^2-mun^2 unsigned long long int a = mus*mus-sum*sum; if (mus>sum) return a;    else return -a; } int main {    init; long int i;    for (i = 10; i<10000000;i++) {        add; if (eval!=0 & eval==(long int)sqrt(eval)*(long int)sqrt(eval)) printf("%lli,\n", sum); } }
 * 1) include 
 * 2) include 