Problema algoritmo

Vorrei fare un algoritmo per scomporre in fattori primi numeri molto grandi a 7-8 cifre come posso fare, senza mandare in crash l'app ?

There are algorithms on the web for prime factorization.

But to run them on Android, you have to break up execution so Android doesn't think your app went into a coma.

Combine the algorithm you like with a Clock Timer to run it in chunks, and be ready to spend a lot of time.

There is an extension that moves the execution of a procedure to another thread. This is how it should be done in Android. Try: [Free] Async Procedures | Extension - Extensions - Kodular Community

test_async.aia (22.4 KB)

grazie!:heart:

Search this board for 'Sieve of' for a prime number sieve.


mi esce questo cosa significa?

What are you testing this in? I tested it in companion on a real android 14 device and I don't have this error. After about 2 seconds I have the result:

ho provato sul mio tablet e non va, quale potrebbbe essere il problema ho scaricato il tuo stesso file ?

An error with stack size...
Probably you created an endless loop?

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Maybe this need a lot of memory. I'll check on an older phone with Android 9. Now I've launched this app with a 12-digit number on Android 14, the calculation process has been going on for 16 minutes and I haven't received an error yet.


Con numeri piccoli funziona poi per i numeri più grandi esce quell'errore

On android 9. It took a lot longer, but the result was obtained without error.

nella foto il codice dei blocchi è identico al tuo forse perchè ho mit app inventor versione precedente? potrebbe essere?

Do you mean the older companion version? Or are you using a different version of app inventor, e.g. offline? Try building the APK and installing it on your device.

sto usando app inventor offline

ho gia creato l app su un dispositivo ndroid 13 ed è la stessa cosa

The procedure I did is recursive. Can you show what your procedure for factoring a number into its prime components looks like?

In the first post you wrote that you created a procedure that factorizes a number. But it causes the UI to hang. Show me this procedure, i.e. blocks. Or share your original project.

Why don't you use appinventor online?

1 Like