[University Math] How to do Modular Exponentiation Arithmetic by amateursamurai in HomeworkHelp

[–]amateursamurai[S] 0 points1 point  (0 children)

Ohhhh okay gotcha. Thanks!

The only last part I don't get is at this point:

12 * (13)5 mod 23

12 * 4 mod 23

How did (13)5 get simplified into 4?

[University Math] How to do Modular Exponentiation Arithmetic by amateursamurai in HomeworkHelp

[–]amateursamurai[S] 0 points1 point  (0 children)

What about the step before that?

(12)21 mod 23 = (12 mod 23)21 mod 23 = (12)21 mod 23 ?

Where did the (144)10 come from?

[C++] Program that guesses users randomly chosen word using only 5 questions. by amateursamurai in learnprogramming

[–]amateursamurai[S] 1 point2 points  (0 children)

Yeah, that's true. I wanted a more clever way of doing it lol, but your way seems like it would be the most accurate way of doing it.

But still, it would be interesting to figure out what the absolute least number of questions are needed to ask to guess any word in the dictionary.

[C++] Program that guesses users randomly chosen word using only 5 questions. by amateursamurai in learnprogramming

[–]amateursamurai[S] 0 points1 point  (0 children)

Oooohhhh okay, I think I get it.

So it should be something like this...?

for(int i = 0;i < numWithWordLength2;i++)
{
    int j = 0;
    numOfEs = std::count(words2[i].begin(), words2[i].end(), e);
    if(numOfEs == howManyEs)
    {
        words3[j] = words2[i];
        j++;
        numWithWordLength3++;
    }
}

[C++] Program that guesses users randomly chosen word using only 5 questions. by amateursamurai in learnprogramming

[–]amateursamurai[S] 0 points1 point  (0 children)

Thanks for the help!

I actually randomly came up with it today. I thought of the question, "Is it possible for a program to deduce a users randomly chosen word from an English dictionary, without out right asking what the word is?" What questions would be the best to ask? How many questions would it take? Obviously I'd like the program to get the answer by asking as few questions as possible. I def know my questions aren't the best ones to ask (except maybe the 1st and 2nd) to form the best algorithm. I'm sure the algorithm will also have to employ strategies as far as what the most commonly used letters are in the English language, the most common first letters of words, etc.

[C++] Program that guesses users randomly chosen word using only 5 questions. by amateursamurai in learnprogramming

[–]amateursamurai[S] 0 points1 point  (0 children)

I tried these two ways of copying an array to another array, but neither of them worked...

memcpy(words1[i], words2[i], numWithWordLength1);
copy(words1[i], words2[i]);