# Share My CreationCollatz Mobile

Here is a little mathematical app that approaches the Collatz conjecture (named after the German mathematician, Lothar Collatz). If you would like some input on what he conjectured in 1937, you can read about it here: Collatz conjecture - Wikipedia, the free encyclopedia Paul Erdös said he would pay \$500 to anyone who managed to prove that either every integer greater than 1 would finally reach one or to anyone who managed to find a counter-example. 75 years after Collatz proposed his conjecture, the problem remains unsolved.

The app was made for fifth-graders who, as a homework assignment, had tried manually to find numbers below 100 with very high Collatz iteration step numbers. Because I thought it would motivate them even more, I decided to have a top 100 list within the app into which students enter when they discover a number with high-enough step count. In class, this was a lot of fun, since now the students were free to roam outside the "under 100" limit and propose truly astronomical figures, which, for the most part and to their dismay, did not yield the extraordinarily high step numbers they had hoped for in order to make it into the top 100.

The app comes in three languages (English, German, and Turkish) and also features a welcome screen with an introduction to the problem. Tap onto it to proceed to the main screen.

The main screen offers two calculation modes: single number and batch. For single numbers, fill in only the field labeled "Starting number" and leave empty the field "Ending number". Only single number attempts can enter the top 100 list. The batch mode lets you crunch a range of numbers successively, odd/even or only odd ones. The app records and displays numbers with the highest step numbers and highest intermediate results. If not only odd numbers are being examined, the app also records consecutive numbers that share the same step count. If the user wishes, every single step of the calculation down to 1 can be displayed. All the results can be saved to a file, too.

I like using the app for playing a game with a friend of mine. We agree on a range of numbers (say, from 3 to 999,999,999,999,999) and try to beat the other's highest step counts by guessing new candidates. It is amazing how little my intuition helps here.

A single click onto one entry in the top 100 list will display the selected entry in an extra message box (sometimes the numbers are so long that they don't fit into one line of the list) and copy the entry to the clipboard.

For me, this was my first real app. As a total Basic4Android beginner, I needed an exercise for 1) switching from one screen to the next, 2) preserving state between successive invocations of the app, 3) keeping the app responsive enough for user intervention (cancelling the current operation), 4) using the Designer and code to adapt the layout to the device (it is supposed to support small to very large screens), and 5) using libraries for the first time.

I am thankful for all the great support that I have received here at the forum while writing and testing this app. When I, in the course of programming, discovered a small bug in a library I was using, the library was fixed within a few hours -- that's an amazing degree of dedication to quality, I think! :sign0188:

To start crunching, tap onto the picture of Mr. Collatz. To break off a calculation in progress, press the BACK button once. To quit, tap the HOME button.

Of course, this is not an industrial-strength implementation, just a beginner's project for mathematics education. Anyway, enjoy

Regards,

P.S. If you would like to test it, please download via "Google Play" at https://play.google.com/store/apps/details?id=de.noemanetz.collatzmobile to ensure you can get updates. Thank you.

#### Attachments

• CollatzMobile_S0small.jpg
92 KB · Views: 4,729
• CollatzMobile_S3_desmall.jpg
93.4 KB · Views: 201
Last edited:

#### Erel

##### B4X founder
Staff member
Licensed User
Longtime User
Nice job! First time that I hear about this conjecture.

#### ukimiku

##### Active Member
Licensed User
Longtime User
Thank you. I first read about it about 30 years ago, as a child. Since then, it has always occupied me from time to time... The rules are simple, the behavior complex - right down my alley...

Regards,

Replies
45
Views
11K
Replies
19
Views
9K
Replies
12
Views
2K
Replies
49
Views
7K
Replies
6
Views
10K