# Collatz Conjecture

**URL:** <https://community.glideapps.com/t/collatz-conjecture/78916>\
**Category:** Project Showcase\
**Created:** [January 2, 2025, 12:53pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916 "2025-01-02T12:53:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 2, 2025, 12:53pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916/1 "2025-01-02T12:53:00Z")

</div>

My 7 year old is fascinated with numbers. Recently he learned about the [Collatz Conjecture](https://en.wikipedia.org/wiki/Collatz_conjecture), and has since been busy calculating the series for all the numbers from 1-100 in his “Yummy Math Book”. As he was showing me the chart for his latest - the number 27 - earlier this evening, it occurred to me that “I should make a Glide App for this”.

20 minutes or so later, this is the result…

 ![CleanShot 2025-01-02 at 20.53.24@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/b/4b1b0117af1a15ac8e70f66aa2bac348a94f6e42.jpeg)

> **[Collatz](https://collatz-7zss.glide.page)**

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 2, 2025, 2:10pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916/2 "2025-01-02T14:10:33Z")

</div>

Never heard of the Collatz Conjecture before, but you made me pull out a calculator and it is fascinating. Would be interesting to allow entry of 3 or 4 numbers and have multiple lines on the graph to see how they compare.

Even better, if you could get the steps to “right align”, or populate at the end of the table, you could see where each graph line converges. Might notice patterns with certain combinations of numbers.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 2, 2025, 2:34pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916/3 "2025-01-02T14:34:12Z")

</div>

> [@Jeff\_Hager](#):
>
> Never heard of the Collatz Conjecture before,

This is where we learned about it:

[![](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/0/40175787e609d96e04e55940e84591ea9419780a.jpeg "The Simplest Math Problem No One Can Solve - Collatz Conjecture") ](https://www.youtube.com/watch?v=094y1Z2wpJg)

This guy makes some great videos, by the way 🙂

> [@Jeff\_Hager](#):
>
> Would be interesting to allow entry of 3 or 4 numbers and have multiple lines on the graph to see how they compare.

Cool idea. I’m out now, but I’ll make that one of my tasks for tomorrow.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 2, 2025, 2:38pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916/4 "2025-01-02T14:38:43Z")

</div>

> [@Jeff\_Hager](#):
>
> Even better, if you could get the steps to “right align”, or populate at the end of the table, you could see where each graph line converges. Might notice patterns with certain combinations of numbers.

Tried to reply to this in the above, but my phone is being spastic 🤪  
hmm, I think that should be doable. Will take a look.

One thing I will say is that I was surprised at how blindly fast it is at calculating the series. It’s just done with a simple JavaScript function that I spent about 2 minutes writing, so I’m sure it could be optimised. Although, I haven’t tried it with 10^200 yet, that might melt my phone 🤣

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 2, 2025, 5:10pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916/5 "2025-01-02T17:10:10Z")

</div>

I do follow Veritasium and watch their videos every once in a while. Vsauce is a good one too, or SmarterEveryDay. Good content when I want to feel smart…or dumb 😏. Interesting video though. Interesting seeing all the patterns that form.

Now I want to see your kid (and you) solve the problem with a Glide app. I think your phone could handle that amount of processing, right? 🫠

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [January 3, 2025, 12:41pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916/6 "2025-01-03T12:41:11Z")

</div>

> [@Jeff\_Hager](#):
>
> Veritasium and watch their videos every once in a while. Vsauce is a good one too, or SmarterEveryDay

Yep, we also watch all 3. Some of the stuff he builds on Smarter Every Day is just insane. His engineering skills are from another world!

> [@Jeff\_Hager](#):
>
> Now I want to see your kid (and you) solve the problem with a Glide app. I think your phone could handle that amount of processing, right?

heh, I think not 🤣

Anyway, just made a few tweaks as per your suggestions. Give it a try now…

 ![CleanShot 2025-01-03 at 20.38.04@2x](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/0/205acd8bd506b0cca0db44f107e986ee7eca4150.jpeg)

oh… there seems to be a bug with the Chart component where it doesn’t render the X Axis labels correctly in the mouse-over, or at all in the Legend. Annoying 😠

> [@Jeff\_Hager](#):
>
> Might notice patterns with certain combinations of numbers.

Try `27` and `125`

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [January 4, 2025, 9:24pm UTC](https://community.glideapps.com/t/collatz-conjecture/78916/7 "2025-01-04T21:24:54Z")

</div>

Boy I could spend all day plugging in numbers and looking for patterns. I like the reverse chart feature and seeing where steps converge.
