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

Home > Numbers
What Are These Numbers? (Posted on 2024-01-06) Difficulty: 3 of 5
• Each of ROME, PARIS, ARRAS, ARLON and LENS is a prime number.

• Each of NIMES, ANS, MONS is 7 times the product of a prime number.

• SPA is a perfect square.

What are these numbers ?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 2 of 2 |
primNos={'rome','paris','arras','arlon','lens'};
prime7={'nimes','ans','mons'};
sq='spa';

lets='romeaslnip';
perm=lets(perms(1:10));
for i=1:length(perm)
  p=perm(i,:);
  sq=str2double(translate('spa',p));  
  sr=round(sqrt(sq));
  if sr^2==sq
    good=true;
    for j=1:length(primNos)
      if ~isprime(str2double(translate(primNos{j},p)))
        good=false;
        break
      end
    end
    if good
      for k=1:length(prime7)
        tstprm=str2double(translate(prime7{k},p))/7;
        if tstprm==round(tstprm)
          if ~isprime(tstprm)
            good=false;
            break
          end
        end
      end
    end
    if good
      disp(p)
    end
  end
end
 

function tr=translate(a,code)
  b=zeros(1,length(a));
  for i=1:10
    c=code(i);
    idx=a==c;
    b(find(idx))=char(string(i-1));
  end
  tr=char(b);
end

finds two:

lepnmrosia
onpsaimelr

We'll work with each:

lepnmrosia
0123456789
onpsaimelr

ROME, PARIS, ARRAS, ARLON and LENS
5641  29587  95597  95063     0137       leading zero
9067  24953  49943  49801     8731

so we'll continue with the second possibility:

 NIMES, ANS, MONS
 15673  413  6013
 
SPA
324     
     =  18^2


Edited on January 6, 2024, 9:37 am

Edited on January 6, 2024, 9:38 am
  Posted by Charlie on 2024-01-06 09:35:12

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
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