def tifrregular(a) :
i = 3
while (i * i <= a) :
if(i*i ==a):
print("{} = {}*{}".format(a,i,i))
return
j = i
while (j * j <= a) :
k = j
if(i*i + j*j == a):
print("{} = {}*{} + {}*{}".format(a,i,i,j,j))
return
while (k * k <= a) :
l = k
if (i * i + j * j + k * k == a):
print("{} = {}*{} + {}*{} + {}*{}".format(a,i,i,j,j,k,k))
return
while (l * l <= a) :
if (i * i + j * j + k * k + l * l == a) :
print ("{} = {}*{} + {}*{} +".
format(a,i,i,j,j), end = " ")
print ("{}*{} + {}*{}".
format(k,k,l,l), end="\n")
return
l = l + 1
k = k + 1
j = j + 1
i = i + 1
for i in range(200):
tifrregular(i)
A) is not regular as it requires a stack to verify parentheses matching
B) is also not regular as we require a stack or other memory to check it’s a palindrome or not
C) Is not regular because we can not check if it a length of string is a square or not only by dfa
E)Not a regular because we required to store value of M and Decide whether M<=N or not
no let us discuss D
My program use principle of langrage's theorem for any positive integer can be represented sum of squares of 4 integers
https://en.wikipedia.org/wiki/Lagrange%27s_four-square_theorem
Lagrange's four-square theorem, also known as Bachet's conjecture, states that every natural number can be represented as the sum of four integer squares. That is, the squares form an additive basis of order four.
I just modified code using above principle to n=>3 so all numbers can be represented by
i created python program for this you can clearly see after 72 we get continuous length string
clean closure of single alphabet language is just addition of length of strings so let’s discuss length only
Here number represent length of string of language and addition represent concatenation
MISSING NUMBERS are LENGTH OF STRINGS THAT ARE NOT ACCEPTED BY LANGUAGE
so strings length more than 72 accepted by language that’s why it’s regular
ANS IS D
9 = 3*3
16 = 4*4
18 = 3*3 + 3*3
25 = 3*3 + 4*4
27 = 3*3 + 3*3 + 3*3
32 = 4*4 + 4*4
34 = 3*3 + 3*3 + 4*4
36 = 3*3 + 3*3 + 3*3 + 3*3
41 = 3*3 + 4*4 + 4*4
43 = 3*3 + 3*3 + 3*3 + 4*4
45 = 3*3 + 6*6
48 = 4*4 + 4*4 + 4*4
49 = 7*7
50 = 3*3 + 3*3 + 4*4 + 4*4
52 = 3*3 +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