4
$\begingroup$

Consider the sequence of natural numbers generated by:

$f(n) = 2 n + (-1)^n/2 - 1/2$,

for $n > 0$ and $n \in \mathbb{Z}^+$ (positive integers):

i.e., {1, 4, 5, 8, 9, 12, 13, 16, 17, 20, ...}

Inspired by this mathematics question, how would one use FunctionExpand, Simplify, FullSimplify, FindSequenceFunction, various substitution rules, and other Mathematica functions to derive (not confirm) that

$$f(n) = \left\lfloor {4 \over 3} \left\lfloor {3 n \over 2} \right\rfloor \right\rfloor ,$$

where of course $\lfloor x \rfloor$ or Floor[x] (read "floor of $x$") is the greatest integer less than or equal to $x$, or that

$$f(n) = 2n - (n\!\!\!\!\!\!\mod2)?$$

$\endgroup$
0

1 Answer 1

2
$\begingroup$

If an over-complicated solution suffice...

f[n_] := Floor[4/3*Floor[3/2*n]]
Table[{k, Simplify[f[3*2*m + k], m \[Element] Integers] /. 
    m -> (n - Mod[n, 3*2])/6}, {k, 0, 5}];

Where the second line we are just changing m=3*2*m + k, with k a number between 0 and 5.

FullSimplify[InterpolatingPolynomial[%, Mod[n, 3*2]], n \[Element] Integers]

Next, we interpolate the result in k, which is basically Mod[n, 3*2] and simplify.

We arrive at this beauty:

2 n - 1/15 (Mod[n, 6] - 4) (Mod[n, 6] - 2) Mod[n, 6] (Mod[n, 6] (2 Mod[n, 6] - 13) + 16)

Which can be numerically tested, and it gives the same result as the original f[n].

My approach (lame) works with any function of this kind and the end result is absurdly complex.

BTW, this function remembers me Collatz...

$\endgroup$
3
  • $\begingroup$ Thanks @T.F. This is a reasonable approach, but as you found a bit incomplete. I was hoping there might be some substitution rules that led to the curious "floor-floor" functionality. Worth an up-vote, but (as you noted), surely not an acceptance as a solution. Moreover, you (basically) confirmed the answer, since you started with the floor-floor function—not derived the answer (as my question requests). My function is monotonic; Collatz is non-monotonic. $\endgroup$ Commented Jul 10, 2017 at 23:09
  • $\begingroup$ Dummy me... I copied the wrong function definition... It was supposed to be: f[n_] := 2 n + (-1)^n/2 - 1/2 Table[{k, Simplify[f[6 m + k], m [Element] Integers] /. m -> 1/6 (n - Mod[n, 6])}, {k, 0, 5}]; FullSimplify[InterpolatingPolynomial[%, Mod[n, 6]], n [Element] Integers] /. Mod[n, 6] -> n - 6 Floor[n/6] // Simplify $\endgroup$
    – T.F
    Commented Jul 10, 2017 at 23:30
  • $\begingroup$ Feel free to edit your answer. $\endgroup$ Commented Jul 10, 2017 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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