[R] Integer bit size and the modulus operator

Ionut Florescu ifloresc at stevens.edu
Mon Jan 30 17:32:16 CET 2006

```I am a statistician and I come up to an interesting problem in
cryptography. I would like to use R since there are some statistical
procedures that I need to use.
However, I run into a problem when using the modulus operator %%.

I am using R 2.2.1 and when I calculate modulus for large numbers (that
I need with my problem) R gives me warnings. For instance if one does:
a=1:40;
8^a %% 41
one obtains zeros which is not possible since 8 to any power is not a
multiple of 41.
In addition when working with numbers larger that this and with the mod
operator R crashes randomly.

I believe this is because R stores large integers as real numbers thus
there may be lack of accuracy when applying the modulus operator and
converting back to integers.

So my question is this: Is it possible to increase the size of memory
used for storing integers? Say from 32 bits to 512 bits (Typical size of
integers in cryptography).

Thank you, any help would be greatly appreciated.
Ionut Florescu

```