Besides the smaller diameter, these lenses also have a shorter flange focal distance: 44mm for the M40x1 vs 45.5mm for the M42x1. This also makes them more difficult to use.
Now there are options to adapt the M40x1 to modern mounts using 3D printing. However, I was looking for solutions using mass-produced parts.
The first thing to do is to convert from the M40x1 thread to the M42x1 thread. The easiest way to do this is to wrap a (PTFE) thread seal tape around the lens thread. I have used this method successfully:

Since the layers of tape are quite thick, you should avoid tilting the lens when screwing it into the M42x1.
Another option is the M40x1-M42x1 ring. It is similar to
the M39x1-M42x1 ring, but much rarer and more expensive.

This ring allows you to screw an M40x1 lens into the M42x1 mount.

There are also M40-M42 adapters that are step-down adapters for filters.

But they have a smaller thread pitch (not 1mm), so I don't recommend using them.
When it is possible to use the M42x1 thread, there are several options:

But the flange focal distance is longer than it should be: 45.5-44=1.5mm, so it won't focus at infinity.
The Victar lens has a very narrow flange:

So it screws in deeper than it should, but still does not focus at infinity.
To solve the problem of focusing to infinity, you will need to reduce the thickness of the M42x1 adapter if it's possible.
2. Another option is a thin M42x1 adapter with a shorter than 45.5mm flange focal distance. You should use extension tubes or something similar to get a total flange focal length of 44mm (or slightly less).

7mm (M42x1 extension tube) + 14mm (M42x1 extension tube) + 5mm (thin M42x1-Sony FE/E adapter) + 18mm (Sony FE/E flange focal distance) = 44mm (exactly what is needed)

3. And you can adapt the lens to the M39x1/28.8 (rangefinder) mount.

4.5mm (M42x1-M39x1 adapter) + 5mm (M39x1 extension tube) + 5mm (M39x1 extension tube) + 28.8mm (M39x1 rangefinder flange focal distance) = 43.3mm. This is slightly less than 44mm, but acceptable for use.

Of course, instead of extension tubes, a suitable close focus (helicoid) adapter can be used, which at the same time reduces the minimum focusing distance. This is useful for older lenses.