generating pair of numbers in special order

I need some help in generating pair of numbers in orders using FORTRAN code.
The order is like following.
loop_1: 1,2 2,3 3,4 4,5 5,6 6,7 7,8 ..... until <= 2000
loop_2: 1,3 3,5, 5,7 7,9 9,11 11,13 ........until <= 2000
loop_3: 1,4, 4,7 7,10 10,13 13,17 ..... until <= 2000
loop_4: 1,5 5,9 9,13 13,17 17,21 .... until <= 2000
. . . . until loop_100:
I have tried with simple code such as

program loopJump
implicit none
 !
 integer :: i,j,k   
do k = 1, 6  
do i =  1, 5      
j=(i+k)     
print*, i,"   ",j   
enddo  
enddo   

stop  
end

But I can not get as I wanted.

Any help is appreciated.
Thanks in advance.

A sequence like this has me wondering if this might be homework...

I'v never programmed in Fortran. So consider this as pseudocode:

perl -e'
$n = 100;
$k = 2000;
$i = 0;
$j = 0;
$step = 1;
while ($i < $n) {
  $j = 1;
  while ($j <= $k - $step) {
    printf "%d,%d ", $j, $j+$step;
    $j = $j + $step;
  }
  print "\n";
  $step = $step + 1;
  $i = $i + 1;
}
'

There is one unnecessary space at the end of each line.

1 Like

Hi, just for your kind information, the code which post here is not homework but is part of my 200 line code for calculate time auto correlation function of my simulation data.
Anyway, you hint really helped me to write the code and it is running as per my request.

program jumploop
implicit none
!!!!!!!!!!!!!!!!!

  integer :: i,j,k,n


do k = 1, 5
	do i = 1, 10, k
		j = (i+k)

		print*, i, j

	end do
		print*," "
end do


end program jumploop