Two identical strings

From Rosetta Code
Two identical strings is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task

Find and display   (here on this page)   positive integers whose base 2 representation is the concatenation of two identical binary strings,
where   n   (in base ten)   <   1,00010       (one thousand).

For each decimal number,   show it's decimal form and also it's binary form.

REXX

<lang rexx></lang> out


Ring

<lang ring> load "stdlib.ring"

decList = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] baseList = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"]

see "working..." + nl see "Numbers whose base 2 representation is the juxtaposition of two identical strings:" + nl

row = 0 limit1 = 1000

for n = 1 to limit1

   bin = decimaltobase(n,2)
   ln = len(bin)
   if ln%2 = 0
      if left(bin,ln/2) = right(bin,ln/2)
         row = row + 1
         see "" + n + "(" + bin + ")  "
         if row%5 = 0
            see nl
         ok
      ok
    ok

next

see "Found " + row + " numbers whose base 2 representation is the juxtaposition of two identical strings" + nl see "done..." + nl

func decimaltobase(nr,base)

    binList = [] 
    binary = 0
    remainder = 1
    while(nr != 0)
         remainder = nr % base
         ind = find(decList,remainder)
         rem = baseList[ind]
         add(binList,rem)
         nr = floor(nr/base) 
    end
    binlist = reverse(binList)
    binList = list2str(binList)
    binList = substr(binList,nl,"")  
    return binList

</lang>

Output:
working...
Numbers whose base 2 representation is the juxtaposition of two identical strings:
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)  
Found 30 numbers whose base 2 representation is the juxtaposition of two identical strings
done...