First method: using mod 20449
For the last 2 digits to be 01, 3^n must be 1 mod 143^2 or 1 mod 20449
for n in range(1,200):
if (3**n) % 20449 == 1:
goodN = n
largeN = 3**n
print('n =',goodN, '\n', '3^n in base 10:',largeN, '\n')
This outputs
n = 195
3^n in base 10:
1093061682616768598101980749118434678309602685816438255039403134728775682721408160470718926107
Second method.
Program (this one is recursive) to convert from decimal to arbitrary large integer base.
Instead of letters A=10, B=11, etc, just use the text version of an integer plus a space so the multi-digit "digits" can be distinguished.
For example, using this notation decimal 21 in base 11, instead of looking like 1A would look like 1 10.
def dec2bigbase(i,base):
""" INPUT integer in base 10, return string
of Base base equivalent. """
convertString = [str(i)+' ' for i in range(base)]
if i < base:
return convertString[i]
else:
return dec2bigbase(i//base,base) + convertString[i%base]
for n in range(1,200):
bigNumber = dec2bigbase(3**n,143)
if bigNumber[-5:] == ' 0 1 ':
print('method 2',n)
OUTPUT: method 2 195
fyi
dec2bigbase(3^195,143) produces:
2 40 141 29 79 52 61 74 79 122 117 123 66 25 41 52 128 114 75 11 142 18 135 75 35 31 79 89 25 73 123 36 96 4 71 10 124 75 9 30 118 113 0 1
The last 5 digits of this string are "space,0,space,1,space"
Edited on January 20, 2023, 9:00 am
|
Posted by Larry
on 2023-01-20 08:56:26 |