Problem 098

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
DaveNo1
Posts: 10
Joined: Sat Oct 25, 2008 4:36 am

Problem 098

Post by DaveNo1 »

Is it right, that there are 44 Word Anagrams in total and only one word (SHEET) contains a letter twice?
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 98

Post by jaap »

That number is correct. The second part of your question is easily seen to be false if you read through the word list (e.g. ACADEMIC, ACCEPT), and there are even several anagram pairs with repeated letters.
DaveNo1
Posts: 10
Joined: Sat Oct 25, 2008 4:36 am

Re: Problem 98

Post by DaveNo1 »

Thanks for the confirmation. Before I did not lookup for double digit -> letter assignments. My lazy implementation was just checking if digit(a) != digit(a+1) which is false ... of course. corrected that and voila :)
dnovatchev
Posts: 5
Joined: Fri Jan 16, 2009 6:44 am

Problem 098

Post by dnovatchev »

What should I understand is correct when there are three ore more words that are anagrams to each other:
  • Every pair of words can have their own (different ) mapping from letters to digits
  • Every word in the group must use the same mapping from letters to digits
Here is an example:

caret, cater, crate,react,recta,trace

can we have
caret = 12345 and cater = 12543

and at the same time:

caret = 67890 and react = 89760

or once we have chosen 12345 for caret then all words in the group should use the same mapping?

Thanks,
Dimitre Novatchev
User avatar
Georg
Posts: 157
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany
Contact:

Re: Problem 098

Post by Georg »

Every pair of words can have their own (different ) mapping from letters to digits.
elr
Posts: 67
Joined: Thu Apr 09, 2009 9:47 am

Re: Problem 098

Post by elr »

can two words like

ABCDEFG & ABC

be anagram pairs (assuming that there is a valid square that match ABCDEFG) ?
Image
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 098

Post by daniel.is.fischer »

No, anagrams are permutations, so both words have the same number of letters.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
joetom93
Posts: 1
Joined: Sun May 29, 2011 1:28 am

Problem 098

Post by joetom93 »

Can someone explain to me why a pair of words like this does not fit the guidelines?
CENTRE: 436921 = 661*661
RECENT: 214369 = 463*463

I realize that there is more than one 'e' but these numbers are still anagrams and no two letters have the same digital value.
Thanks a lot
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 098 Centre Recent

Post by jaap »

You use both E=1 and E=3. A letter cannot have two different values, i.e. when you substitute a letter by a value, you must substitute all occurrences of that letter by the same value.
User avatar
hk
Administrator
Posts: 12831
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 098

Post by hk »

joetom93 wrote:Can someone explain to me why a pair of words like this does not fit the guidelines?
CENTRE: 436921 = 661*661
RECENT: 214369 = 463*463

I realize that there is more than one 'e' but these numbers are still anagrams and no two letters have the same digital value.
Thanks a lot
Please don't start a new topic for a problem when one exists already.
Image
War ruins the life and health of untold numbers of innocent children.
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 098

Post by thundre »

joetom93 wrote:Can someone explain to me why a pair of words like this does not fit the guidelines?
CENTRE: 436921 = 661*661
RECENT: 214369 = 463*463
It does not fit because you are using 2 different mappings for E.
Image
benedicfuentes
Posts: 4
Joined: Mon Dec 02, 2013 8:09 am

Problem 98

Post by benedicfuentes »

By replacing each of the letters in the word CARE with 1, 2, 9, and 6 respectively, we form a square number: 1296 = 362. What is remarkable is that, by using the same digital substitutions, the anagram, RACE, also forms a square number: 9216 = 962. We shall call CARE (and RACE) a square anagram word pair and specify further that leading zeroes are not permitted, neither may a different letter have the same digital value as another letter.

Using words.txt (right click and 'Save Link/Target As...'), a 16K text file containing nearly two-thousand common English words, find all the square anagram word pairs (a palindromic word is NOT considered to be an anagram of itself).

What is the largest square number formed by any member of such a pair?

NOTE: All anagrams formed must be contained in the given text file.
last line said "All anagrams formed must be contained in the given text file.". does it mean that no words will be generate (anagram) outside the given file??

and is it right that the longest word (pair of anagram words) has the possible answer? because i think that
the length of the word is equal to the number of digits of squared number.

