[Question]
  [
Consider taking some non-negative integer such as 8675309 and computing the absolute values of the differences between all the pairs of neighboring digits.
For \$8675309\$ we get \$|8-6| = 2\$, \$|6-7| = 1\$, \$|7-5| = 2\$, \$|5-3| = 2\$, \$|3-0| = 3\$, \$|0-9| = 9\$. Stringing these results together yields another, smaller non-negative integer: \$212239\$. Repeating the process gives \$11016\$, then \$0115\$, which by the convention that leading zeros are not written simplifies as \$115\$, which becomes \$04\$ or \$4\$, which can't be reduced any further. Summing all these values up we get \$8675309 + 212239 + 11016 + 115 + 4 = 8898683\$.
Let's define the Digit Difference Sum (or DDS) as this operation of repeatedly taking the digit differences of a number to form a new number, then adding all the resulting numbers to the original.
Here are the first 20 values in the corresponding DDS sequence:
```
N   DDS(N)
0   0
1   1
2   2
3   3
4   4
5   5
6   6
7   7
8   8
9   9
10  11
11  11
12  13
13  15
14  17
15  19
16  21
17  23
18  25
19  27
```
[Here are the first 10000 values](http://pastebin.com/raw.php?i=smY5B93g), the graph for which is quite curious:
[![DDS 10000 plot](https://i.stack.imgur.com/j1Im7.png)](https://i.stack.imgur.com/j1Im7.png)
Especially since it looks the same when you plot it to 1000 or even 100:
[![DDS 1000 plot](https://i.stack.imgur.com/5gohE.png)](https://i.stack.imgur.com/gyhhV.png)
[![DDS 100 plot](https://i.stack.imgur.com/06p5T.png)](https://i.stack.imgur.com/ghmjq.png)
(I'd call it the dentist's [staircase](https://codegolf.stackexchange.com/q/46821/26997)...)
# Challenge
Write a program or function that takes in a non-negative integer and prints or returns its DDS value. For example, if the input was `8675309`, the output should be `8898683`.
**The shortest code in bytes wins.**
  
[Answer]
# Python 2, 73
Luckily, I managed to avoid any string operations.
```
t=lambda n:n>9and abs(n%10-n/10%10)+10*t(n/10)
g=lambda n:n and n+g(t(n))
```
`g` is the function that computes the answer.
[Answer]
# Matlab, 101 ~~105~~ bytes
Thanks a lot to @beaker for his suggestion to use `polyval` instead if `base2dec`. That allowed me to
* save 4 bytes;
* greatly simplify the generalization to arbitrary base (see below) and save 22 bytes there; and most of all,
* helped me realize that the code for the general case was wrong (leading zeros were not being removed). The code and the graphs are correct now.
Code:
```
function y=f(y)
x=+num2str(y);while numel(x)>1
x=polyval(abs(diff(x)),10);y=y+x;x=+dec2base(x,10);end
```
Example:
```
>> f(8675309)
ans =
     8898683
```
## Bonus: arbitrary base
A small generalization allows one to use an arbitrary number base, not necessarily decimal:
* Arbitrary base from 2 to 10, **~~108~~ 104 bytes**
```
function y=f(y,b)
x=+dec2base(y,b);while numel(x)>1
x=polyval(abs(diff(x)),b);y=y+x;x=+dec2base(x,b);end
```
The reason why this works only for base up to `10` is that Matlab's `dec2base` function uses digits `0`, `1`, ..., `9`, `A`, `B`, ..., and there's a jump in character (ASCII) codes from `9` to `A`.
* Arbitrary base from 2 to 36, **124 ~~146~~ bytes**
The jump from `9` to `A` referred to above needs special treatment. The maximum base is `36` as per Matlab's `dec2base` function. 
```
function y=f(y,b)
x=+dec2base(y,b);x(x>57)=x(x>57)-7;while numel(x)>1
x=abs(diff(x));x=x(find(x,1):end);y=y+polyval(x,b);end
```
This is how the dentist's staircases look for different bases:
[![enter image description here](https://i.stack.imgur.com/P5len.png)](https://i.stack.imgur.com/P5len.png)
[![enter image description here](https://i.stack.imgur.com/lWz41.png)](https://i.stack.imgur.com/lWz41.png)
[![enter image description here](https://i.stack.imgur.com/leSWm.png)](https://i.stack.imgur.com/leSWm.png)
[![enter image description here](https://i.stack.imgur.com/wQad1.png)](https://i.stack.imgur.com/wQad1.png)
[![enter image description here](https://i.stack.imgur.com/TEaig.png)](https://i.stack.imgur.com/TEaig.png)
[![enter image description here](https://i.stack.imgur.com/v3J5k.png)](https://i.stack.imgur.com/v3J5k.png)
[Answer]
# Pyth, 17
```
s.ui.aM-VJjNTtJTQ
```
[Try it here](https://pyth.herokuapp.com/?code=s.ui.aM-VJjNTtJTQ&input=8675309&debug=0) or run the [Test Suite](https://pyth.herokuapp.com/?code=s.ui.aM-VJjNTtJTQ&input=19&test_suite=1&test_suite_input=0%0A1%0A2%0A3%0A4%0A5%0A6%0A7%0A8%0A9%0A10%0A11%0A12%0A13%0A14%0A15%0A16%0A17%0A18%0A19%0A8675309&debug=0)
### Explanation:
```
s.u            Q   # Cumulative reduce, i.e. getting the intermediate values of each reduce
                     step and returning them as a list, then sum the list
   i ... T         # Convert the resulting list of numbers into a base 10 number
   .aM             # Get the absolute value of each element of ...
      -VJjNTtJ     # Perform vector subtraction on the lists given by
        JjNT       # assign J the number we currently have converted to its base 10 digits
            tJ     # and J[1:]. e.x. for 123 we get J = [1,2,3] then we do
                   # zip(J,J[1:]) which gives [[1,2],[2,3]] then element wise subtract
                   # to get [-1, -1]
```
[Answer]
# CJam, ~~22~~ 21 bytes
```
ri_{\s2ew::-:zsi_@+}h
```
Note that this program exits with an error, which is [allowed by default](https://codegolf.meta.stackexchange.com/a/4781).
With the Java interpreter, errors can be suppressed by closing STDERR. If you try this code online in the [CJam interpreter](http://cjam.aditsu.net/#code=ri_%7B%5Cs2ew%3A%3A-%3Azsi_%40%2B%7Dh&input=8675309), ignore all output before the last line.
*Thanks to @Sp3000 for pointing out an error in the original revision.*
*Thanks to @MartinBüttner for golfing off 1 byte.*
### Example run
```
$ cjam digit-difference.cjam 2>&- <<< 8675309     
8898683
```
### How it works
```
ri_   e# Read an integer (I) from STDIN and push a copy (A).
{     e# Do:
  \   e#   Swap I on top of A.
  s   e#   Cast I to string.
      e#   For example, 123 -> "123".
  2ew e#   Push the overlapping slices of length 2 (pair of adjacent digits).
  ::- e#   Replace each pair by its difference.
  :z  e#   Apply absolute value to each difference.
  si  e#   Cast to string, then to integer. This is the new I.
      e#   For example, [1 2 3] -> "123" -> 123.
  _   e#   Push a copy of I.
  @   e#   Rotate A on top of the copy of I.
  +   e#   Add I to A, updating A.
}h    e# While A is truthy, repeat the loop.
```
**A** will always be truthy when checked by `h`. However, once **I** is a single-digit integer, `2ew` will fail with an error after consuming the array it was called on. This leaves only the desired result on the stack, which is printed before exiting.
[Answer]
# [Labyrinth](https://github.com/mbuettner/labyrinth), ~~176~~ ~~134~~ ~~127~~ ~~119~~ ~~103~~ ~~97~~ ~~88~~ ~~82~~ ~~79~~ ~~76~~ 72 bytes
*Thanks to Sp3000 for saving 1 byte and paving the way for 2 more.*
This could probably still be shortened, but hey, it beats ~~Java~~ ~~Matlab~~ Python...
```
?
_
)/:}+{:`};!
9       "
_ :}-"" :_10
;;{: `" "  :
  {  (_:/=%}
  0+;`"
```
[Try it online.](http://labyrinth.tryitonline.net/#code=PwpfCikvOn0rezpgfTshCjkgICAgICAgIgpfIDp9LSIiIDpfMTAKOzt7OiBgIiAiICA6CiAgeyAgKF86Lz0lfQogIDArO2Ai&input=ODY3NTMwOQ)
This [terminates with an error](https://codegolf.meta.stackexchange.com/questions/4780/should-submissions-be-allowed-to-exit-with-an-error/4781#4781) but the error message is written to STDERR (which is why you don't see it in TIO).
The implementation is fairly straight-forward. We add the current value to a running total. If the current value was greater than `9`, we compute its base-10 digits (via repeated div-mod), and form a new number from the absolute differences. If we get to `9` or less, we print the running total.
The digits of the current number are collected on the auxiliary stack with the most significant digit on top.
Well, the fancy implementation of `abs(...)` I had here turned out to be ridiculously complicated compared to the new solution... I'll add an updated explanation when I'm done golfing this further.
[Answer]
# [Julia 0.4](http://julialang.org/), ~~81~~ 60 bytes
```
n->(s=n;while n>9 s+=n=int(join(abs(diff(["$n"...]))))end;s)
```
Ungolfed:
```
function f(n::Int)
    # Initialize a sum to the input
    s = n
    while n > 9
        # Get absolute values of the pairwise differences of the
        # digits of n, join as a string, convert it to an integer,
        # and reassign n
        n = int(join(abs(diff(["$n"...]))))
        # ["$n"...] actually splits n as a string into a vector
        # of its characters, but the difference between ASCII
        # codes is the same as the difference between the numbers
        # so it works as expected
        # Add the new n to the running sum
        s += n
    end
    # Return the sum
    return s
end
```
[Try it online!](https://tio.run/##DcsxCoQwEEbh3lMMssUEMcRSJbmIbKHo4Ej4FaPs8bP56veON@qcxWe0gZPH@Ns1boTQU2o8vOLh41TwvCReVYSn@oPaWvs1xYZ1TCbLeZOSgrqhc85VVFx3eSNYWI2pSpj/ "Julia 0.4 – Try It Online")
Saved 21 bytes thanks to feersum and Glen O!
[Answer]
## Java - 300 bytes
Golfed Version
```
static Long t=new Scanner(System.in).nextLong();static char[]c=t.toString().toCharArray();public static void main(String[]z){while(c.length>1)s();System.out.print(t);}static void s(){String s="";for(int i=0;i<c.length-1;)s+=Math.abs(c[i]-c[++i]);Long a=new Long(s);t+=a;c=a.toString().toCharArray();}
```
Ungolfed / Full version
```
import java.util.Scanner;
public class DigitDifference {
    static Long t = new Scanner(System.in).nextLong();
    static char[] c = t.toString().toCharArray();
    public static void main(String[] args){
        while( c.length > 1 )
            s();
        System.out.print(t);
    }
    static void s(){
        String s="";
        for(int i = 0; i < c.length-1;)
            s += Math.abs(c[i]-c[++i]);
        Long a = new Long(s);
        t += a;
        c = a.toString().toCharArray();
    }
}
```
[Answer]
# [oK](http://johnearnest.github.io/ok/index.html), ~~37~~ ~~32~~ ~~24~~ 23 bytes
```
+/(10/{%x*x}1_-':.:'$)\
```
In action:
```
  +/(10/{%x*x}1_-':.:'$)\8675309
8898683
  (+/(10/{%x*x}1_-':.:'$)\)'!20
0 1 2 3 4 5 6 7 8 9 11 11 13 15 17 19 21 23 25 27
```
K5 has a few features which are well suited to this- "encode" and "decode" can perform base conversion, each-pair (`':`) pairs up sequential elements in a list and fixed point scan (`\`) can produce the iterated sequence until it stops changing. The lack of a primitive `abs()` leads to some unsightly bulk in the form of `{(x;-x)x<0}'`, though.
## Edit:
Instead of `{(x;-x)x<0}'`, I can (somewhat wastefully) take the square root of the square of the sequence (`{%x*x}`, saving 5 bytes.
## Edit 2:
Inspired by @maurinus' APL solution, I can replace the "decode" (`((#$x)#10)\x`) with evaluating each character of the string representation of the number- `.:'$x`! This also lets me use a tacit form of the whole expression, saving additional characters.
[Answer]
## Python 2, 87 bytes
```
f=lambda n:n and n+f(int('0'+''.join(`abs(int(a)-int(b))`for a,b in zip(`n`,`n`[1:]))))
```
Recursively adds the current number and takes the digits differences. Lots of converting between numbers and strings. Probably can be improved.
[Answer]
# Julia, ~~55~~ 48 bytes
```
h=n->(n>9&&h(int(join(abs(diff(["$n"...]))))))+n
```
Ungolfed:
```
function h(n)
  if n>9
    # If multiple digits, find the digit difference...
    digitdiff=int(join(abs(diff(["$n"...]))))
    # ... recurse the function...
    downsum=h(digitdiff)
    # ... and return the sum so far (working up from the bottom)
    return downsum+n
  else
    # If single digit, no further recursion, return the current number
    return n
  end
end
```
Essentially, this recurses down to the single-digit level (where no digit difference can be performed), then sums back up as it exits the recursion, level by level.
[Answer]
# APL (22)
```
{⍵≤9:⍵⋄⍵+∇10⊥|2-/⍎¨⍕⍵}
```
Explanation:
* `⍵≤9:⍵`: if ⍵ ≤ 9, return ⍵ unchanged.
* `⍎¨⍕⍵`: convert ⍵ to a string, then evaluate each character
* `2-/`: subtract every two adjacent numbers
* `|`: take the absolute values
* `10⊥`: turn the array into a base-10 number
* `⍵+∇`: call the function recursively with this new value, and add the result to the input
[Answer]
# Mathematica, ~~72~~ ~~69~~ 65 bytes
```
Tr@FixedPointList[FromDigits@*Abs@*Differences@*IntegerDigits,#]&
```
I'm open to suggestions here.
[Answer]
# Haskell, 140 bytes
`d` does the job.
```
import Data.Char
d n=sum.m(read.m intToDigit).fst.span(/=[]).iterate s.m digitToInt.show$n
s l@(h:t)=snd$span(==0)$m abs$zipWith(-)l t
m=map
```
Does anyone know how to avoid importing the long conversion functions?
[Answer]
# K5, 50 bytes
```
+/{(r;x)@~r:.,/"0",{$(0;-r;r)@(~^r)+0<r:x-y}':$x}\
```
[Answer]
# JavaScript ES6, 73 bytes
```
t=n=>(b=10,M=Math).ceil(n&&n+t((j=n=>n>9&&M.abs(n%b-n/b%b)+b*j(n/b))(n)))
```
This isn't getting any shorter :/ I'll try more approaches but this is the shortest one so far
[Answer]
# JavaScript (ES6), 69
Test running the snippet below in an EcmaScript 6 compliant browser (but not Chrome as it still does not support the spread operator `...`) MS Edge maybe?
```
f=n=>n&&(n+=r='',[...n].map(d=>(r+=d>p?d-p:p-d,p=d),p=n[0]),+n+f(+r))
function test()
{
  var i=+I.value
  O.innerHTML = i+' -> '+f(i) + '\n' + O.innerHTML 
}
```
```
<input id=I value=8675309><button onclick=test()>-></button>
<pre id=O></pre>
```
Alternative, using *array comprehension* that is now targeted EcmaScript 2016 (ES7), 67 bytes:
```
f=n=>n&&(n+=r='',p=n[0],[for(d of n)(r+=d>p?d-p:p-d,p=d)],+n+f(+r))
```
[Answer]
# Python 3, 125 bytes
I used to like the shortness of regex until I tried to use it for this challenge...`re.findall('\d\d',s,overlapped=True)` is *not* on ;)
```
s=input()
p=int
x=p(s)
while p(s)>9:g=str(s);s=p(''.join(str(abs(p(g[i])-p(g[i+1])))for i in range(len(g)-1)));x+=s 
print(x)
```
Cheers @Todd :)
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, 49 bytes
```
$\+=$_;s/.(?=(.))/abs$&-$1/ge;s/^0+|.$//g&&redo}{
```
[Try it online!](https://tio.run/##K0gtyjH9/18lRttWJd66WF9Pw95WQ09TUz8xqVhFTVfFUD89FSgcZ6Bdo6eir5@uplaUmpJfW/3/v4WZuamxgeW//IKSzPy84v@6vqZ6BoYG/3ULAA "Perl 5 – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~12~~ 7 bytes
```
≬¯ṅ⌊İ∑+
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLiiazCr+G5heKMisSw4oiRKyIsIiIsIjg2NzUzMDkiXQ==)
*-5 bytes thanks to allxy*
## How?
```
≬¯ṅ⌊İ∑+ # full program
≬¯ṅ⌊    # Three element lambda
 ¯      # Deltas (consecutive differences of digits)
  ṅ     # Join by nothing
   ⌊    # Convert to integer
    İ   # Apply this lambda on the (implicit) input and collect unique values
     ∑  # Summate
      + # Add to (implicit) input
```
[Answer]
# J, 70 bytes
```
 +/([:10&#.[:(2|@:-/\])[:10&(]#:~[#~[:>.[^.])])`]@.(11&>)^:a:".(1!:1)3
```
[Answer]
## MATLAB ~~(141)~~(137)
> 
> **EDIT:** 4 bytes less, thanks to @Andras
> 
> 
> 
```
function[s j]=n(T,b,c),if(T/b>9),u=fix(T/10);[x e]=n(T,b*10,0);y=n(u,b,0);[w z]=n(u,b,c);s=abs(x-y);j=s+e+10*c*z;else,s=mod(T,10);j=s;end
```
* This doest beat @LuisMendo 's answer but atleast I could reduce execution time, which by, I would have just tried to diversify ways of tackling this problem.
* I could reduce it more but as I go for less time, i waste more bytes, so here is the principle:
The program is summing up digits of same row before inlined digits , it does mean it used integer division "n/10" log\_10(n) times only, complexity is O(N).
If `n= a b c d`
```
a          b           c           d
   |a-b|       |b-c|       |c-d|
    ||a-b|-|b-c|| ||b-c|-|c-d||
   ....
```
My program calculates:
```
a+|a-b| + | |a-b|-|b-c| |  +  |  | |a-b|-|b-c| | - | |b-c|-|c-d| |  |
+10*(
b+|b-c| + | |b-c|-|c-d| |
+10*(
c+|c-d|
+10*(
d
)
)
)
```
## Usage:
```
  [a b]=n(13652,1,1)
```
a =
1
```
 b =
   16098
```
[Answer]
# Prolog, 143 bytes
**Code:**
```
q(X,N):-X<9,N=0;A is abs(X mod 10-X//10 mod 10),Y is X//10,q(Y,M),N is A+M*10.
r(X,N):-X<9,N=X;q(X,Y),r(Y,M),N is X+M.
p(X):-r(X,N),write(N).
```
**Explained:**
```
q(X,N):-X<9,N=0;                                                         % If only one digit, the difference is 0
        A is abs(X mod 10-X//10 mod 10),Y is X//10,q(Y,M),N is A+M*10.   % Else, the difference is the difference between the last 2 digits + the recursive difference of the number without the last digit
r(X,N):-X<9,N=X;                                                         % If we only have 1 digit the final answer is that digit
        q(X,Y),r(Y,M),N is X+M.                                          % Else, the final answer is the current number + the recursive difference of that number
p(X):-r(X,N),write(N).         
```
**q** does the calculations that convert a number into it's Digit Difference.  
**r** recursively calls **q** and sums up the results to find the Digit Difference Sum.
  
**p** is the entry point. Takes a number, calls **r** and prints the answer.
  
  
**Example:**
```
>p(8675309).
8898683
```
Try it online [here](http://swish.swi-prolog.org/p/FEbBzrgH.pl).
[Answer]
# PHP - 198 bytes
```
<?$x=$t=$_GET['V'];function z($x){global$t;for($i=0;$i<strlen($x)-1;$i++){$z=str_split($x);$r.=str_replace('-','',$z[$i]-$z[$i+1]);}$r=ltrim($r,'0');$t+=$r;return strlen($r)>1?z($r):0;}z($x);echo$t;
```
Ungolfed
```
<?
$x=$t=$_GET['V']; // Gets the value from input
function z($x){
    global$t;
    for($i=0;$i<strlen($x)-1;$i++){
        $z=str_split($x); //Turns the string into an array
        $r.=str_replace('-','',$z[$i]-$z[$i+1]); // Sums the two values and removes the minus signal
    }
    $r=ltrim($r,'0'); // Remove trailing zeroes
    $t+=$r; // Adds to global var
    return strlen($r)>1?z($r):0; // Checks the size of the string. If >1, calls the function again
}
z($x);
echo$t;
```
[Answer]
## [Perl 6](http://perl6.org), 56 bytes
```
{[+] $_,{+.comb.rotor(2=>-1)».map((*-*).abs).join}…0} # 56 bytes
```
usage:
```
my &code = {...} # insert code from above
(180..190).map: &code;
# (259 258 259 260 261 262 263 264 265 266 280)
say code 8675309; # 8898683
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
ạƝḌ$ƬS
```
[Try it online!](https://tio.run/##ASwA0/9qZWxsef//4bqhxp3huIwkxqxT/zg2NzUzMDk7MjDhuLbCpDvDhyTigqxH/w "Jelly – Try It Online")
## How it works
```
ạƝḌ$ƬS - Main link. Takes an integer n on the left
   $Ƭ  - Repeat the following until a repeated value, collected intermediate results:
 Ɲ     -   Convert an integer to digits, and on overlapping pairs:
ạ      -     Take the absolute difference
  Ḍ    -   Convert from digits to an integer
     S - Take the sum of these values
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 8 bytes
```
ΣU¡ȯdẊ≠d
```
[Try it online!](https://tio.run/##AR8A4P9odXNr///Oo1XCocivZOG6iuKJoGT///84Njc1MzA5 "Husk – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-x`](https://codegolf.meta.stackexchange.com/a/14339/), ~~9~~ 8 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
Èìä'a}hN
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LXg&code=yOzkJ2F9aE4&input=MTAyNA)
[Answer]
# [Factor](https://factorcode.org) + `math.extras project-euler.common`, ~~83~~ 81 bytes
```
[ 0 swap [ [ + ] keep number>digits differences vabs digits>number ] until-zero ]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=JY47DsIwDIZ3TuEdtUJMCFBXxIKEEBNiCKkDgeaB4_C6CksXuFNvQ0pkyY_fn3_5_VVCsqO2e2w3y9ViChckiw0YccGU-FTesAdCHgIL1oG1DODJndOqwNggldIZ42yG8MEkegCZn5605b8OAa8RrcQAs8FgPIK5diyqT2RVTLr1DkYQ7sLDLsUQ9ukT9GCjOSBVtT5qDlBrpZCyx00ceqHXq0ylm2hZN8ULycE-G39Msixz37a5_gA)
* `0 swap` Initialize the sum.
* `[ ... ] until-zero` Call a quotation until its result is 0, dropping the 0 from the stack.
* `[ + ] keep` Add the current summand to our sum.
* `number>digits differences vabs digits>number` Get the next summand.
[Answer]
# C 162 bytes
golfed:
```
main(int argc,char **argv){char *c=argv[1];int u=atoi(c),d;do{while(c[1]!=0){*c=abs(*c-*(c+1))+48;c++;}*c=0;c=argv[1];d=atoi(c);u+=d;}while(d>9);printf("%d",u);}
```
ungolfed:
```
main(int argc, char **argv)
{
    char *c=argv[1];
    int u=atoi(c),d;
    do
    {
        while(c[1]!=0)
        {
            *c=abs(*c-*(c+1))+48;
            c++;
        }
        *c=0;
        c=argv[1];
        d=atoi(c);
        u+=d;
    }
    while(d>9);
    printf("%d\n",u);
}
```
[Answer]
# R, 134 Bytes
### Code
```
f=function(x){z=x;while(z>9){n=seq(nchar(z));z=abs(diff(strtoi(substring(z,n,n))));z=sum(z*10**(rev(seq(length(z)))-1));x=x+z};cat(k)}
```
Test it [online](http://www.r-fiddle.org/#/fiddle?id=iX6pcHCs&version=3).
### Ungolfed
```
f=function(x){
  z=x;
  while(z>9){
    n=seq(nchar(z));
    z=abs(diff(strtoi(substring(z,n,n))));
    z=sum(z*10**(rev(seq(length(z)))-1));
    x=x+z
  };
  cat(x)
}
```
Here is the plot of the difference of the "Digit Difference Sum of a Number" series from f(1) to f(1m). Just because I love to diff.
![](https://i.stack.imgur.com/jVL2a.png)
### Plot code
```
s <- seq(1,100000)
serie <- sapply(s,f)
plot(diff(ts(serie)),xlab="",ylab="")
```
]