There are 50 algorithms waiting to be claimed.
If you would like to take care of reducing a set of numbers please complete the following and create a pull request.
example start
John Smith
example end
example start
Smith's reduction using division
example end
example start
I will be catering for all numbers which start with any single digit and end with only zeros
example end
example start
^[1-9]0+
example end
example start
The initial number (to be encoded) is divided by ten. The result of the previous division is used to perform the next division until we are left with a single digit.
For example
-
40000/10=4000 then
-
4000/10=400 then
-
400/10=40 then
-
40/10=4
The reduced number is 4
As shown above the algorithm performs the division a total of 4 times in order for the key (in this case 40000) to be reduced to a single digit.
The helper is therefore 4.
example end
example start
This algorithm will be assigned to the lower case letter "a" and therefore the above example of reducing the number 40000 will have the overall output of "a44"
example end
example start
counter = 0
function a_encode(numberToEncode)
while numberToEncode.length() => 2
counter = counter + 1
numberToEncode = numberToEncode / 10
return [numberToEncode, counter]
example end
example start
function a_encode(number, argument)
for i in argument
number = number * 10
return number
example end