Largest palindrome product: Difference between revisions

Added Easylang
(Added Quackery.)
(Added Easylang)
 
(2 intermediate revisions by 2 users not shown)
Line 513:
3 913 993 906609
4 9901 9999 99000099
</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
fastfunc rev n .
while n > 0
r = r * 10 + n mod 10
n = n div 10
.
return r
.
for i = 100 to 999
for j = i to 999
p = i * j
if p > max and p = rev p
max = p
.
.
.
</syntaxhighlight>
{{out}}
<pre>
906609
</pre>
 
Line 1,368 ⟶ 1,391:
Found in 6 iterations
done...</pre>
 
=={{header|RPL}}==
≪ "" OVER SIZE 1 '''FOR''' j
OVER j DUP SUB +
-1 '''STEP''' NIP
≫ '<span style="color:blue">REVSTR</span>' STO
≪ 1 CF
'''DO'''
1 -
DUP →STR DUP <span style="color:blue">REVSTR</span> + STR→
DUP DIVIS SORT
1 OVER SIZE '''FOR''' j
DUP j GET
DUP XPON 2
'''CASE'''
DUP2 < '''THEN''' 3 DROPN '''END'''
> '''THEN''' DROP DUP SIZE 'j' STO '''END'''
PICK3 SWAP /
'''IF''' XPON 2 == '''THEN''' 1 SF '''END'''
'''END'''
'''NEXT''' DROP2
'''UNTIL''' 1 FS? '''END'''
→STR DUP <span style="color:blue">REVSTR</span> + STR→
≫ '<span style="color:blue">P004</span>' STO
 
1000 <span style="color:blue">P004</span>
{{out}}
<pre>
1: 906609
</pre>
 
=={{header|Sidef}}==
Line 1,401 ⟶ 1,455:
=={{header|Wren}}==
The approach here is to manufacture palindromic numbers of length 2n in decreasing order and then see if they're products of two n-digit numbers.
<syntaxhighlight lang="ecmascriptwren">var reverse = Fn.new { |n|
var r = 0
while (n > 0) {
2,058

edits