Simpler but with bigger (long) integers:

      NN=NDP*(NDT-1)*NDR+NDR
      lok(ig,jg)=(ig-1)*NN+jg

Time for a joke it says ...

I went to the hospital lately. Nothing serious by the way.
The doctor asked me some routine things like name, adress, phone number, year of birth, and then came up with the final question: "What's your job?". I thought I should tell him a few interesting things about High Performance Computing and Networking. But he just stared at me, and after a short while he grabbed his pencil and said: "Administration".

Next sheet ==>