Advertisement
jukaukor

Gausstotientit.f03

Apr 4th, 2021
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. ! Laskee 10 miljoonaa totienttia
  2. ! Perustuu Gaussin jakajien summaan
  3. !Juhani Kaukoranta 4.4.2021
  4. ! Fortran 95,2003
  5. integer phi(10000000)
  6. integer :: n = 10000000
  7. integer i,j
  8. real:: start,finish
  9. call cpu_time(start)
  10. phi(1)=1
  11. phi(2)=1
  12. do i = 2,n
  13. phi(i) = i -1
  14. end do
  15.  
  16. do i = 2,n
  17. do j = 2*i,n,i
  18. phi(j) = phi(j)-phi(i)
  19. end do
  20. end do
  21.  
  22. call cpu_time(finish)
  23. write(*,*) 'Time = ',finish-start
  24.  
  25. write(*,*)'Euler totienttitaulukko OK, tulostetaan 10 viimeistä'
  26.  
  27. do i = n-10,n
  28. write(*,*) i,phi(i)
  29. end do
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement