Achievements‎ > ‎

### #4 Problem on project Euler

postado em 27 de ago de 2012 21:13 por Vatsu Ananab   [ 28 de ago de 2012 05:38 atualizado‎(s)‎ ]
 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. Find the largest palindrome made from the product of two 3-digit numbers. l = Flatten[Table[i*j, {i, 800, 999}, {j, 800, 999}]]; lp = {};f[k_] := ToString[l[[k]]]f1[k_] := (StringTake[f[k], {1, 1}] == StringTake[f[k], {6, 6}]) && (StringTake[f[k], {2, 2}] == StringTake[f[k], {5, 5}]) && (StringTake[f[k], {3, 3}] == StringTake[f[k], {4, 4}])DeleteDuplicates[ Table[If[f1[q] == True, AppendTo[lp, l[[q]]], False], {q, 1, Length[l]}]] // TableForm I've also made a plot with the distribution of the palindromic numbers: There's also one bigger, made with 100 instead of 800 in {i, 800, 999}, {j, 800, 999} thus (999-100)*(999-100) = 899*899 = 808201 operations performed for it's making, while the above plot has 39601 operations. Click them for zooming.Thanks to these guys.
Comments