All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
EMIRP pair inside a PRIME (Posted on 2023-10-19) Difficulty: 3 of 5
Find some primes that safely contain a pair of emirps. The emirps must be isolated from each other and from the outside world by a digit. It is as if the emirps are matter and anti-matter: they cannot touch or there will be a risk of catastrophic anihilation. And since we cannot tell which one is anti-matter, both must be isolated from each other and also the rest of the world. This is all in accordance with the ancient lore.

(1) What is the smallest 9-digit prime of the form: axyzbzyxc, where xyz and zyx are each 3-digit primes with distinct digits; and each letter a,b,c,x,y,z designates a different digit.
(2) Also find the largest.
(3) Now, same question for an 11-digit prime of the form awxyzbzyxwc; again different letters are distinct digits, where wxyz and zyxw are a pair of 4-digit emirps.
(4) Also find the largest.

Note: Emirps are primes whose reversal is a different prime.

No Solution Yet Submitted by Larry    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1
p=primes(999);
clc
emirps=double.empty(0,2);
v=[];
for i=1:length(p)
  if p(i)>99
    ps=char(string(p(i)));
    pr=str2double(flip(ps));
    if isprime(pr)
      emirps(end+1,:)=[p(i) pr];
    end
  end
end

for i=1:length(emirps)
  for a=1:9
    for b=0:9
      for c=1:9
        s=[char(string(a)) ...
          char(string(emirps(i,1))) ...
          char(string(b)) ...
          char(string(emirps(i,2))) ....
          char(string(c))];
        if length(unique(s))==6
          if isprime(str2double(s))
            % disp(s)
            v(end+1)=str2double(s);
          end
        end
      end
    end
  end
end
disp(' ')
sort(v')


p=primes(9999);
 
emirps=double.empty(0,2);
v=[];
for i=1:length(p)
  if p(i)>999
    ps=char(string(p(i)));
    pr=str2double(flip(ps));
    if isprime(pr)
      emirps(end+1,:)=[p(i) pr];
    end
  end
end

for i=1:length(emirps)
  for a=1:9
    for b=0:9
      for c=1:9
        s=[char(string(a)) ...
          char(string(emirps(i,1))) ...
          char(string(b)) ...
          char(string(emirps(i,2))) ....
          char(string(c))];
        if length(unique(s))==7
          if isprime(str2double(s))
            % disp(s)
            v(end+1)=str2double(s);
          end
        end
      end
    end
  end
end
disp(' ')
sort(v')


finds

(1) 134787439
(2) 975181573
(3) 13067276039
(4) 97643834671

from the full lists below
 
ans =
   134787439
   138959837
   170989073
   174363479
   176929673
   195343597
   198323897
   214959413
   214989413
   215747513
   216757613
   217949713
   217959713
   238909831
   238909837
   238949831
   238969837
   238979831
   270141073
   270181073
   270949073
   270969071
   273989371
   274383479
   275101579
   276141673
   276181679
   276909671
   290717093
   290767091
   293707391
   293767391
   293787391
   295343591
   296737691
   296757691
   298303891
   298343891
   310767019
   314989417
   315707519
   370949071
   370989071
   376929671
   390727091
   390787091
   416797613
   417959713
   438919837
   470181079
   470929073
   475121573
   475121579
   476131679
   476151679
   476191673
   476989673
   495313597
   496707691
   510727013
   514939417
   514969417
   516787619
   534707431
   534787439
   538909831
   570939071
   570949073
   570989071
   573989371
   576181673
   576989671
   590717093
   593727391
   598303897
   610747019
   610797013
   614939417
   614959417
   615737519
   615787519
   617909713
   617949713
   635929531
   635989531
   638909837
   638929831
   638959831
   670131079
   670929071
   673949371
   674303479
   674393471
   694101497
   694171493
   695323591
   714969413
   794101493
   810727013
   810747019
   814929413
   814969417
   814979413
   815737519
   817959713
   834707431
   835969531
   870121079
   870959071
   874353479
   875141573
   876121679
   876909673
   890767093
   894101497
   895303597
   896727691
   897151793
   974363471
   975181573
 
ans =
               13067276039
               13067476039
               13089598037
               13257075239
               13467276439
               13467576439
               13527672539
               17043634079
               17043834079
               17459295473
               17523632579
               17529092573
               17589698573
               17603230679
               17643834679
               17649594673
               17649894673
               19257875293
               19467576493
               19857075893
               21409390417
               21409690417
               21453635419
               21583938517
               21597679513
               21657475613
               21789698713
               23049594031
               23049894031
               23089198037
               23109690137
               23469596431
               23541614539
               23571417539
               23697079631
               27459095471
               27459895471
               27561416579
               27589098571
               27589198573
               27649594673
               27649894673
               27681918673
               27963036971
               29013531097
               29041514093
               29467076491
               29547674591
               29601410693
               29613831697
               29643534691
               29643834697
               29803630891
               29857075891
               29857175893
               29857475891
               29857675891
               29871017893
               31249594217
               31249894217
               31409890417
               37649094671
               37649894671
               39241514297
               39521812597
               41237873219
               41259895213
               41283038219
               41283538217
               41523632519
               41523832517
               41723832719
               41867576819
               43089298037
               43169096137
               43257675239
               43527072539
               43571217539
               43571817539
               43821612839
               47253635279
               47529892573
               47589098573
               47589298573
               47603830679
               47681518673
               47901610973
               49257675293
               49521812597
               49601310697
               49781518793
               49803530891
               49803530897
               51069296017
               51069396017
               51069796013
               51237473219
               51237673219
               51409690417
               51429092417
               51789498713
               51867376819
               51867976813
               53019891037
               53049294031
               53049294037
               53067876031
               53089498037
               53089798031
               53109290137
               53169896137
               53271417239
               53271617239
               53407270439
               53467876439
               53467976431
               53469296431
               57321012379
               57901810973
               57963236971
               59041714093
               59241014297
               59241614293
               59403630491
               59421612493
               59437073491
               59467176493
               59467376491
               59601310697
               59643034697
               59643834697
               59871017893
               61237573219
               61249894213
               61259095217
               61283438219
               61283938217
               61429892413
               61487078413
               61523432519
               61583738519
               61723832719
               61789598713
               61847374819
               63019891037
               63089298037
               63109290137
               63251015237
               63407170439
               63821712839
               63851415839
               67043534071
               67253035271
               67349294371
               67529892571
               67589098573
               67589298571
               67589398571
               67841014873
               67841914873
               69013231097
               69103830197
               69127872193
               69241514297
               69257475293
               69521812597
               69803530891
               69871217893
               71283038219
               71283638219
               71409690413
               71523832519
               73251815239
               79241514293
               79421512493
               79601210693
               79803230891
               81249694213
               81259695217
               81279097213
               81409590413
               81429092417
               81429692413
               81429692417
               81523632517
               81657375619
               81753435719
               83049294037
               83049594031
               83049694031
               83067976031
               83169296137
               83271017239
               83271417239
               83407170439
               83407570439
               83467176439
               83469096437
               83541014537
               83541914537
               83571017539
               87219091273
               87253435271
               87321612379
               87459295471
               87529392571
               87529492571
               87529492573
               87529692571
               87603130679
               87643034671
               87649294673
               87963536971
               89257675291
               89403230491
               89421012497
               89467176493
               89521612597
               89547174593
               89643234691
               91283538217
               91487078413
               91487678413
               91583038517
               93067276031
               93541214537
               93821012837
               97523032571
               97523632571
               97643834671


  Posted by Charlie on 2023-10-19 10:02:26
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information