login
A172054
n-th number k such that 6*k-1 is composite while 6*k+1 is prime minus n-th number m such that 6*m-1 is prime while 6*m+1 is composite.
2
2, 3, 4, 2, 6, 7, 5, 7, 8, 7, 9, 12, 12, 12, 9, 4, 6, 4, 8, 9, 7, 8, 12, 11, 14, 17, 17, 12, 18, 17, 19, 13, 13, 10, 11, 9, 8, 7, 15, 17, 18, 13, 12, 13, 13, 11, 11, 15, 19, 19, 23, 23, 19, 12, 16, 17, 12, 11, 18, 22, 27, 29, 27, 27, 25, 18, 27, 28, 23, 22, 23, 17, 21, 24, 23, 23, 30
OFFSET
1,1
COMMENTS
Are there negative terms?
The entries are positive for at least the first 250000 terms. - R. J. Mathar, May 22 2010
LINKS
FORMULA
a(n) = A121765(n) - A121763(n).
EXAMPLE
The number 6 is the first integer k such that 6*k-1 is composite while 6*k+1 is prime, the number 4 is the first integer m such that 6*m -1 is prime while 6*m+1 is composite, so, 2 = 6 - 4 is the first term a(1) of this sequence. - Bernard Schott, Feb 18 2019
MAPLE
A121765 := proc(n) option remember; if n = 1 then 6; else for a from procname(n-1)+1 do if 6*a-1 >=4 and not isprime(6*a-1) and isprime(6*a+1) then return a; end if; end do; end if; end proc:
A121763 := proc(n) option remember; if n = 1 then 4; else for a from procname(n-1)+1 do if 6*a+1 >=4 and not isprime(6*a+1) and isprime(6*a-1) then return a; end if; end do; end if; end proc:
A172054 := proc(n) A121765(n)-A121763(n) ; end proc:
seq(A172054(n), n=1..120) ; # R. J. Mathar, May 22 2010
MATHEMATICA
A121765:= Select[Range[350], !PrimeQ[6#-1] && PrimeQ[6#+1] &];
A121763:= Select[Range[350], PrimeQ[6#-1] && !PrimeQ[6#+1] &];
Table[A121765[[n]] - A121763[[n]], {n, 1, 80}] (* G. C. Greubel, Feb 20 2019 *)
PROG
(GAP) L:=500;;
K:=Filtered([1..L], k-> not IsPrime(6*k-1) and IsPrime(6*k+1));;
M:=Filtered([1..L], m-> not IsPrime(6*m+1) and IsPrime(6*m-1));;
a:=List([1..Length(K)], i->K[i]-M[i]);; Print(a); # Muniru A Asiru, Feb 19 2019
(Magma)
A121765:=[n: n in [1..350] | not IsPrime(6*n-1) and IsPrime(6*n+1)];
A121763:=[n: n in [1..350] | IsPrime(6*n-1) and not IsPrime(6*n+1)];
[A121765[n] - A121763[n]: n in [1..80]]; // G. C. Greubel, Feb 20 2019
(Sage)
A121765=[n for n in (1..350) if not is_prime(6*n-1) and is_prime(6*n+1)];
A121763=[n for n in (1..350) if is_prime(6*n-1) and not is_prime(6*n+1)];
[A121765[n] - A121763[n] for n in (0..80)] # G. C. Greubel, Feb 20 2019
CROSSREFS
Sequence in context: A278963 A308085 A178970 * A354985 A344005 A375126
KEYWORD
nonn
AUTHOR
EXTENSIONS
Entries checked by R. J. Mathar, May 22 2010
STATUS
approved