Using only the digits 7, 8 and 9, how many positive seven-digit integers can be made that are palindromes?
a=7;b=7;c=7;d=7;e=7;f=7;g=7;p=0;cycle:n=a*1000000+b*100000+c*10000+d*1000+e*100+f*10+g;if(n<10000000 and a==g and b==f and c==e, goto loop, goto next); loop:printn," ",;p=p+1; next:g++;if(g<10, goto cycle, 0);g=7;f++;if(f<10, goto cycle, 0);g=7;f=7;e++;if(e<10, goto cycle,0);g=7;f=7;e=7;d++;if(d<10, goto cycle,0);g=7;f=7;e=7;d=7;c++;if(c<10, goto cycle,0);g=7;f=7;e=7;d=7;c=7;b++;if(b<10, goto cycle,0);g=7;f=7;e=7;d=7;c=7;b=7;a++;if(a<10, goto cycle,0);print"Total = ",p
OUTPUT: 7777777 7778777 7779777 7787877 7788877 7789877 7797977 7798977 7799977 7877787 7878787 7879787 7887887 7888887 7889887 7897987 7898987 7899987 7977797 7978797 7979797 7987897 7988897 7989897 7997997 7998997 7999997 8777778 8778778 8779778 8787878 8788878 8789878 8797978 8798978 8799978 8877788 8878788 8879788 8887888 8888888 8889888 8897988 8898988 8899988 8977798 8978798 8979798 8987898 8988898 8989898 8997998 8998998 8999998 9777779 9778779 9779779 9787879 9788879 9789879 9797979 9798979 9799979 9877789 9878789 9879789 9887889 9888889 9889889 9897989 9898989 9899989 9977799 9978799 9979799 9987899 9988899 9989899 9997999 9998999 9999999 Total = 81
P.S. There may be a "bug" in the code !! If so, please let me know. Thanks.