CW2 - NFA,DFA and RegExp Results

Founded an array of integers less than 50 accepted by each automaton

NFA:[4,8,12,16,20,24,28,32,36,40,44,48]
DFA:[4,8,12,16,20,24,28,32,36,40,44,48]
RegExp:[4,8,12,16,20,24,28,32,36,40,44,48]

Logic
01
> aaba
 bcϕ
* cϕϕ
01
> aaba
  ababca
* abcabca
function deltaNFA(q, c) { // (1|0)*00
if (q=='a' && c=='0') return 'ab'
if (q=='a' && c=='1') return 'a'
if (q=='b' && c=='0') return 'c'
return ''; //default -- no transition
}
function acceptNFA(w, F='c', Q='a') {
//w: input String
//F: final state(s)
//Q: current state(s)
let i = 0, txt = Q
while (i < w.length) {
let c = w[i], T=''
for (let q of Q)
T = union(T, deltaNFA(q, c))
Q = T
if (Q == '') break
i++; txt += ", "+c+" -> "+Q+'\n'+Q
}
return intersect(Q, F).length > 0
}
function deltaDFA(q, c) { // (1|0)*00
if (q=='P' && c=='0') return 'R'
if (q=='P' && c=='1') return 'P'
if (q=='R' && c=='0') return 'L'
if (q=='R' && c=='1') return 'P'
if (q=='L' && c=='0') return 'L'
if (q=='L' && c=='1') return 'P' //default -- no transition
}
function acceptDFA(w, F='L', Q='P') {
//w: input String
//F: final state(s)
//Q: current state(s)
let i = 0, txt = Q
while (i < w.length) {
let c = w[i], T=''
for (let q of Q)
T = union(T, deltaDFA(q, c))
Q = T
if (Q == '') break
i++; txt += ", "+c+" -> "+Q+'\n'+Q
}
return intersect(Q, F).length > 0
}
function test() {

let x = [], y = [], z = [];
let e = /00$/

for (let n=1; n<50; n++) {
let w = n.toString(2) // to binary

if (acceptNFA(w)) x.push(n);
if (acceptDFA(w)) y.push(n);
if (e.test(w)) z.push(n);

}
out.innerHTML = "NFA:[" + x + "]" + '<br>' + "DFA:[" + y + "]" + '<br>'+"RegExp:[" + z + "]"
}