Interesting work with numbers

Oh... you want the prime factorization of a number.

1 Like

I'm glad that there are people who respond quickly

I honestly did not understand what you said, but hahaha :sweat_smile:

Yes, can you help me?

The app should verify if the Collatz Conjecture works for a specific number. Here's how:

  • The user enters the number.
  • If the number is an even number, divide it by 2.
  • If the number is odd, multiply it by 3, and then add 1 to it.

By the Conjecture, if it hits a number that has only 2 as its factors, it will simplify down to 1, since, it will divide it by 2 all the way (all multiples of 2 are even) down. At 1, it's a never-ending cycle. Since it's an odd number, you triple it and add 1. This will give 4. 4 only has 2 factors: 2 and 2. So, it will simplify back down to 1.
If you get to 1, then the Conjecture is proved as true for the starting number.

1 Like

Well, if the user enters a number, what is Montazeri's answer, that is, he should wait for 1 and see his process in the same way with the elephant puff.

:sweat_smile: :sweat_smile: :sweat_smile: :sweat_smile: :rofl: :joy: :joy:

Translation error :/
Could you please rephrase that?

1 Like

Excuse me, I'm not from the United States, I'm getting help from Google. I meant what the user should expect when he enters a number, and one more point, do you know how he calculated the prime numbers of a number? Thank you. Example 6 is 2. 3 or 14 becomes 2.7

1 Like

Took some time, but this should work:
yes4.aia (2.7 KB)

1 Like

Thank you for your effort, but forgive me very much. When I enter numbers like 42, it says output.
1.2.3.6.7.14.21
But 14 and 21, which is not the first number of Nissan or the number 25, whose output is 5 and 1 ... 5 in 1, which is not 25, but for now

yes4.aia (2.8 KB)
Could you please try now?

1 Like

certainly try Nishyanth's aia but also look at this discussion Get (non) prime numbers between 2 numbers - #12 by Anke

ببخشید من 15 یا عدد دیگه میدم اشتباهه. مثال 15 می گوید 1 و 5
یا هر عددی که میگم اعداد اولش رو نمیده ببخشید

سلام، این به خوبی کار می کند، اما من می خواهم فقط ورودی مانند 16 عدد اولش را بدهد که می تواند 2_2_2_2 باشد.

Sorry, I made a couple of stupid mistakes in my code:

  • I failed to account that a factor may appear more than once in an integer (x^2*y...).
  • I forgot to divide the number by the factors found, which allowed it to stay at the same value and cause sequential numbers which didn't make sense.

I've fixed these, and here's my final aia:
yes4 (4).aia (2.7 KB)

1 Like

Thank you very much, this one is absolutely correct, thank you for all your efforts
None of the servants of God is stupid, only one person is stupid, that is the devil, just seek refuge in God.

1 Like

Sorry I asked this question, but can you tell me how to change the color of the scroll bar only in app inventor, not elsewhere, if you know, please help us, thank you :pray: :pray: :pray:

1 Like

Explain this AI2 code and what we can learn about AI2's math blocks from them ...

1 Like