i checked the words that has the most number of characters.
and after getting the anagram, i checked the possible squared number
of them from my list of squared numbers (starting with the highest number)
i end up with this words (i'm not sure if this is the right words)
INTRODUCE and REDUCTION

but still,, my answer is not the right one.. :(
thank you for response

Edit by mpiotte:
I merged your topic with an already existing one.
Please check in the future if there already exists a topic for a problem.
benedicfuentes
Posts: 4
Joined: Mon Dec 02, 2013 8:09 am

Re: Problem 098

Post by benedicfuentes »

last line said "All anagrams formed must be contained in the given text file.". does it mean that no words will be generate (anagram) outside the given file??

and is it right that the longest word (pair of anagram words) has the possible answer? because i think that
the length of the word is equal to the number of digits of squared number.

i checked the words that has the most number of characters.
and after getting the anagram, i checked the possible squared number
of them from my list of squared numbers (starting with the highest number)
i end up with this words (i'm not sure if this is the right words)
INTRODUCE and REDUCTION

but still,, my answer is not the right one.. :(
thank you for response
pieppiep
Posts: 23
Joined: Thu Dec 30, 2010 6:23 am

Re: Problem 098

Post by pieppiep »

benedicfuentes wrote:last line said "All anagrams formed must be contained in the given text file.". does it mean that no words will be generate (anagram) outside the given file??
You only use the words in the file, no other words you can generate from them.
So if DUCEINTRO would be a real english word and would give a squared number, that word/number wouldn't count.
and is it right that the longest word (pair of anagram words) has the possible answer? because i think that
the length of the word is equal to the number of digits of squared number.

i checked the words that has the most number of characters.
and after getting the anagram, i checked the possible squared number
of them from my list of squared numbers (starting with the highest number)
i end up with this words (i'm not sure if this is the right words)
INTRODUCE and REDUCTION

but still,, my answer is not the right one.. :(
thank you for response
If you can replace each character with a different digit (I = 1 and N = 1 is not valid) and both INTRODUCE and REDUCTION give square numbers, then the largest of them is the answer.
If they don't, you probably need to search the other words.
Image
quick.dudley
Posts: 4
Joined: Fri Sep 24, 2010 10:32 am

Re: Problem 98

Post by quick.dudley »

The answer is the number, not the word.
Image
vjcinjr
Posts: 5
Joined: Mon Aug 22, 2016 2:35 am
Location: New York, USA

Re: Problem 098

Post by vjcinjr »

I assume you can only use single decimal digits when assigning a number to a character. For example, one can not assign the letter 'C' to the number 12. Correct?
User avatar
sjhillier
Administrator
Posts: 561
Joined: Sun Aug 17, 2014 4:59 pm
Location: Birmingham, UK
Contact:

Re: Problem 098

Post by sjhillier »

vjcinjr wrote: Wed Mar 29, 2017 8:43 pm I assume you can only use single decimal digits when assigning a number to a character. For example, one can not assign the letter 'C' to the number 12. Correct?
Yes, that's right.
Loiyer
Posts: 1
Joined: Thu Apr 12, 2018 2:06 am

Re: Problem 098 Centre Recent

Post by Loiyer »

jaap wrote: Sun May 29, 2011 2:05 am You use both E=1 and E=3. A letter cannot have two different values, i.e. when you substitute a letter by a value, you must substitute all occurrences of that letter by the same value.
Is this in the wording of the question?
User avatar
RishadanPort
Posts: 79
Joined: Mon Jun 10, 2013 7:31 am

Re: Problem 098

Post by RishadanPort »

I have a bug in my code, that is for only reason giving me the largest square being 4 digits.

Can anyone give me any example of a square larger than 4 digits... (even 5) that is valid,
and by valid I mean that it has some other pair square -- matching 2 word anagrams

(Also doesn't have to be the largest of that number digits... just needs to have some other match)


My code does correctly get the 9216 / 1296 square pair for CARE / RACE

Thanks
Image

Rishada is the gateway to free trade—but the key will cost you.
User avatar
oscar_thenon
Posts: 2
Joined: Sat May 30, 2020 10:33 am

Re: Problem 098

Post by oscar_thenon »

Hello,

I have some difficulties to interpret "neither may a different letter have the same digital value as another letter". For me, it means that if we take two different letters from a word, these two letters must be associated with different digits.

However, the list contains the word 'CONSIDERABLE', so this rule cannot apply since it contains 11 different letters.

For example, if CONSIDERABLE = 123456789017, the two E are associated with 7, but C and L are associated with 1 which is forbidden. But no matter what you do, it's impossible to avoid it.

Have I misunderstood the wording ?

EDIT, PROBLEM SOLVED : I realized that this problem doesn't occur to word pairs since they all contain at most 10 different letters.
Image
Post Reply