1. ## create math formula

if n=1 then the formula answer is:0
if n=2 or n=3 or n=4 then the formula answer is:1
if n=5 or n=6 or.........or n=13 then the formula answer is:2
if n=14 or n=15 or.........or n=40 then the formula answer is:3
and so on.....
someone can help me to build the formula that makes thos calculations???

2. Hello, tukilala!

Could there be typos in the problem?

. . $\begin{array}{|c|c|}\hline
n & f(n) \\ \hline
1 & 0 \\
2,3,4 & 1 \\
5,6,\hdots,14 & 2 \\
15,16,\hdots,42 & 3 \\
\vdots & \vdots \end{array}$

Can someone help me to build the formula?
I find no discernable pattern in the numbers.

. . $\begin{array}{|c|c|} \hline
\text{First term} & \text{No. of terms} \\ \hline
1 & 1 \\
2 & 3 \\
5 & 10 \\
15 & 28 \\
\vdots & \vdots \\
? & ? \end{array}$

3. Can you supply the next two groups?

A formula is not easy.

An algorithm is very easy to construct.

4. you have a mistake....

first term no. of terms
1 1
3 3
5 9
14 27
. .
. .
. .

5. Hello tukilala
Originally Posted by tukilala
if n=1 then the formula answer is:0
if n=2 or n=3 or n=4 then the formula answer is:1
if n=5 or n=6 or.........or n=13 then the formula answer is:2
if n=14 or n=15 or.........or n=40 then the formula answer is:3
if n=41 or ............ or n=121 then the formula answer is:4
if n=122 or ..... n=364 then the formula is:5
and so on....
someone can help me to build the formula that makes thos calculations???
The key to this is to find a formula to find the first term in each of the original groups; that is $1, 2, 5, 14, 41, ...$. The consecutive differences are $1, 3, 9, 27, 81, ...$ which are, of course, powers of $3$.

So if we try a formula of the type $a_n = 3^na + b$, we shall probably be OK.

$n=1: a_1 = 1 = 3a+b$

$n+2: a_2 = 2 = 9a + b$

$\Rightarrow a = \tfrac{1}{6}, b = \tfrac{1}{2}$

$\Rightarrow a_n=3^n\times\tfrac{1}{6}+\tfrac{1}{2}$

You'll find that this formula generates the numbers that start each group: $1, 2, 5, 14, ...$ (Don't worry about the remaining numbers in each group: we'll deal with those later.)

Now, how can we use this function to generate the numbers $1, 2, 3, 4, ...$?

The answer is, of course, to find the inverse function; that is, to make $n$ the subject of the formula:

$a_n=3^n\times\tfrac{1}{6}+\tfrac{1}{2}$

Multiply both sides by $6$:

$6a_n = 3^n + 3$

$\Rightarrow 3^n = 6a_n-3 = 3(2a_n -1)$

Now the tricky bit: take logs to base $3$ of both sides:

$\log_33^n = \log_33(2a_n -1)$

$\Rightarrow n = \log_33 + \log_3(2a_n-1)= 1 + \log_3(2a_n-1)$

So there's our formula that will work for the first number in each group. Try it out.

$a_1=1: 1 + \log_31 = 1 + 0 = 1$

$a_2=2: 1 + \log_33 = 1 + 1 = 2$

$a_3=5: 1 + \log_3 9 = 1+2 = 3$

... and so on.

OK. So, finally, what do we do about the remaining numbers in each group? Well, when we use the formula above with any of the other numbers in the group, the $\log_3$ bit will give us the whole number that we want, with an extra decimal bit as well. All we need to do is to use the floor function, $\lfloor...\rfloor$, to ignore the decimal part, and just return the integer part.

So, finally (replacing our $a_n$ with the $n$ referred to in the original question) the function is:

$f(n) =1 + \lfloor\log_3(2n-1)\rfloor$

(If you want to use a calculator or a spreadsheet to check this out and you don't know how to handle $\log_3$, you can use the formula $\log_3x = \frac{\log x}{\log 3}$, where $\log x$ is log to base 10 of $x$.)

6. Hello, tukilala!

You gave us more terms this time . . .

. . $\begin{array}{|c|c|} \hline
n & f(n) \\ \hline
1 & 0 \\
2,3,4 & 1 \\
5,6,\hdots,13 & 2 \\
14,15,\hdots, 40 & 3 \\
41,42,\hdots, 121 & 4 \\
122,123,\hdots, 364 & 5 \\
\vdots & \vdots \end{array}$
. Table 1

Can someone help me to build the formula?
I can't find a neat formula . . .

I examined the first term of each sequence and the number of terms.

. . $\begin{array}{|c|c|} \hline
\text{First term} & \text{No. of terms} \\ \hline
1 & 1 \\ 2 & 3 \\ 5 & 9 \\ 14 & 27 \\ 41 & 81 \\ 122 & 243 \\ \vdots & \vdots \end{array}$
. Obviously, it involves powers-of-3.

The $k^{th}$ row of Table 1 would have:

. . The numbers from $\frac{3^{k-1}+1}{2}\:\text{ to }\:\frac{3^k-1}{2}\,\text{ all correspond to the value }k-1$

And that's the best I can do . . .