A SAS solution

來源: 巡天劍客 2010-10-26 05:19:44 [] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (835 bytes)

%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.*/

加跟帖:

當前帖子已經過期歸檔,不能加跟帖!