SQLite Forum

x86_64/amd64 sqlite3 binaries
the win64 version build from source is about 30% faster than the win32 version by my testing.

with t6(n) as (select 1 union all select n+1 from t where n<6)
b3(a,b,c,bit)as(select a.n,b.n,c.n,(1<<(a.n-1))+(1<<(b.n-1))+(1<<(c.n-1)) from t6 a,t6 b,t6 c where a.n<b.n and b.n<c.n)
b9(b)as(select c.bit*((1<<(r.a-1)*6)+(1<<(r.b-1)*6)+(1<<(r.c-1)*6)) from b3 c,b3 r)
as(select 1,'1',1,1 union all select n+1,cast(n+1 as varchar),n/6+1,n%6+1 from t where n<6*6)
as(select 1,t.n,t.c,1<<(t.n-1),pow(10,t.x),pow(10,t.y) from t where t.n<=6 
union all
select lv+1,b.n,nlist||','||c,blist+(1<<(b.n-1)),px+pow(10,b.x),py+pow(10,b.y)
from s,t b 
where lv<10 and s.n<b.n 
and (instr(px+pow(10,b.x),3)=0 and instr(py+pow(10,b.y),3)=0)
--and(select max(sum(case when a.x=b.x then 1 end), sum(case when a.y=b.y then 1 end))from t a 
--  where ((blist+(1<<(b.n-1))&(1<<(a.n-1)))>0))<=2
and b.n  between lv/2*6+1 and lv/2*6+6*2
select * from s where lv=10 and (lv<3 or not exists(select 1 from b9 where  (blist & b9.b) =0)) ;