A266909 Table read by rows: for each k < n and coprime to n, the least x>=0 such that x*n+k is prime.
1, 2, 0, 1, 0, 2, 0, 0, 3, 1, 0, 4, 0, 0, 1, 0, 1, 2, 0, 0, 0, 2, 0, 1, 0, 0, 1, 1, 0, 0, 1, 2, 0, 0, 3, 0, 1, 0, 1, 2, 3, 1, 0, 0, 0, 4, 0, 0, 1, 0, 1, 0, 3, 4, 1, 0, 7, 2, 0, 0, 1, 0, 0, 2, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 2, 0, 0, 1, 6, 0, 0, 5, 0, 1, 0, 3, 2, 3, 0, 1, 0, 1, 4, 3, 1, 0, 0, 0, 0, 0, 10, 0
Offset: 1
Examples
The first few rows are n=2: 1 n=3: 2, 0 n=4: 1, 0 n=5: 2, 0, 0, 3 n=6: 1, 0
Links
- Robert Israel, Table of n, a(n) for n = 1..10975 (rows 2 to 190, flattened)
- Wikipedia, Dirichlet's theorem on arithmetic progressions.
- Wikipedia, Linnik's theorem
- Index entries for sequences related to primes in arithmetic progressions
Programs
-
Maple
T:= proc(n,k) local x; if igcd(n,k) <> 1 then return NULL fi; for x from 0 do if isprime(x*n+k) then return x fi od end proc: seq(seq(T(n,k),k=1..n-1),n=2..30);
-
Mathematica
Table[Map[Catch@ Do[x = 0; While[! PrimeQ[x n + #], x++]; Throw@ x, {10^3}] &, Range@ n /. k_ /; GCD[k, n] > 1 -> Nothing], {n, 2, 19}] // Flatten (* Michael De Vlieger, Jan 06 2016 *)
Comments