Positive decimal integers with the digit 1 occurring exactly twice: Difference between revisions

Content added Content deleted
m (→‎{{header|RPL}}: optimized code)
(→‎{{header|Euler}}: Sybntax highlight with Mediawiki markup)
Line 173: Line 173:
=={{header|Euler}}==
=={{header|Euler}}==
As with the Arturo, F# etc. samples, generates the sequence but doesn't sort it into order.
As with the Arturo, F# etc. samples, generates the sequence but doesn't sort it into order.
'''begin''' '''new''' dPos; '''new''' non1digits; '''label''' digitLoop;
<syntaxhighlight lang="euler">
begin new dPos; new non1digits; label digitLoop;
non1digits &lt;- ( 0, 2, 3, 4, 5, 6, 7, 8, 9 );
non1digits <- ( 0, 2, 3, 4, 5, 6, 7, 8, 9 );
dPos &lt;- 0;
digitLoop: '''if''' [ dPos &lt;- dPos + 1 ] &lt;= '''length''' non1digits '''then''' '''begin'''
dPos <- 0;
'''new''' d;
digitLoop: if [ dPos <- dPos + 1 ] <= length non1digits then begin
new d;
d &lt;- non1digits[ dPos ];
d <- non1digits[ dPos ];
'''out''' [ d * 100 ] + 11; '''out''' [ d * 10 ] + 101; '''out''' 110 + d;
out [ d * 100 ] + 11; out [ d * 10 ] + 101; out 110 + d;
'''goto''' digitLoop
goto digitLoop
'''end''' '''else''' 0
'''end''' $
end else 0
end $
</syntaxhighlight>
{{out}}
{{out}}
<pre>
<pre>