#!/usr/bin/perl

while(1) {

$y += $x++; $r=0;

for $z (1 .. sqrt($y)) {

$y % $z == 0 and $r+=2;

}

if ($r>499) {print “$x $y\n”;die}

}

This example is also ripped, I just can’t remember from whom!

Thanks for the article!

]]>That being said, it is about 5-10% slower than your solution on my computer. Most of the time seems to be in the “select” statement.

PalindromeQ[x_] := (y = ToString[x]; y == StringReverse[y]);

BiggestPalindrome[n_] :=

Module[{m =

KroneckerProduct[Range[10^(n – 1), 10^n – 1],

Range[10^(n – 1), 10^n – 1]]},

Max[Select[Flatten[m], PalindromeQ]]];

BiggestPalindrome[3]

The chance of a random n-digit number ending in 1, 3, 7 or 9 being prime, is around 1 in log(10^n) * 1/2 * 4/5 = 1 in 0.921n. From 98 to 184 digits this goes from 1 in 90 to 1 in 169. 98 digits was easy to reach but 43 further steps to 184 digits required a lot of tries (and went back to 28 digits at one time). ]]>

f[] := Module[{j = 0},

Do[If[Divisible[i, 3] || Divisible[i, 5], j = j + i], {i, 1000}];

Return[j];

];

In[6]:= f[] // Timing

Out[6]= {0.015, 234168}

Time Taken:.015s

]]>