OK, so it can be done. The fact that this is so ugly is an indication that your database is not properly designed. If the numbers can be handled independently, then they should be in separate rows.
DROP TABLE numbers;
CREATE TABLE numbers (
a int,
b int,
c int,
d int,
e int,
f int
);
INSERT INTO numbers VALUES
(10, 23, 29, 33, 37, 40),
(9, 13, 21, 25, 32, 42),
(11, 16, 19, 21, 27, 31),
(14, 27, 30, 31, 40, 42),
(16, 24, 29, 40, 41, 42),
(14, 15, 26, 27, 40, 42),
(2, 9, 16, 25, 26, 40),
(8, 19, 25, 34, 37, 39),
(2, 4, 16, 17, 36, 39),
(9, 25, 30, 33, 41, 44),
(1, 7, 36, 37, 41, 42),
(2, 11, 21, 25, 39, 45),
(22, 23, 25, 37, 38, 42),
(2, 6, 12, 31, 33, 40),
(3, 4, 16, 30, 31, 37)
;
DROP TABLE table2;
CREATE TABLE table2 (
numbs int,
result int
);
INSERT INTO table2 VALUES
(1,0), (2,0), (3,0), (4,0), (5,0), (6,0), (7,0), (8,0),
(9,0), (10,0), (11,0), (12,0), (13,0), (14,0), (15,0),
(16,0), (17,0), (17,0), (18,0), (19,0), (20,0), (21,0),
(22,0), (23,0), (24,0);
UPDATE table2 SET result=0;
UPDATE table2 SET result = result + n.cnt
FROM (SELECT a,count(*) cnt FROM numbers GROUP BY a) n
WHERE table2.numbs = n.a;
UPDATE table2 SET result = result + n.cnt
FROM (SELECT b,count(*) cnt FROM numbers GROUP BY b) n
WHERE table2.numbs = n.b;
UPDATE table2 SET result = result + n.cnt
FROM (SELECT c,count(*) cnt FROM numbers GROUP BY c) n
WHERE table2.numbs = n.c;
UPDATE table2 SET result = result + n.cnt
FROM (SELECT d,count(*) cnt FROM numbers GROUP BY d) n
WHERE table2.numbs = n.d;
UPDATE table2 SET result = result + n.cnt
FROM (SELECT e,count(*) cnt FROM numbers GROUP BY e) n
WHERE table2.numbs = n.e;
UPDATE table2 SET result = result + n.cnt
FROM (SELECT f,count(*) cnt FROM numbers GROUP BY f) n
WHERE table2.numbs = n.f;
Output:
sqlite> .mode box
sqlite> select * from table2;
┌───────┬────────┐
│ numbs │ result │
├───────┼────────┤
│ 1 │ 1 │
│ 2 │ 4 │
│ 3 │ 1 │
│ 4 │ 2 │
│ 5 │ 0 │
│ 6 │ 1 │
│ 7 │ 1 │
│ 8 │ 1 │
│ 9 │ 3 │
│ 10 │ 1 │
│ 11 │ 2 │
│ 12 │ 1 │
│ 13 │ 1 │
│ 14 │ 2 │
│ 15 │ 1 │
│ 16 │ 5 │
│ 17 │ 1 │
│ 17 │ 1 │
│ 18 │ 0 │
│ 19 │ 2 │
│ 20 │ 0 │
│ 21 │ 3 │
│ 22 │ 1 │
│ 23 │ 2 │
│ 24 │ 1 │
└───────┴────────┘
sqlite>