Coding a formula calculator to a website

Job ID: 31908906

Budget: $250 – $750 AUD

Hi, I am building a website using Wix. I need to add a calculator that can compress big numbers into smaller numbers within a given range say 1-20 (range).

By compressing, I mean converting a multi-digit variable say 251 into a single digit number by adding 2+5+1=8.

For example, a normal simple formula looks like this:
Goal: convert variable meter into km.
Formula: multiply variable (251) by 0.001
Result: 251m = 0.251km

My calculator:
Goal: convert a multi-digit variable (251) into a single digit number
Formula: ??
Result : 251 = 8

The calculator I want to build looks similar to this one:
https://www.gigacalculator.com/calculators/lucky-number-generator.php

I need to add few more dependent variable and formula into the calculator.
For example, if number in box 1 <20 (range), then number in box 2 = number in box 1.
If number in box 1 > 20 (range), then number in box 2 = Formula: ?? (mentioned above)

Essentially, I need someone who has strong background/experiencing with this type of work. I will also need the calculator to get coded into my website using Wix, so Wix experience is also required.

Thank you.
Related categories: PHP JavaScript CSS HTML Coding