OFFSET
0,1
COMMENTS
Let b(n), c(n) and d(n) be respectively, smallest number m such that phi(m-n) + sigma(m+n) = 2n, smallest number m such that phi(m+n) + sigma(m-n) = 2n and smallest number m such that phi(m-n) + sigma(m+n) = phi(m+n) + sigma(m-n), we conjecture that for each positive integer n, a(n)=b(n)=c(n)=d(n). Namely we conjecture that for each positive integer n, a(n) < A244446(n), a(n) < A244447(n) and a(n) < A244448(n). - Jahangeer Kholdi and Farideh Firoozbakht, Sep 05 2014
LINKS
Zak Seidov, Table of n, a(n) for n = 0..1000
FORMULA
a(n) = A020483(n)+n for n >= 1. - Robert Israel, Sep 08 2014
EXAMPLE
n=10: k=13 because 13-10 and 13+10 are both prime and 13 is the smallest k such that k +/- 10 are both prime
4-1=3, prime, 4+1=5, prime; 5-2=3, 5+2=7; 8-3=5, 8+3=11; 9-4=5, 9+4=13, ...
MAPLE
Primes:= select(isprime, {seq(2*i+1, i=1..10^3)}):
a[0]:= 2:
for n from 1 do
Q:= Primes intersect map(t -> t-2*n, Primes);
if nops(Q) = 0 then break fi;
a[n]:= min(Q) + n;
od:
seq(a[i], i=0..n-1); # Robert Israel, Sep 08 2014
MATHEMATICA
s = ""; k = 0; For[i = 3, i < 22^2, If[PrimeQ[i - k] && PrimeQ[i + k], s = s <> ToString[i] <> ", "; k++ ]; i++ ]; Print[s] (* Vladimir Joseph Stephan Orlovsky, Apr 03 2008 *)
snk[n_]:=Module[{k=n+1}, While[!PrimeQ[k+n]||!PrimeQ[k-n], k++]; k]; Array[ snk, 80, 0] (* Harvey P. Dale, Dec 13 2020 *)
PROG
(Magma) distance:=function(n); k:=n+2; while not IsPrime(k-n) or not IsPrime(k+n) do k:=k+1; end while; return k; end function; [ distance(n): n in [1..71] ]; /* Klaus Brockhaus, Apr 08 2007 */
(PARI) a(n)=my(k); while(!isprime(k-n) || !isprime(k+n), k++); return(k) \\ Edward Jiang, Sep 05 2014
CROSSREFS
Cf. A020483.
KEYWORD
easy,nonn
AUTHOR
Zak Seidov, Sep 28 2003
EXTENSIONS
Entries checked by Klaus Brockhaus, Apr 08 2007
STATUS
approved