文学城论坛
+A-

A SAS solution

巡天剑客 2010-10-26 05:19:44 ( reads)

%let How_Many = 3;

data even_digit_symmetric_squares (keep=i sq);
  retain m i;

  do while (m < &How_Many);
    i+1;
    sq = i**2;

    if mod(length(strip(put(sq,32.))),2) = 0 and strip(put(sq,32.)) = strip(reverse(put(sq,32.))) then do;
      m+1;
      output;
      put i= ", " sq=;
    end;
  end;
run;

proc print data=even_digit_symmetric_squares noobs;
  format i sq 32.;
run;
/* Note: Do not try to find the 4th using SAS (on UNIX). The largest integer SAS can process is 9,007,199,254,740,992, which is about twice of the 3rd. I don't think the 4th has 16 digits.*/

跟帖(0)