4 replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/

# CJam, 14 11 bytes

l40f-Ab)s1>


### How it works

This approach is heavily based on edc65's answeredc65's answer (with his explicit permissionhis explicit permission):

" Read a line L from STDIN. ";

l

" edc65's answer now forms an integer N by replacing each digit in L by an 8 and computes
L - ~N = L + N + 1. Instead of adding L and N, we subtract 40 from each char code of L.
Since the char code of the digit D is D + 48, this basically adds 8 to each digit.  ";

40f-

" Turn the resulting array into an integer by considering its elements a base 10 number.
This is implemented as A ↦ A[-1] + 10 * A[-2] + 100 * A[-3] + ⋅⋅⋅, so it won't choke
on digits greater than the base.                                                        ";

Ab

" Increment the integer on the stack to complete the calculation of L + N + 1.            ";

)

" Push the integers string representation and discard its first character.                ";

s1>


### Example run

$for i in 0 1 10 11 42 100 800 1060 10270 100501 > do echo$i: $(cjam <(echo 'l40f-Ab)s1>') <<<$i)
> done
0:
1: 0
10: 9
11: 00
42: 31
100: 89
800: 689
1060: 949
10270: 9159
100501: 89390


# CJam, 14 11 bytes

l40f-Ab)s1>


### How it works

This approach is heavily based on edc65's answer (with his explicit permission):

" Read a line L from STDIN. ";

l

" edc65's answer now forms an integer N by replacing each digit in L by an 8 and computes
L - ~N = L + N + 1. Instead of adding L and N, we subtract 40 from each char code of L.
Since the char code of the digit D is D + 48, this basically adds 8 to each digit.  ";

40f-

" Turn the resulting array into an integer by considering its elements a base 10 number.
This is implemented as A ↦ A[-1] + 10 * A[-2] + 100 * A[-3] + ⋅⋅⋅, so it won't choke
on digits greater than the base.                                                        ";

Ab

" Increment the integer on the stack to complete the calculation of L + N + 1.            ";

)

" Push the integers string representation and discard its first character.                ";

s1>


### Example run

$for i in 0 1 10 11 42 100 800 1060 10270 100501 > do echo$i: $(cjam <(echo 'l40f-Ab)s1>') <<<$i)
> done
0:
1: 0
10: 9
11: 00
42: 31
100: 89
800: 689
1060: 949
10270: 9159
100501: 89390


# CJam, 14 11 bytes

l40f-Ab)s1>


### How it works

This approach is heavily based on edc65's answer (with his explicit permission):

" Read a line L from STDIN. ";

l

" edc65's answer now forms an integer N by replacing each digit in L by an 8 and computes
L - ~N = L + N + 1. Instead of adding L and N, we subtract 40 from each char code of L.
Since the char code of the digit D is D + 48, this basically adds 8 to each digit.  ";

40f-

" Turn the resulting array into an integer by considering its elements a base 10 number.
This is implemented as A ↦ A[-1] + 10 * A[-2] + 100 * A[-3] + ⋅⋅⋅, so it won't choke
on digits greater than the base.                                                        ";

Ab

" Increment the integer on the stack to complete the calculation of L + N + 1.            ";

)

" Push the integers string representation and discard its first character.                ";

s1>


### Example run

$for i in 0 1 10 11 42 100 800 1060 10270 100501 > do echo$i: $(cjam <(echo 'l40f-Ab)s1>') <<<$i)
> done
0:
1: 0
10: 9
11: 00
42: 31
100: 89
800: 689
1060: 949
10270: 9159
100501: 89390

3 added 495 characters in body

# CJam,14 11 bytes

l40f-Ab)1>s1>


(rest to be updated)Try it online.

# CJam, 14 bytes

l_i\,'8*i~-1>


### How it works

This uses the same approach asis heavily based on edc65's answer, with (with his explicit permission. Try it online.):

### How it works

l_              " Read a line L from STDIN and push a second copy.  ";

l

" edc65's answer now forms an integer N by replacing each digit in L by an 8 and computes
L - ~N = ";
L + i\N + 1. Instead of adding L and N, we subtract 40 "from Casteach onechar copycode toof integerL.
and swapSince itthe withchar thecode other.of the digit D is D + 48, this basically adds 8 to each digit.  ";

40f-

