# How many words are possible with the english alphabet.

Show 50 post(s) from this thread on one page
Page 2 of 2 First 12
• March 12th, 2009, 10:59 AM
g.eckert
Re: How many words are possible with the english alphabet.
Well my original idea was to print all the possiblities to file. Then i started thinking about how long it would take and thats where the "count" concept came up. I think ill write the code for 10 character words and let it run overnite see how far it gets. XD. This was just for fun anyway.
• March 12th, 2009, 11:08 AM
yzaykov
Re: How many words are possible with the english alphabet.
Code:

```#include <iostream> #include <vector> typedef std::vector<char> Container; const int maxLength = 10; Container c(maxLength); void print(int l) {         for (int i = 0; i < l; ++i)                 std::cout << c[i];         std::cout << std::endl; } void rec(int i, int l) {         if (i == l) {                 print(l);                 return;         }         for (int j = 0; j < 26; ++j) {                 c[i] = j + 'A';                 rec(i+1, l);         } } int main() {         for (int l = 1; l <= maxLength; ++l) {                 c.clear();                 rec(0, l);         } }```
That's not faster, but it's kind of better.
• March 12th, 2009, 11:23 AM
JohnW@Wessex
Re: How many words are possible with the english alphabet.
Quote:

and thats where the "count" concept came up. I think ill write the code for 10 character words and let it run overnite see how far it gets.
But we already know what the final count should be using our calculators?
• March 12th, 2009, 11:27 AM
ninja9578
Re: How many words are possible with the english alphabet.
yep, it'll be 10 in base 26 :-P
• March 12th, 2009, 11:28 AM
g.eckert
Re: How many words are possible with the english alphabet.
Nice, i love that recursive method and how it changes the characters. Im not too fluent on Vectors and containers in C++, it looks like they are similar to Javas versions but I can see how they are working.
• March 12th, 2009, 11:31 AM
g.eckert
Re: How many words are possible with the english alphabet.
My calculator cries when i type in.
26^1 + 26^2 + 26^3 + 26^4 + 26^5 + 26^6 + 26^7 + 26^8 + 26^9 +26^10.

I think i said it was something around 10^14
• March 12th, 2009, 12:13 PM
laserlight
Re: How many words are possible with the english alphabet.
Quote:

Originally Posted by g.eckert
My calculator cries when i type in.
26^1 + 26^2 + 26^3 + 26^4 + 26^5 + 26^6 + 26^7 + 26^8 + 26^9 +26^10.

I think i said it was something around 10^14

Use a 64 bit integer type, or an arbitrary precision math library like GMP. Actually, the calculator utility that comes with your OS might be able to determine the result without resorting to scientific notation.
• March 12th, 2009, 12:26 PM
g.eckert
Re: How many words are possible with the english alphabet.
Hmm i had to play around with my Windows calculator but i got it to work.

146,813,779,479,510

146.8 Trillion combinations.. XD

My real original thought was to make a password hacker. Using a file of all possible combinations inluding.

A-Z
a-z
0-9
And all the valid symbols...... ! @ # \$ &#37; ^ & * ( ) ' ; . , and such..

That quickly became unreasonable so i went with all possible words for fun.
• March 13th, 2009, 03:34 AM
g.eckert
Re: How many words are possible with the english alphabet.
I let the one program run for 10 hours and it only got halfway through 6 character words.
Show 50 post(s) from this thread on one page
Page 2 of 2 First 12