A new language is created that only uses the letters A, B, C, D, and E. A sequence of letters is called a word if it does not include the same letter twice in a row, and it does not include two vowels in a row. How many words are there in this language that are 10 letters long and that begin with a vowel?
0 . You can't have words 10 letters long with no repeats allowed and only 5 letters...
Asher Thompson
This
Daniel Campbell
i really hate problems
Joseph Bell
Proof that Veeky Forums is retarded and in denial. This problem is from a 6th grade math exam.
Samuel Gutierrez
Lmao so easy it's 5x4^9
David Bennett
>A sequence of letters is called a word if it does not include the same letter twice in a row, and it does not include two vowels in a row.
lol no
Luis Sanders
So basically none of the letters repeat. My answer is correct, actually.
Matthew Phillips
no please tell me you are trolling
Jace Anderson
Spotted the humanities retard.
lrn2formal languages or gb2/lit/
Brayden Clark
pls accept the fact that the letters can be used over again
Brayden Richardson
> making 10 letter words from only 5 distinct letters
Justin Myers
5 reusable letters
Luis Gomez
Nah it's clearly the other way.
The answer is 0 OP
Hunter Allen
a=2*3*b b=2*c+2*3*d c=2*d+2*3*e ... i=2*j+2*3 j=5 Evaluate a Something like that
Easton Walker
pull the lever, they die twice as fast so suffer half as much.
Evan Morgan
Let v(n) be the number of words that start with a vowel and end with a vowel. c(n) be the number of words that start with a vowel and end with a consonant. Then v(1) = 1 c(1) = 0 v(n+1) = v(n) + 2*c(n) c(n+1) = 3*v(n) + 2*c(n)
Let: P_i = {w | w has a length w_i} R = {w |w has no two vowels in a row, and no two same letters in a row} Q = {w |w begins with a vowel} n_i = card (Pi && R && Q) m_i = card (Pi && R && not Q)
i.e. n_i is the number of such words of length i beginning with a vowel m_i is the number of such words of length i beginning with a consonant
But [math]/omega * 2[/math] is still much, much less than uncountably many people. I don't think you can even have uncountably many people on the track when you can clearly, well, count them.
Joseph Davis
I got halfway through the problem before I gave up. I plotted out the first part of the problem in pic related (empty circle is the start, red circles are vowels, black circles are consonants)
The first part is simple enough from the start, you have 2 options, a or e. From each of those nodes, you have 3 options, the 3 consonants, since you cant have two vowels. So it's 2*3 for words of length 2. From there, those nodes branch out into 4 i.e. any letter other than itself. So for words of length 3, it's 2*3*4
This is where I'm stuck.
The branching degree of the next level varies because there are 12 vowel nodes that expand into 3, and 12 consonant nodes that branch into 4. (12*3)+(12*4) makes for 84 branches total. So if 24 nodes branch of in 84 directions, that gives an average branching factor of 84/24 = 3.5
The ratio of red vowel nodes to black consonant nodes keeps changing. Just by hand counting, I can see the average branching is approx 3.71428
I don't know where to go from here. I've never dealt with combinations where the branching varies.
I would create an adjacency-matrix and multiply it with itself 10 times and finally sum all elements in that matrix. Something along those lines should give all possible words in that language
Joshua Bennett
>6th grade math
Ian Price
But it's not. It's a combinatorics problem whose answer is a large number. 0/10
Jeremiah Wilson
Where's multi track drifting?
Isaac Wright
...
Nicholas Smith
Why would anyone pull the lever? I'm saving 100% of the people in the pic by not pulling it.
Owen Barnes
Correct answer
Ian Lewis
Easier programmable way to do this however, here it is in rust. It gets the answer recursively.
and here is my c++ solution: ghostbin.com/paste/z8yyt it's still running by the time I post this so I don't know if it works jet
Anthony Adams
I forgot that it has to beginn with a vowel
Aaron Green
>using a function call for CtoI instead of a #DEFINE pleb
Angel Carter
Aleph_0 and Aleph_1 are ordinalities not cardinalities. I don't think this question is well posed.
Jacob Powell
Here is the corrected version of Let v(n) be the number of words of length n that start with a vowel and end with a vowel. c(n) be the number of words of length n that start with a vowel and end with a consonant. Then v(1) = 2 c(1) = 0 v(n+1) = 2*c(n) c(n+1) = 3*v(n) + 2*c(n)
The trolley kills -1/12 people in both scenarios, so it doesn't really matter.
Aaron Smith
This is incorrect. My bad.
Blake Barnes
Nice one. >Easier Well, my was brute force. To come up with your solution you had to think a little. But these matches are bad. You don't need to write return in last statement of function and you don't need to use these unreadable ifs inside match. gist.github.com/e779072068bc5a805630014f10b70fff
>using new for tables instead of Vector >{ 'A', 'B', 'C', 'D', 'E' }; instead of "ABCDE"; >C-like fors instead of C++14 for-in >generating, storing in huge array and then checking all words instead of doing it while generating >while(true) without thread yield insdie user, what the fuck.
Charles Edwards
as you may have noticed I'm new in c++ what is thread yield and what is wrong with my for loops? (the array thing doesn't make it slower does it?)
Cooper Young
while (1) {} can potentially max a core out at 100%, don't do that
Connor Hill
You should never use `new` and `delete` in C++ unless you know absolutely what you are doing. You should use shared/unique pointers and/or Vector and/or Array. It will prevents all memory and resource leaks and RAII is much more safer and easier to do. Your for loops looks ugly and are very vulnerable to bugs. for(auto el : v){ ... is more readable and easier than for(int i=0; i
Grayson Russell
Also it seems you learned C++ from someone/book who doesn't understand C++11. Go watch: youtube.com/watch?v=xnqTKD8uD64 And then read Meyers S - Effective Modern C++ if you want to use C++ at its full potential.
Jayden Evans
while(1){} gets removed and similar things get optimized by any compiler from this century
Ryder Butler
No it doesn't...
Jaxson Smith
thank you very much guys here is the updated code (it only takes like 27s now before it took like 7min) ghostbin.com/paste/r3yug
Evan Watson
I can't get the new for loop working and I'm self-teaching myself sooo...
Jack Ward
use the optimization flags then. -o2 is sensible in G++
Robert Turner
Are you blind or retarded?
Ayden Thomas
Tell me what, exactly, would while (1) {} "optimize" to?