// This code correspond to the exhaustive search for the lower bounds on d(i) in Theorem 9 of // "How far away must forced letters be so that squares are still avoidable?" // It should be compiled with c++11 or higher and optimization O3 wich gives: // g++ lower_bounds_on_d.cpp -O3 -o #include #include using namespace std; bool hasSquareLast(const string& word){//checks whether one of the suffix of the word is a square int s = word.size(); for(int i = 1; i*2<=s; i++){ bool isrep = true; for(int j=0; j6 or 4 to check that d({0,1,2,3})>2"<> input; string w(""); if(input == 3) findWords(3, 6, w); else if(input== 4) findWords(4, 2, w); else cout<<"Enter 3 to check that d({0,1,2})>6 or 4 to check that d({0,1,2,3})>2"<