Using LibreOffice Calc
Using OpenOffice.org Calc
The result is erroneous in both the cases, as we can find using Calculator (gcalctool).
All the above tests were done in Ubuntu. I can not comment on Excel in MS Office since I do not have access to it.
Now, using a calculator will be possible, but cumbersome. I need to fill up a table with more than five hundred values. I know that I can resort to Euler's theorem or Fermat's little theorem or corollaries of these, but actually I am going to use the aforementioned table to show numerical validity (and use) of these theorems.
Is there a way to coax the spreadsheet programs to give me correct results?