jukaukor

Taxicab.f08

Jun 30th, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. program Taxicab
  2. implicit none
  3.  
  4. integer (kind = 16) :: taxicabnumber = 48988659276962496
  5. integer (kind = 16) :: i,j,i3,temp,erotus,raja
  6. print *,"Ta(3) = 87539319 löytyi v.1957 tietokoneella"
  7. print *, "Ta(4) = 6963472309248 löytyi v.1991 tietokoneella"
  8. print *, "Ta(5) = 48988659276962496 löytyi v.1994 tietokoneella"
  9. print *, "Ta(6) = 24153319581254312065344 löytyi v.2008 tietokoneella"
  10. read *, taxicabnumber
  11. print *,"taxicabnumber = ",taxicabnumber
  12. raja = ceiling(taxicabnumber**(1.0/3.0),8)
  13. print *,"raja = ",raja
  14. temp = 0
  15. do i = 1,raja
  16. i3 = i*i*i
  17. erotus = taxicabnumber - i3
  18. j = ceiling(erotus**(1.0/3.0),8)
  19. if (i3 + j*j*j == taxicabnumber) then
  20. if (i == temp) then
  21. exit
  22. end if
  23. print *,"taxicabnumber = ",i,"^3 + ",j,"^3"
  24. temp = j
  25. end if
  26. end do
  27.  
  28.  
  29.  
  30. end program Taxicab
Advertisement
Add Comment
Please, Sign In to add comment