" Turn the resulting ";
array into an integer ,'8*by considering its elements a base 10 number.
" ReplaceThis allis charactersimplemented withas 8's.A ↦ A[-1] + 10 * A[-2] + 100 * A[-3] + ⋅⋅⋅, so it won't choke
on digits greater than the base.                 ";
i~      " Push the bitwise NOT of its integer value.                 ";

Ab

" Increment the integer on the stack to complete the calculation of L ";
+ N + 1.       -     ";

)

" Push the differenceintegers ofstring therepresentation twoand integersdiscard onits thefirst stackcharacter.                   ";

s1>


### Example run

$for i in 0 1 10 11 42 100 800 $$$$1>1060 10270 "100501 > Pushdo itsecho string$i: representation$(cjam and<(echo discard'l40f-Ab)s1>') the<<< first$i)
> character.done
0:
1: 0
10: 9
11: 00
42: 31
100: 89
800: 689
1060: 949
10270: 9159
100501: ";89390


# CJam, 11 bytes

l40f-Ab)1>


(rest to be updated)

# CJam, 14 bytes

l_i\,'8*i~-1>


This uses the same approach as edc65's answer, with his explicit permission. Try it online.

### How it works

l_              " Read a line from STDIN and push a second copy.                          ";
i\            " Cast one copy to integer and swap it with the other.                    ";
,'8*        " Replace all characters with 8's.                                        ";
i~      " Push the bitwise NOT of its integer value.                              ";
-     " Push the difference of the two integers on the stack.                   ";
$$$$1>  " Push its string representation and discard the first character.         ";


# CJam,14 11 bytes

l40f-Ab)s1>


### How it works

This approach is heavily based on edc65's answer (with his explicit permission):

" Read a line L from STDIN. ";

l

" edc65's answer now forms an integer N by replacing each digit in L by an 8 and computes
L - ~N = L + N + 1. Instead of adding L and N, we subtract 40 from each char code of L.
Since the char code of the digit D is D + 48, this basically adds 8 to each digit.  ";

40f-

" Turn the resulting array into an integer by considering its elements a base 10 number.
This is implemented as A ↦ A[-1] + 10 * A[-2] + 100 * A[-3] + ⋅⋅⋅, so it won't choke
on digits greater than the base.                                                        ";

Ab

" Increment the integer on the stack to complete the calculation of L + N + 1.            ";

)

" Push the integers string representation and discard its first character.                ";

s1>


### Example run

$for i in 0 1 10 11 42 100 800 1060 10270 100501 > do echo$i: $(cjam <(echo 'l40f-Ab)s1>') <<<$i)
> done
0:
1: 0
10: 9
11: 00
42: 31
100: 89
800: 689
1060: 949
10270: 9159
100501: 89390

2 added 69 characters in body

# CJam, 11 bytes

l40f-Ab)1>


(rest to be updated)

# CJam, 14 bytes

l_i\,'8*i~-1>


This uses the same approach as edc65's answer, with his explicit permission. Try it online.

### How it works

l_              " Read a line from STDIN and push a second copy.                          ";
i\            " Cast one copy to integer and swap it with the other.                    ";
,'8*        " Replace all characters with 8's.                                        ";
i~      " Push the bitwise NOT of its integer value.                              ";
-     " Push the difference of the two integers on the stack.                   ";
$$$$1>  " Push its string representation and discard the first character.         ";


# CJam, 14 bytes

l_i\,'8*i~-1>


This uses the same approach as edc65's answer, with his explicit permission. Try it online.

### How it works

l_              " Read a line from STDIN and push a second copy.                          ";
i\            " Cast one copy to integer and swap it with the other.                    ";
,'8*        " Replace all characters with 8's.                                        ";
i~      " Push the bitwise NOT of its integer value.                              ";
-     " Push the difference of the two integers on the stack.                   ";
$$$$1>  " Push its string representation and discard the first character.         ";


# CJam, 11 bytes

l40f-Ab)1>


(rest to be updated)

# CJam, 14 bytes

l_i\,'8*i~-1>


This uses the same approach as edc65's answer, with his explicit permission. Try it online.

### How it works

l_              " Read a line from STDIN and push a second copy.                          ";
i\            " Cast one copy to integer and swap it with the other.                    ";
,'8*        " Replace all characters with 8's.                                        ";
i~      " Push the bitwise NOT of its integer value.                              ";
-     " Push the difference of the two integers on the stack.                   ";
$$$$1>  " Push its string representation and discard the first character.         ";

1