jukaukor

FactorsOf2Powers.jl

Jun 2nd, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #Factoroidaan 2^(q-2) - 1 alkulukutekijoiksi p
  2. # ehtona q % 8 = 1,7
  3. # tutkitaan toteuttaako n=p*q kongruenssin 2^(n-2)=1 (mod n)
  4. using Primes
  5. function alkutekijat(q1::Int,q2::Int)
  6. for q in q1 : 2 : q2
  7. res = q % 8
  8. if (res==1) || (res==7)
  9. a = factor(Vector,big(2)^(q-2)-1) #alkulukutekijät
  10. println("q = ",q," , ",a)
  11. for k in 1 : length(a)
  12. res = a[k] % 8
  13. if (res == 1) || (res == 7)
  14. n = big(q * a[k])
  15. if powermod(2,n-2,n) == 1
  16. println("q = ",q, " p = ",a[k]," n = ",n," kongruenssi")
  17. end
  18. end
  19. end
  20. end
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment