clearvars,clc
n=1;v=sym(3);
found=false;
while found==false
n=n+1; v=v*3;
if mod(v,143^2)==1
found=true;
end
end
n
inbase= tobase(v,143)
disp(length(inbase))
v
disp(length(char(string(v))))
function out=tobase(value,base)
out=[]; v=value;
while v>0
q=floor(v/base);
r=v-q*base;
out=[r out];
v=q;
end
end
finds the smallest value of n in base 10 to be 195.
The value of 3^195 in base 143 is 44 digits long and is expressed in the following 44 digits (each digit given in decimal):
[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]
In decimal, that's
1093061682616768598101980749118434678309602685816438255039403134728775682721408160470718926107
which has 94 digits.
The printout:
n =
195
inbase =
[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]
44
v =
1093061682616768598101980749118434678309602685816438255039403134728775682721408160470718926107
94
|
Posted by Charlie
on 2023-01-20 14:13:12 |