Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

For example:

. is my append operator

f(x,y)    = |x| . |y|
f(1,45)   = 145
f(233,10) = 23310
f(8,2)    = 82
f(0,1)    = 1

This is a trivially easy problem to solve in programming using string concatenation. However, I can't seem to think of a good way to do this using purely arithmetic operations.

share|improve this question

2 Answers 2

$f(x,y)=x\cdot10^{\lfloor\log_{10}y\rfloor+1}+y$

share|improve this answer
  1. Take $log_{10}(b)$ and round down to find the number of digits $n$.
  2. multiply $a$ by $10^n$
  3. add $b$
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.