# How do i repeat a function n times until it reaches a certain parameter?

**URL:** <https://cl.desmos.com/t/how-do-i-repeat-a-function-n-times-until-it-reaches-a-certain-parameter/5117>\
**Category:** Questions\
**Created:** [September 21, 2023, 7:02pm UTC](https://cl.desmos.com/t/how-do-i-repeat-a-function-n-times-until-it-reaches-a-certain-parameter/5117 "2023-09-21T19:02:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcoMa210](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/marcoma210/32/4523_2.png) [@MarcoMa210](https://cl.desmos.com/u/MarcoMa210)\
**Post date:** [September 21, 2023, 7:02pm UTC](https://cl.desmos.com/t/how-do-i-repeat-a-function-n-times-until-it-reaches-a-certain-parameter/5117/1 "2023-09-21T19:02:04Z")

</div>

Let’s say i use a function with variable a that goes as follows:

{mod(a,2) = 1:3a+1, a/2}

How do i get its answer and put it through the same function until it reaches 1?

---

<div class="post-metadata">

**Author:** ![Daniel\_Wekselgreene](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_wekselgreene/32/1819_2.png) [@Daniel\_Wekselgreene](https://cl.desmos.com/u/Daniel_Wekselgreene)\
**Post date:** [September 22, 2023, 6:52pm UTC](https://cl.desmos.com/t/how-do-i-repeat-a-function-n-times-until-it-reaches-a-certain-parameter/5117/2 "2023-09-22T18:52:24Z")

</div>

You can use actions and a ticker to do this repeatedly: [collatz | Desmos](https://www.desmos.com/calculator/kjugdx7qqm)
