Two identical strings: Difference between revisions

RPL: add section
(Add MACRO-11)
(RPL: add section)
Line 3,840:
Found 30 numbers whose base 2 representation is the juxtaposition of two identical strings
done...</pre>
 
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.8}}
≪ R→B →STR 3 OVER SIZE 1 - SUB
'''IF''' DUP SIZE 2 MOD '''THEN''' DROP 0
'''ELSE'''
1 OVER SIZE 2 / SUB
LAST SWAP DROP 1 + OVER SIZE SUB ==
'''END'''
≫ ‘'''TWIN?'''' STO
≪ BIN { } 1 999 FOR n
'''IF''' n '''TWIN?''' '''THEN''' n →STR "=" + n R→B →STR 2 OVER SIZE 1 - SUB + + '''END NEXT'''
≫ ''''TASK'''' STO
{{out}}
<pre>
1: { "3= 11" "10= 1010" "15= 1111" "36= 100100" "45= 101101" "54= 110110" "63= 111111" "136= 10001000" "153= 10011001" "170= 10101010" "187= 10111011" "204= 11001100" "221= 11011101" "238= 11101110" "255= 11111111" "528= 1000010000" "561= 1000110001" "594= 1001010010" "627= 1001110011" "660= 1010010100" "693= 1010110101" "726= 1011010110" "759= 1011110111" "792= 1100011000" "825= 1100111001" "858= 1101011010" "891= 1101111011" "924= 1110011100" "957= 1110111101" "990= 1111011110" }
</pre>
Runs on an HP-28S in 130 seconds.
 
=={{header|Ruby}}==
1,151

edits