I am trying to convert my previous unique solutions made by Kotlin, but I’ve found that the methods than used by Java language, doesn’t exists natively on Ada language, that’s my language than I’ve solved my previous challenges on senior stage.
What do you understand or find about that problem
How’s going to find the equivalent to IsProbablePrime() and nextProbablePrime(), or build now, a possible algorithm to work properly.
Did you try any workaround? What did you do?
Until today, my process to migration from Kotlin codes (unique solutions too) to Ada codes has been sucessfull.
I found both links that might to explain this trouble:
-Emirp numbers: Emirp primes - Rosetta Code
I need help with
To understand that algorithm, 'cause the Kotlin solution has a built in methods that Ada doesn’t have it!
I understand that the program uses the Miller-Rabin primality test to determine whether a number is prime or not. The
Is_Emirp function takes a number
E and checks whether it is an emirp number or not. To do this, it uses the
Rev function, which reverses the number
E and stores it in
R. It then checks whether
E is different from
R and whether both
R are prime using the Miller-Rabin test with the specified number of iterations.
Next function takes a prime number
P and returns the next emirp prime number. To do this, it increments the number
N by one and checks whether it is an emirp number. If it is not, it continues to increment
N until it finds one.
Finally, the program shows the first twenty emirp numbers, the emirp numbers between 7700 and 8000, and the ten-thousandth emirp number. The program ends after displaying the corresponding emirp number.
However, if you cannot make progress in the construction of challenges with ADA, it is recommended that you use another language or look for a challenge with a different complexity.
I have had found a properly solution to look the equivalent algorithm of “isProbablePrime” and “nextProbablePrime” using my Java and later, Kotlin code; So, I don’t have any kind of trouble of translate towards Ada, using the complete code and shredded the respective functions.