Determine the total number of semiprimes below 2023, that are immediately followed by an
emirp.
For example, 22 is a semiprime which is immediately followed by 23. But 23 is NOT an emirp, since 32 is composite.
List all valid pairs in conformity with the provisions of the problem.
*** Computer program/ excel solver aided methods are welcome, but a semi-analytic methodology is preferred.
clearvars,clc
spCt=0; spEmirp=0;
for n=1:2022
f=factor(n);
if length(f)==2
spCt=spCt+1;
np1=char(string(n+1));
emirp=str2double(flip(np1));
if isprime(emirp) && isprime(n+1) && n+1 ~= emi
spEmirp=spEmirp+1;
fprintf('%5d ',n,factor(n),emirp,n+1);
fprintf('\n');
% disp([n factor(n) emirp])
end
end
end
disp([spCt spEmirp]);
finds
prime mutual
n factorization emirps
106 2 53 701 107
166 2 83 761 167
178 2 89 971 179
346 2 173 743 347
358 2 179 953 359
982 2 491 389 983
1282 2 641 3821 1283
1438 2 719 9341 1439
1486 2 743 7841 1487
1522 2 761 3251 1523
1618 2 809 9161 1619
581 semiprimes found, 11 followed by emirp
|
Posted by Charlie
on 2023-01-14 11:01:12 |