I need to calculate every 3 digits of my decimal input. I have a code like this:
decimal = 136462380542525933949347185849942359177
#Encryption
e = 79
n = 3337
def mod(x,y):
if (x<y):
return x
else:
c = x%y
return c
def enkripsi(m):
decimalList = [int(i) for i in str(m)]
print("Decimal List: ", decimalList)
cipher = []
for i in decimalList:
cipherElement = mod(i**e, n)
cipher.append(cipherElement)
return (cipher)
c = enkripsi(decimal)
print("Decimal Encyption: ", c)
The output are:
Decimal List: [1, 3, 6, 4, 6, 2, 3, 8, 0, 5, 4, 2, 5, 2, 5, 9, 3, 3, 9, 4, 9, 3, 4, 7, 1, 8, 5, 8, 4, 9, 9, 4, 2, 3, 5, 9, 1, 7, 7]
Decimal Encryption: [1, 158, 2086, 2497, 2086, 3139, 158, 2807, 0, 270, 2497, 3139, 270, 3139, 270, 1605, 158, 158, 1605, 2497, 1605, 158, 2497, 1254, 1, 2807, 270, 2807, 2497, 1605, 1605, 2497, 3139, 158, 270, 1605, 1, 1254, 1254]
How can i get output Decimal List: [ 136, 462, 380, ...]
so that Decimal Encryption: [ 2174, 2504, 3249, ...]
?