Two identical strings: Difference between revisions

no edit summary
(Add PL/I)
No edit summary
Line 2,150:
twoidenticalstringsinbase(16, 999)
</lang>{{out}}<pre>Same as filter version above.</pre>
 
=={{header|Liberty BASIC}}==
<lang liberty basic>'Not testing 1 since it only has one binary digit
For i = 2 To 1000
bin$ = DecToBin$(i)
'Only test those binary numbers evenly
'divisible by 2
If Not(Len(bin$) Mod 2) Then
leftBin$ = Left$(bin$, (Len(bin$)/2))
rightBin$ = Right$(bin$, (Len(bin$)/2))
If (leftBin$ = rightBin$) Then
Print i;" - ";bin$
End If
End If
Next i
End
 
Function DecToBin$(decNum)
If decNum < 0 Then
decNum = (65535 + decNum + 1)
End If
If ((decNum <> 0) And (decNum = Int(decNum))) Then
decNum = Abs(decNum)
Do
If (decNum And 2^i) Then
DecToBin$ = "1" + DecToBin$
Else
DecToBin$ = "0" + DecToBin$
End If
i = i + 1
Loop Until (2^i > decNum)
Else
DecToBin$ = "0"
End If
End Function</lang>
 
{{out}}
 
<pre>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>
 
=={{header|MAD}}==