Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! Laskee 10 miljoonaa totienttia
- ! Perustuu Gaussin jakajien summaan
- !Juhani Kaukoranta 4.4.2021
- ! Fortran 95,2003
- integer phi(10000000)
- integer :: n = 10000000
- integer i,j
- real:: start,finish
- call cpu_time(start)
- phi(1)=1
- phi(2)=1
- do i = 2,n
- phi(i) = i -1
- end do
- do i = 2,n
- do j = 2*i,n,i
- phi(j) = phi(j)-phi(i)
- end do
- end do
- call cpu_time(finish)
- write(*,*) 'Time = ',finish-start
- write(*,*)'Euler totienttitaulukko OK, tulostetaan 10 viimeistä'
- do i = n-10,n
- write(*,*) i,phi(i)
- end do
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement