Jelly, 11 bytes
PḤ+€J%ÞfÞ8Ḣ
A monadic Link that accepts a list of coprime integers and yields a run of the same number of consecutive composites.
How?
Uses the Chinese Remainder theorem in the most naive way possible, systematic search.
PḤ+€J%ÞfÞ8Ḣ - Link: Coprimes
P - product {Coprimes}
Ḥ - double -> 2P (N.B. 2P >= P+max(Coprimes))
J - 1-indexed indices {Coprimes} -> [1..n=length(Coprimes)]
€ - for each {v in [1..2P]}:
+ - {v} add {[1..n]} (vectorises)
Þ - sort by:
% - modulo {Coprimes} (vectorises)
Þ - sort by:
f 8 - keep those which are in Coprimes
Ḣ - head
Hmm maybe PḤ could be V (effectively concatenate all digits of Coprimes to make an integer), I think it is always big enough...
Jonathan Allan
- 115.4k
- 8
- 68
- 293