cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A386256 Smallest semiprime p1*p2 such that p2 mod p1 = n and no prime is used more than once in the sequence.

Original entry on oeis.org

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

Views

Author

Tamas Sandor Nagy, Aug 14 2025

Keywords

Comments

Will every prime be used? If so, then the prime factors p1 and p2 of the terms, listed term by term, is a permutation of the primes.

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.
		

Crossrefs

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 *)