• Because off another thread I thougth about this puzzle.

    Because the puzzle is solved mainly using a lot of REPLACE functions.

    Analytical I had allready determined that there would never be a four in the string. But I still build in a safeguard in case I had made a mistake in the analys or otherwise.

    Also I build in a length restriction and a number of loops restriction.

    The string does not continue to grow (was supprised a little bit by that). It starts 'repeating' itself after a few loops.

    ADDITIONAL, my conclusion that the string does not continue to grow was not correct. So I should have investigated further, before jumping to that conclusion. 20130124 13:47 (Sorry::crying:)

    Maybe my next 'project' is building a Turing machine based on the replace only. (The length of the bittape will be limited and not be endless as in the Turing machine).

    Ben Brugmen.

    declare @continue int = 1

    declare @DeString varchar(4000) = '1'

    declare @counter int = 0

    While @continue = 1

    begin

    set @DeString = REPLACE(@destring, '1111','fourone')

    set @DeString = REPLACE(@destring, '111','threeone')

    set @DeString = REPLACE(@destring, '11','twoone')

    set @DeString = REPLACE(@destring, '1','oneone')

    set @DeString = REPLACE(@destring, '2222','fourtwo')

    set @DeString = REPLACE(@destring, '222','threetwo')

    set @DeString = REPLACE(@destring, '22','twotwo')

    set @DeString = REPLACE(@destring, '2','onetwo')

    set @DeString = REPLACE(@destring, '3333','fourthree')

    set @DeString = REPLACE(@destring, '333','threethree')

    set @DeString = REPLACE(@destring, '33','twothree')

    set @DeString = REPLACE(@destring, '3','onethree')

    set @DeString = REPLACE(@destring, 'three','3')

    set @DeString = REPLACE(@destring, 'two','2')

    set @DeString = REPLACE(@destring, 'one','1')

    print convert(varchar(4),@counter)+' '+convert(varchar(20),datalength(@destring)) +' ' +

    convert(varchar(200),@destring)

    set @counter = @counter + 1

    if @counter > 100 begin set @continue = 0 end

    if @DeString like '%four%' begin set @continue = 0 end

    if datalength(@destring)>2000 begin set @continue = 0 end

    end