A159698 Minimal increasing sequence beginning with 4 such that n and a(n) are either both prime or both nonprime.
4, 5, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 32, 33, 37, 38, 39, 40, 42, 44, 47, 48, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 67, 68, 71, 72, 74, 75, 79, 80, 81, 82, 84, 85, 89, 90, 91, 92, 93, 94, 97, 98, 101, 102, 104, 105, 106, 108, 109, 110, 111, 112
Offset: 1
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..20000
- V. Shevelev, Several results on sequences which are similar to the positive integers, arXiv:0904.2101 [math.NT], 2009.
Programs
-
Maple
a:= proc(n) option remember; local m; if n=1 then 4 else for m from a(n-1)+1 while isprime(m) xor isprime(n) do od; m fi end: seq(a(n), n=1..80); # Alois P. Heinz, Nov 21 2010
-
Mathematica
a[n_] := a[n] = If[n==1, 4, For[m = a[n-1]+1, Xor[PrimeQ[m], PrimeQ[n]], m++]; m]; Table[a[n], {n, 1, 80}] (* Jean-François Alcover, Jan 31 2016, after Alois P. Heinz *)
Formula
a(1) = 4; for n>1, a(n) = min { m > a(n-1) : m is prime iff n is prime }.
Extensions
More terms from Alois P. Heinz, Nov 21 2010
Comments