A386256 Smallest semiprime p1*p2 such that p2 mod p1 = n and no prime is used more than once in the sequence.
6, 35, 377, 407, 817, 391, 3649, 3131, 4841, 4331, 11461, 5293, 7729, 8051, 12031, 25217, 34417, 29503, 24931, 33389, 26051, 57479, 78227, 44377, 68557, 15707, 78119, 64829, 197401, 77059, 166633, 71371, 140579, 86147, 96427, 109237, 84907, 142523, 213341, 158801
Offset: 1
Examples
a(4) = 407 = 11 * 37 because 37 mod 11 = 4, and neither of these primes were used before in the sequence as a(1) = 2 * 3, a(2) = 5 * 7, and a(3) = 13 * 29, and so 11 and 37 are the earliest possible primes to satisfy the condition. a(5) = 817 = 19 * 43 because 43 mod 19 = 5. Smaller candidate primes such as 13 and 31 would have been suitable, but 13 was already used for a(3) = 377 = 13 * 29. Therefore 19 and 43 are the earliest possible primes to satisfy the condition.
Links
- Robert G. Wilson v, Table of n, a(n) for n = 1..400
Programs
-
Mathematica
q[k_, n_, ps_] := Module[{f = FactorInteger[k], p1, p2}, If[f[[;; , 2]] != {1, 1}, {}, p1 = f[[1, 1]]; p2 = f[[2, 1]]; If[Mod[p2, p1] == n && ! MemberQ[ps, p1] && ! MemberQ[ps, p2], {p1, p2}, {}]]]; seq[nmax_] := Module[{ps = {}, s = {}, k, p}, Do[k = 6; While[(p = q[k, n, ps]) == {}, k++]; AppendTo[s, Times @@ p]; ps = Join[ps, p], {n, 1, nmax}]; s]; seq[40] (* Amiram Eldar, Aug 14 2025 *) nsp[n_Integer] := nsp[n] = Block[{sp = n + 1}, While[ PrimeOmega[sp] != 2, sp++]; sp]; a[n_] := Block[{sp = 4}, While[fi = Flatten[ Table[ #[[1]], {#[[2]]}] & /@ FactorInteger[ sp]]; Mod[ fi[[2]], fi[[1]]] != n || MemberQ[p, fi[[1]]] || MemberQ[p, fi[[2]]], sp = nsp[sp]]; AppendTo[p, fi[[1]]]; AppendTo[p, fi[[2]]]; sp]; p = {}; Do[Print[{n, f[n]}], {n, 50}] (* Robert G. Wilson v, Aug 20 2025 *)
Comments