[Question]
  [
Let's define the a function on natural numbers \$n\$, written as base 10 digits \$d\_k\; d\_{k-1}\; \dotsc\; d\_1\; d\_0\$, as follows:
As long as there are equal adjacent digits \$d\_i\;d\_{i-1}\$, replace them by their sum \$d\_i+d\_{i-1}\$ from left to right. If there were any such digits, repeat the same procedure.
In other words, in each iteration we greedily take all pairs of equal adjacent digits and replace them by their sum at the same time (using the left-most pair if they overlap).
## Example
Let's take \$\texttt{9988}\$ for example:
1. The first adjacent digits which are equal are the two \$\texttt{9}\$
2. So we replace them by \$\texttt{9 + 9} = \texttt{18}\$ which gives us \$\texttt{1888}\$
3. Since we're still in the first left-right traversal and there were still two \$\texttt{8}\$s we need to first replace these
4. So we get \$\texttt{1816}\$
5. Something changed, so we need to do another iteration
6. But there are no such digits, so we stop
Therefore the \$9988^\text{th}\$ number in that sequence is \$1816\$.
## Challenge
The first 200 terms are:
```
0,1,2,3,4,5,6,7,8,9,10,2,12,13,14,15,16,17,18,19,20,21,4,23,24,25,26,27,28,29,30,31,32,6,34,35,36,37,38,39,40,41,42,43,8,45,46,47,48,49,50,51,52,53,54,10,56,57,58,59,60,61,62,63,64,65,12,67,68,69,70,71,72,73,74,75,76,14,78,79,80,81,82,83,84,85,86,87,16,89,90,91,92,93,94,95,96,97,98,18,10,101,102,103,104,105,106,107,108,109,20,21,4,23,24,25,26,27,28,29,120,121,14,123,124,125,126,127,128,129,130,131,132,16,134,135,136,137,138,139,140,141,142,143,18,145,146,147,148,149,150,151,152,153,154,20,156,157,158,159,160,161,162,163,164,165,4,167,168,169,170,171,172,173,174,175,176,24,178,179,180,181,182,183,184,185,186,187,26,189,190,191,192,193,194,195,196,197,198,28
```
Your task is to generate that sequence, either
* given \$n\$, return the \$n^\text{th}\$ number in that sequence,
* given \$n\$, return the first \$n\$ numbers in that sequence
* or generate the sequence indefinitely.
You may choose your submission to use either \$0\$- or \$1\$-indexing, but please specify which.
## Test cases
You may use the above given terms, however here are some larger ones:
```
222 -> 42
1633 -> 4
4488 -> 816
15519 -> 2019
19988 -> 2816
99999 -> 18189
119988 -> 21816
100001 -> 101
999999 -> 181818
```
  
[Answer]
# [Python 3](https://docs.python.org/3/), 128 bytes
```
def t(z):j=z and(z[0]==z[1:2])+1;return[str(int(z[0])*j),*t(z[j:])]if j else''
def c(n):r="".join(t(n));return r!=n and c(r)or r
```
[Try it online!](https://tio.run/##lZPdTtwwFITv9ylcekFCB@Txv7favgjaC1RC2VUbUEildhHPTscs/6pUNdpNHHvO8fE3Ode/58ur0d/fnw8XZu52/XK72pmz8bzbndr1arU75dKt@0/8PA3zz2k8vZmnbjPOD8v90bbHURtvl@t@vbkwWzN8vxkODxct3ddu7JfT6uDgZHu1GbtZr/1jGjN9WI1tG4mm/moy0/3io7HHrHUxDzfzcG5WZjobvw2dhXHW9ovh1/Xwdb9wakE4eAREJGQUVNBqivp5MIARTGAGC1jhtEjJnYfTPcIluAxX4Cq8hSe8Uyof4CO8Bhm@wFcszKsrWASlcQhee4aIkBAygsYV0SIS0SF6xNDqiQkxIxbEimSRiKRNPFJAiq3WlJEKUkW2yER2yB45IEfk1I6RC/K7GopFIYpDUQ0BJaIklNyOWyqqRSWqQ/WoATWiJtSMWh5ICJyl/sJkxcm2MlWJ1WZWKWyT/IPWm2IoKaVtxKWma892NCVUBBVCxVCIKcYU5GaLMFOc6dtYMqGmWFN8GVo2yYS4VSzIDI2FZKG9SybSFGqKNQWbot3qEG6KNwWc8X2h4k8ZwNQqUIw8oExo98ZOIbKB8oEygnKCsoLygjKDcqMdTXZQflAeUCZQLrC0OrUmIygnKCva6eUFZQblBmUH5QdlCOUIZQnlCWWKK@vFhb7/Eeb5A9@MZre57vZ98DLfLx9OdD219ju4vTPHX8zt3cGJwn@cqbmgXmrdqS7r@4Xa6Wq@HKabxf7R2uYhvnPOwQTX7wF1ouH1/vQaQikwhel5PUY1kHqQ9Xmq1iZyr1S1XTCiUl5kTzq@Tmd1UUrLN7GPwSya/SuS/TH@i8H9Hw "Python 3 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~97~~ ~~96~~ 93 bytes
```
def f(n):r=re.sub(r'(.)\1',lambda m:`int(m.group(1))*2`,n);return r!=n and f(r)or r
import re
```
[Try it online!](https://tio.run/##XYxBbsIwEEX3PsVUXcRThchjCrKD6Em6ICgOWGqcaHAWnD4YpOLA7Oa///54jech6HluXQedDFjznl11mY6SC1nhLxXlX9Mf2wb6@uBDlH114mEaJSF@6UMZcMcuThyAP/YBmtCmGcaBgYXvx4EjsJu79HvwqdSEk5NaKawFjJwGU/0SWXrEUjwCIf7zQmtdIHwCrH7gW@ectut1Bot8syH7BFqRXTBrjcnM0DYze78nI0NmKb6Z9KKSSkfZVfQ2@7pLZr4B "Python 2 – Try It Online")
---
Non regex version:
# [Python 2](https://docs.python.org/2/), ~~133~~ ~~130~~ ~~122~~ ~~112~~ 98 bytes
```
def f(n):
 r='';s=n
 while s:a=1+(s[0]==s[1:2]);r+=`int(s[0])*a`;s=s[a:]
 return r!=n and f(r)or r
```
[Try it online!](https://tio.run/##XY3LCsIwEEX3@YoRF218QCZqSSrxR0rBgK0NSCyTivj1NQqa6ixmcc@cO/1j6K5ejuOpaaHNPS8ZkMmyfTCewb1zlwZCaQ0u81CJ2phQYSlrvqelOTo/vFO@sMcohMqWddSb4UYeaGY8WH@KrcSvBDS2cTtwEVl/bnIpxOtbT7EmHoWBcsf5ir0Dxj55JqXMOMwB1gfYypRjsdkkMMl3O9RfIAXqCdNaqcQUFonp13wZKlRT8c/EHxVFHEyuwL/a315U4xM "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 11 bytes
```
DŒg+2/€FVµ¡
```
This is an unnecessarily slow, full program.
[Try it online!](https://tio.run/##y0rNyan8/9/l6KR0bSP9R01r3MIObT208P///4ampoaWAA "Jelly – Try It Online")
### Alternate version, 12 bytes
```
DŒg+2/€FVµƬṪ
```
One byte longer, but much faster. Works as a program or a function.
[Try it online!](https://tio.run/##y0rNyan8/9/l6KR0bSP9R01r3MIObT225uHOVf@P7lE43A4UUXD//9/IyEhHwdDM2FhHwcTEwgLINjU1tARSlpYgniUIAHlQrqEBEBhChS0B "Jelly – Try It Online")
### How it works
```
DŒg+2/€FVµƬṪ  Main link. Argument: n (integer)
         µ    Combine the previous links into a chain. Begin a new one.
D               Decimal; yield n's digit array in base 10.
 Œg             Group adjacent, identical digits into subarrays.
   +2/€         Map non-overlapping, pairwise sum over the subarrays.
                If there is an odd number of digits in a subarray, the
                last digit will remain untouched.
       F        Flatten; dump all sums and digits into a single array.
        V       Eval; turn the result into an integer.
          Ƭ   Execute the chain 'til the results are no longer unique.
              Return all unique results.
           Ṫ  Tail; extract the last result.
```
The 11-byte version does the same, except it calls the link **n** times for input **n**, instead of calling it until a fixed point is reached.
[Answer]
## Haskell, 70 bytes
```
until((==)=<<f)f
f(a:b:c)|a==b=show(2*read[a])++f c|1<2=a:f(b:c)
f a=a
```
Input is taken as a string.
[Try it online!](https://tio.run/##NYrLDoIwFET3fMUNq1bU2AqGEu4f6MqlGnNFCsSCDY@48dut1MTZnJyZqWl4lMa4Cs9u6sbGMIbIMc8114FmlN2ygr8J8YZD/XwxuehLup/owqNIQ/EWuUTKNPO3QAMhuZaaDhBasocrMDuNx7Hfd7CGigOcQilluAzFbrudEcdp6i1JhPJU6ufKx/u/EJs54r@o8OI@hTZUDW5VWPsF "Haskell – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 16 bytes
```
+`(.)\1
$.(2*$1*
```
[Try it online!](https://tio.run/##K0otycxLNPz/XztBQ08zxpBLRU/DSEvFUOv/fyMjIy5DM2NjLhMTCwsuQ1NTQ0suQ0tLINsSBLgMIRxDAyAwhIhZAgA "Retina – Try It Online") Link includes test cases. Explanation:
```
+`
```
Repeat until the input stops changing.
```
(.)\1
```
Replace pairs of adjacent digits...
```
$.(2*$1*
```
... with twice the digit. (`$1*` generates a string of `$1` `_`s, `2*` duplicates that, and `$.(` takes the length. Actually, the Retina engine is cleverer than that and just doubles `$1`.)
[Answer]
# JavaScript, ~~48~~ ~~47~~ 46 bytes
Input and output as strings. Returns the `nth` term of the sequence.
```
f=s=>s-(s=s.replace(/(.)\1/g,x=>x/5.5))?f(s):s
```
[Try it online](https://tio.run/##XZBRa4MwFIXf/RXiU8I0elMtyUBHGQ72sJfq2xyLOC0tLooZw/16l9S2WM/b/XLOPdycyt9SVcOx//Fk91VPUxOrOFEeUrEiQ923ZVUjHxFcgH9wxzgZ/YhEGD81SOFHNVWdVF1bk7Y7IOHdq5Avr/sst2kQ2Hm6f8sKuXIIbC0XvBNCdsNQ/iEdwR/ku@wR@nRHHCcNGh@EwJicuqMUrr1KiuXqQuaprn3eZeld5brNciiljmtr@b4dUsuB7WZzBma2nDBk7Doy2Or3KAJuiAY0AK4J57PHkLOHG10IMGDGdHUZE8ybAi2YEQRwiXHnFgNmzR/QLG6e/gE)
* 1 byte saved thanks to [Arnauld](https://codegolf.stackexchange.com/users/58563/arnauld)
* 1 byte saved thanks to tsh
[Answer]
# [Perl 6](http://perl6.org/), 37 bytes
```
{($_,{S:g[(\d)$0]=2*$0}...*==*)[*-1]}
```
[Try it online!](https://tio.run/##JYhNCsIwFAav8lEe0gYb8tIfGjW9hMtagqBxY6nUVQk5e6x0VjPzeS7vNk0rDh42hZzcMVxPryG/PQpSo9WCVJRSCmtFMYiSx5i@9xUZOZQ9gge5mMHPCy5aa3BbVajrrgM3DRuwMZubP@A9WG3w/kx/Tj8 "Perl 6 – Try It Online")
This is a function which generates the nth term of the sequence, given n as its argument.
`($_, { ... } ... * == *)` is the sequence of successive changes to the input number, generated by the bracketed expression (a simple regex substitution) and stopping when `* == *`, that is, when the last two numbers in the sequence are equal. Then the `[*-1]` takes just the final element of that sequence as the return value.
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), ~~231~~, ~~203~~, ~~200~~, ~~196~~, 192 bytes
EDIT: Function is now at 185 bytes plus 18 for `using System.Linq;`
Thanks to BMO (for 1>0 being equal to true plus newline removal) and Mr. XCoder (for f=!f statements)!
EDIT2: Down to 182 bytes plus 18 for `using System.Linq` thanks to dana for sharing a few golf tips!
EDIT3: Thanks to Embodiment of Ignorance for the int[] -> var, removal of short circuit && -> &, and changing up ToArray -> ToList! (178 bytes + 18 using)
EDIT4: Embodiment of Ignorance dropped 4 bytes by changing an assignment. Dummy me shoulda counted! Thanks again :D
```
p=>{var f=1>0;while(f){var t=p.Select(n=>n-48).ToList();p="";f=!f;for(var j=0;j<t.Count;j++){if(j<t.Count-1&t[j]==t[1+j]){p+=t[j]+t[++j];f=!f;continue;}p+=t[j];}};return p;};
```
[Try it online!](https://tio.run/##TZAxa8MwFIR3/wrVQ5FQbWLo4PAiL4FOKRRS6OBmsFUplXEkV3pOKca/3bWbEMobjvvuccPJkEjn1dQHY49k/xNQnSD679KdsV8QybYKgbx4d/TVaYgI6fq6NZIErHCWszMf5LkylrIlJOSpt3IT0M9FDxcpSE3E1IliOFeeaJEVK/j@NK2imv0hFF26V62SSK0obPKYs/TV7UxAyqATcQxa3GnQztPlvREraDaYbl1vERrO2WA0vZEku8eyOQiBZcabAxs6LhbAseSzv3RJZ9HYXsF4TWEcwSvsvSUdjDBdN9g6G1yr0jdvUNGaxut1nseMx@82ZhCN802/ "C# (.NET Core) – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, 21 bytes
```
s/(.)\1/$1*2/ge&&redo
```
[Try it online!](https://tio.run/##K0gtyjH9/79YX0NPM8ZQX8VQy0g/PVVNrSg1Jf//f0sQ@JdfUJKZn1f8X7cAAA "Perl 5 – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt) v2.0a0 [`-h`](https://codegolf.meta.stackexchange.com/a/14339/58974), ~~15~~ 14 bytes
Returns the `nth` term of the sequence.
```
Æ=s_r/(.)\1/ÏÑ
```
[Try it](https://ethproductions.github.io/japt/?v=2.0a0&code=xj1zX3IvKC4pXDEvz9E=&input=OTk4OAotaA==)
This should work for 10 bytes but there seems to be a bug in Japt's recursive replacement method.
```
e/(.)\1/ÏÑ
```
[Answer]
# [Groovy](http://groovy-lang.org/), 63 bytes
```
{s->r=/(\d)\1/
while(s=~r)s=s.replaceAll(r){(it[1]as int)*2}
s}
```
[Try it online!](https://tio.run/##Sy/Kzy@r/J9m@7@6WNeuyFZfIyZFM8ZQn6s8IzMnVaPYtq5Is9i2WK8otSAnMTnVMSdHo0izWiOzJNowNrFYITOvRFPLqJaruPZ/QRGQk5OnkaahZGRkpKSpyYUkYmhmbIwmZGJiYYGuytTU0BJdzNISQ50lCKCrw6bQ0AAIDLHpBmn/DwA "Groovy – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 11 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
Δγε2ôSO}˜J
```
[Try it online](https://tio.run/##yy9OTMpM/f//3JRzm89tNTq85VHTmmD/2tNzvP7/N7QEAQsLSwA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/c1PObT631ejwlkdNa4L9a0/P8fpfq/M/2sjISMfQzNhYx8TEwkLH0hJIGJqaGlrqGILZliCgYwjhGBoAgSFEDKzAEiRsGQsA).
**Explanation:**
```
Δ             # Continue until the (implicit) input no longer changes:
 γ            #  Split the integer in chunks of the same adjacent digits
              #   i.e. 199999889 → [1,99999,88,9]
  ε     }     #  Map each to:
   2ô         #   Split it into parts of size 2
              #    i.e. 99999 → [99,99,9]
     €S       #   Split each part into digits
              #    i.e. [99,99,9] → [[9,9],[9,9],[9]]
       O      #   And take the sum of each part
              #    i.e. [[9,9],[9,9],[9]] → [18,18,9]
         ˜    #  Flatten the list
              #   i.e. [[1],[18,18,9],[16],[9]] → [1,18,18,9,16,9]
          J   #  Join everything together
              #   i.e. [1,18,18,9,16,9] → 118189169
              # (And output the result implicitly at the end)
              #  i.e. output = 28189169
```
[Answer]
# Wolfram Language 108 bytes
```
ToExpression[""<>ToString/@Total/@Flatten[Partition[#,UpTo@2]&/@Split@IntegerDigits@#,1]]&~FixedPoint~#&
```
## Explanation
`IntegerDigits` transforms the input number into a list of its digits.
`Split` groups consecutive repeated digits.
`Partition[#, UpTo@2]&/@` breaks runs of like digits into lists of, at most, lengths of 2.
`Flatten[...,1]` eliminates occasional overly-nested braces--e.g., {{2,2}} becomes {2,2}
`Total/@` sums totals of paired digits. Isolated digits need not be summed.
`ToString` converts the totals (and isolated digits) to strings.
`""<>` joins all the strings in the list.
`ToExpression` converts the outcome to an integer.
`...~FixedPoint~#&` applies the function until the result ceases to change.
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc) with flag `/u:System.Text.RegularExpressions.Regex`, 70 bytes
```
s=>{for(;s[0]!=(s[0]=Replace(s[0],@"(.)\1",m=>m.Value[0]*2-96+"")););}
```
Outputs by modifying the input. Takes in a list containing one string for input.
Thanks to @dana for golfing an entire 23 bytes! 
[Try it online!](https://tio.run/##TZBNT4QwEIbv/IraE1UWF/Yji2yJHrztaTV6WPdAyLA24SudohjCX7e2CybMZd4@eTt9pxkuMhT6KVOirvYHgWqPSorqkiQ518iTPq@lG@Npeb7hrm38CE2RZnA9eI/U9dlHQL2SJ6X/lhYtGHwbLqLtHaWMxSwedOyMM09nogAVEk56hxAahiH1rAi2q9Wo1uvdbmKbTRBNMor@aWRrojMcLE0FM4v1DLFjwkOafbpfqbw@TUQ1RmA2gaXIK/gm88V7azB3Se4iM@1dCgUHUY0bGzLo37qx/4X6vn14@UEFpf8KnfKPcGmLVD53jQRE67AIuj8 "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), 118 bytes
```
import StdEnv,Data.List
$[a,b:t]|a==b=[1,(a*2)rem 10]%(1-a/5,1)++ $t=[a: $[b:t]]
$l=l
```
# 
```
limit o iterate$o map digitToInt
```
[Try it online!](https://tio.run/##PY7NCoJAFEb3PsVdTKSllUKbYHa2EFwEtRtc3HSUC/MjeguCnr2pCFp@cA7na41GF6zvbkaDRXKB7OgnhjN3R3dPS2Tc1DRzJBSm1wM3T5TyKlWexrgqkklbyHfNIs4z3O7TPFmvQbBUeAChvngTCSNN6G@uZfIOJBiyxOCBWE/IWvhPd4SOBuKLrxxHZ8bPAQl/Ry2Lolg24dX2Boc5ZFUdyodDS@1vnAxy7yf7Bg "Clean – Try It Online")
Takes the first repeated value (`limit`) from the infinite list of applications (`iterate`) of a lambda performing a single step of the collapsing process. Input taken as a `[Char]`.
[Answer]
# [Red](http://www.red-lang.org), ~~84~~ ~~83~~ 80 bytes
```
func[n][if parse s: form n[to some change[copy d skip d](2 * do d)to end][f s]s]
```
[Try it online!](https://tio.run/##VYqxDsIgFEX3fsUd1Uloa0o/w5UwNDxQYvogUAe/HuugtWe6J@dmR/XqSJvGj9U/2Wo2OnikKReHMsLHPIP1ElHi7GDvE9@ctjG9QCiPkEDmIHECRdBxvTkmoz2KKaamHHiBh5Sy@W5xadufdN0wbKXvhdpMqb@mPmxtH8V5Rey/qr4B "Red – Try It Online")
Returns the `nth` term of the sequence.
## Explanation:
```
Red[]
f: func [ n ] [
    if parse s: form n [  ; parse the input converted to a string
        to some change [  ; find and change one or more
            copy d skip   ; digit (in fact any character, no predefined character classes)
            d             ; followed by itself
        ] (2 * do d)      ; with its doubled numeric value 
        to end            ; go to the end of the string
    ] [ f s ]             ; call the function with the altered string if parse returned true
    s                     ; finally return the string 
]
```
[Answer]
# [Scala](http://www.scala-lang.org/), 84 bytes
```
s=>{var t=s
while(t!=(t="(\\d)\\1".r.replaceAllIn(t,m=>s"$m"(0)*2-96+""),t)._2){}
t}
```
[Try it online!](https://tio.run/##bYw7C8IwGEX3/ooYHBKtxcRajBDBRXBwcrQisaZaibE0nw8o/e31tUj1LhcO516XKKPq8/aoE0ALlVmk76DtzqFpnqPSu6oCpWM0u9gEsrNlqyUUmd376NNrWTs5KV8WSOfdDpnRBFqSgMQkjnc0jhkOiqDQuVGJnhoztwT8k5w43D5h0qcd3hNRF2PqAw02nJaVB1WdP8/BWJISzDnHlHpfhEWDQQOF4WjUtIZDJppMiB9PvNL0/oms/wz7t37Pq/oB "Scala – Try It Online")
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 111 bytes
```
s=>{var t=s;do{s=t;t="";for(int i=0;i<s.Length;)t+=s[i]%48*(s[i++]!=(s+0)[i]?1:2*++i/i);}while(t!=s);return t;}
```
[Try it online!](https://tio.run/##RU7BbsIwDL33K0y1SQnJWBMKSglht52474A4lC5ApClMjRmTqn57l1Jgvvg9v@dnV@GlCq57P/tqGbB2/sCHtoI9mC6YVfNT1oAm6M9TEwxqNGmq96eaOI/gTKbdMkzW1h/wqCkyEzZu@5yrMYmAse3IkMAyGodvYiHHjLlXR3V7ObovS3BkAtW1xXPtAXXb6SSJ0basjuSaX3Lo244C2hDPefD2stk2CRApJYdcUh6xmE@nkVxxnivFQYn5oMxmouAgM1EMvCh6Wd71oi8OQgl1M9wd4hGRxRLRk4n/lduOUHHU0gTgo3Zo185b8pQ6v4Cmf3hSthzs7/ed7iItK4x0TwadpSltU6q7Pw "C# (Visual C# Interactive Compiler) – Try It Online")
HUGE credit to @ASCIIOnly for golfing ~30 ;) At first we were both posting updates simultaneously, but at some point he clearly went to town!
-2 thanks to @EmbodimentOfIgnorance!
Less golfed code...
```
// s is the input as a string
s=>{
  // t is another string used
  // to hold intermediate results
  var t=s;
  // the algorithm repeatedly
  // processes s and saves the
  // result to t
  do{
    // copy the last result to s
    // and blank out t
    s=t;
    t="";
    // iterate over s
    for(int i=0;i<s.Length;)
      // append either 1 or 2 times
      // the current digit to t
      t+=s[i]%48*
        // compare the current digit
        // to the next digit. to prevent
        // an out-of-bounds exception,
        // append a 0 to s which either
        // gets ignored or collapses
        // to 0
        (s[i++]!=(s+0)[i]
          // if they are different, then
          // the multiplier is 1
          ?1
          // if they are the same, then
          // the multiplier is 2, and we
          // have to increment i
          :2*++i/i);
  }
  // continue this until the input
  // and output are the same
  while(t!=s);
  return t;
}
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 15 bytes
```
→U¡ödṁoṁodΣC2gd
```
[Try it online!](https://tio.run/##yygtzv7//1HbpNBDCw9vS3m4szEfhFPOLXY2Sk/5//@/oaGlpYUFAA "Husk – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-p`, ~~39~~ 34 bytes
-5 bytes thanks to [Steffan](https://codegolf.stackexchange.com/users/92689/steffan)
```
$_.gsub!(/(.)\1/){$1.to_i*2}&&redo
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpclm0km6BUuyCpaUlaboWN5VU4vXSi0uTFDX0NfQ0Ywz1NatVDPVK8uMztYxq1dSKUlPyISoXwChDU1NDSwgHAA)
]