I did an exhaustive brute search, and there is no solution. I have no explanation. I was suspected some parity explanation, but not sure at all.
The script that I used is a sql query. I have in entry one table IINT with integers from 1 to 13, and the sql-query is :
with rrr as (
select * from iint where i0 <= 6 ),
ccc as (
select * from iint
where i0 <= 13 )
, tb as (
select rrr.i0 as rrr, ccc.i0 as ccc , case when rrr.i0+ccc.i0 <= 14 then rrr.i0+ccc.i0-1 else rrr.i0+ccc.i0-14 end as v
from rrr, ccc
order by 1,2
)
-- tb is the copy of original grid, 78 rows.
, t1 as (
select C1.rrr as r1, c1.v as v1 ,
C2.rrr as r2, c2.v as v2 ,
C3.rrr as r3, c3.v as v3 ,
C4.rrr as r4, c4.v as v4 ,
C5.rrr as r5, c5.v as v5 ,
C6.rrr as r6, c6.v as v6
from tb c1, tb c2, tb c3 , tb c4 , tb c5 , tb c6
where c1.ccc = 1
and c2.ccc = 2 and c2.v <> c1.v
and c3.ccc = 3 and c3.v <> c1.v and c3.v <> c2.v
and c4.ccc = 4 and c4.v <> c1.v and c4.v <> c2.v and c4.v <> c3.v
and c5.ccc = 5 and c5.v <> c1.v and c5.v <> c2.v and c5.v <> c3.v and c5.v <> c4.v
and c6.ccc = 6 and c6.v <> c1.v and c6.v <> c2.v and c6.v <> c3.v and c6.v <> c4.v and c6.v <> c5.v
)
-- t1 is a valid selection from columns 1 to 6 (each value v appears max once)
, t2 as (
select C1.rrr as r7, c1.v as v1 ,
C2.rrr as r8, c2.v as v2 ,
C3.rrr as r9, c3.v as v3 ,
C4.rrr as r10, c4.v as v4 ,
C5.rrr as r11, c5.v as v5 ,
C6.rrr as r12, c6.v as v6
from tb c1, tb c2, tb c3 , tb c4 , tb c5 , tb c6
where c1.ccc = 7
and c2.ccc = 8 and c2.v <> c1.v
and c3.ccc = 9 and c3.v <> c1.v and c3.v <> c2.v
and c4.ccc = 10 and c4.v <> c1.v and c4.v <> c2.v and c4.v <> c3.v
and c5.ccc = 11 and c5.v <> c1.v and c5.v <> c2.v and c5.v <> c3.v and c5.v <> c4.v
and c6.ccc = 12 and c6.v <> c1.v and c6.v <> c2.v and c6.v <> c3.v and c6.v <> c4.v and c6.v <> c5.v
),
-- t2 is a valid selection from columns 7 to 12 (each value v appears max once)
w as (
SELECT T1., t2.r7, t2.v1 as V7,
t2.r8, t2.v2 as V8,
t2.r9, t2.v3 as V9,
t2.r10, t2.v4 as V10,
t2.r11, t2.v5 as V11,
t2.r12, t2.v6 as V12
, tb.rrr as r13, tb.v as v13 , rownum as rn from t1, t2 , TB
where t2.v1 <> t1.v1 and t2.v1 <> t1.v2 and t2.v1 <> t1.v3 and t2.v1 <> t1.v4 and t2.v1 <> t1.v5 and t2.v1 <> t1.v6 and
t2.v2 <> t1.v1 and t2.v2 <> t1.v2 and t2.v2 <> t1.v3 and t2.v2 <> t1.v4 and t2.v2 <> t1.v5 and t2.v2 <> t1.v6 and
t2.v3 <> t1.v1 and t2.v3 <> t1.v2 and t2.v3 <> t1.v3 and t2.v3 <> t1.v4 and t2.v3 <> t1.v5 and t2.v3 <> t1.v6 and
t2.v4 <> t1.v1 and t2.v4 <> t1.v2 and t2.v4 <> t1.v3 and t2.v4 <> t1.v4 and t2.v4 <> t1.v5 and t2.v4 <> t1.v6 and
t2.v5 <> t1.v1 and t2.v5 <> t1.v2 and t2.v5 <> t1.v3 and t2.v5 <> t1.v4 and t2.v5 <> t1.v5 and t2.v5 <> t1.v6 and
t2.v6 <> t1.v1 and t2.v6 <> t1.v2 and t2.v6 <> t1.v3 and t2.v6 <> t1.v4 and t2.v6 <> t1.v5 and t2.v6 <> t1.v6
and tb.ccc=13 and tb.v not in ( t1.v1,t1.v2, t1.v3,t1.v4,t1.v5,t1.v6, t2.v1,t2.v2, t2.v3,t2.v4,t2.v5,t2.v6 )
)
-- w is the set of all valid solutions, rn is an id to identify each solution
, x as (
select rn, r1 AS R0 from w union all
select rn, r2 from w union all
select rn, r3 from w union all
select rn, r4 from w union all
select rn, r5 from w union all
select rn, r6 from w union all
select rn, r7 from w union all
select rn, r8 from w union all
select rn, r9 from w union all
select rn, r10 from w union all
select rn, r11 from w union all
select rn, r12 from w union all
select rn, r13 from w )
-- this intermediate table x will be used to count the number of cells from each row.
,
y as (
SELECT rn , count ( case when r0=1 then 1 else null end ) as nb1,
count ( case when r0=2 then 1 else null end ) as nb2,
count ( case when r0=3 then 1 else null end ) as nb3,
count ( case when r0=4 then 1 else null end ) as nb4,
count ( case when r0=5 then 1 else null end ) as nb5,
count ( case when r0=6 then 1 else null end ) as nb6
FROM X
group by rn
having count ( case when r0=1 then 1 else null end ) between 2 and 3
and count ( case when r0=2 then 1 else null end) between 2 and 3
and count ( case when r0=3 then 1 else null end) between 2 and 3
and count ( case when r0=4 then 1 else null end) between 2 and 3
and count ( case when r0=5 then 1 else null end) between 2 and 3
and count ( case when r0=6 then 1 else null end) between 2 and 3
)
-- y is the list of idenfifier rn that respect the constraint : 2 or 3 cells in each row.
select w. from y, w
where w.rn = y.rn
-- For those solutions, display the value of all columns