Is it possible to truncate a number just with Arithmetic operations?

1.4k Views Asked by At

Hi is it possible to truncate a number just with Arithmetic operations?

For example if i have

2.5

i want to get "2" without using modulo or something other which can't be rewritten in formulas.

i could calculate

2.5 * 0.8 = 2

but this just works for "2"

what i want to do:

2^x-trunc(2^x/13)*13=9

and now solve to x... i think there are many solutions

one solutuon is x=8

1

There are 1 best solutions below

15
On BEST ANSWER

No. Addition, subtraction, multiplication, and division are all continuous functions, and any combination of them will also be continuous. However, the floor and ceiling functions are not continuous.


Okay, after your edit, it seems you're trying to solve $2^x \equiv 9 \pmod{13}$. Don't rewrite this! It becomes harder to do with floor functions and all. Let's look at the powers of two.

$$\begin{array}{c||c} x & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & \cdots \\ \hline 2^x & 1 & 2 & 4 & 8 & 3 & 6 & 12 & 11 & 9 & 5 & 10 & 7 & 1 & 2 & 4 & 8 & \cdots \end{array}$$

First, we note that this table repeats after $12$. How can we be sure? Because, as we can see from the table, $2^{12} \equiv 1 \pmod{13}$. (See if you can generalize this). The only solution for $x$ between $1$ and $12$ is $8$. So, our solution set is $x = 8 + 12k, \ k \in \mathbb{Z}$.