本文介紹了素性測試的最快算法的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我需要在非常大的數字之間的間隔上測試素性(在 long long 范圍內),所以我需要一些快速算法來檢查一個數字是否為素數.請提出您的想法.
I need to test primality on intervals between numbers which are really big (in the range of long long), so i need some fast algorithm for checking if a number is prime or not. Please suggest your ideas.
推薦答案
一個好的方法是 Miller-Rabin 測試.不過需要注意的是,這只是一個概率測試.
One good method is the Miller-Rabin test. It should be noted however, that this is only a probabilistic test.
這篇關于素性測試的最快算法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!