Help Me With This Mathematical App please!

Hello! I had created an app to display the steps of the Collatz Conjecture for the input number. Here is the coding part:

Now when I am testing my app through the AI Companion,
image

I am receiving this message. Please help me.

PS: I am relatively new here and this is my first post. If there is a very basic fault in the code, please forgive me.

This means that input textbox is empty. So in designer view set textbox to accept only numbers and set textbox text to 0 so in case someone click's button without setting a number you won't get any error

image

Or another way is to check if textbox text is empty then show alert else proceed with procedure

Also you can not initialize a variable to get textbox input

image

Set global number_to_be_worked_upon to 0 and then when button click set global variable to Input_box.text

1 Like

Thank You @dora_paz . However, it still doesn't solve my problem even after following the steps:

Have you change that ?

1 Like

It worked! Thank you! My bad for not making this initialize global variable change.

Thank you! I had heard earlier that computers can be used to work out mathematical puzzles, but this is the first time I have made such a program.

1 Like

This is my final code:


Made minor improvements

1 Like

By sheer coincidence, last week a friend sent me this video on this infamous problem:

(Spoiler Alert!)

@ABG Sheer coincidence indeed? To be honest, I got this idea from watching the same video. I actually follow these cool channels and had watched it 2 weeks ago. I won't say that I didn't know about the Conjecture before, it's just that I never bothered to think about it. Only a few days ago, I got the idea to create an app for it. They told in the video that it has been tested by brute force by computer programs made by brainy :brain: people. I don't disagree with the fact that it has been tested till 2^68, I thought it would be nice to check it out myself ( :grinning: rather via my program :grinning: ).

Interesting!, @Amol, here's another code.
conjetura1
p89H_conjetura_collatz.aia (2.9 KB)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.