OFFSET
0,1
LINKS
Lars-Erik Svahn, Table of n, a(n) for n = 0..10000
Lars-Erik Svahn, numbertheory.4th
Akshaa Vatwani, Bounded gaps between Gaussian primes, Journal of Number Theory, Volume 171, February 2017, Pages 449-473.
Wikipedia, Gaussian prime
FORMULA
From Michel Marcus, Mar 30 2017: (Start)
a(n) = 0 for n in A002145.
a(n) = 1 for n in A005574.
(End)
MAPLE
f:= proc(n) local k;
for k from 0 do if GaussInt:-GIprime(n+I*k) then return k fi od
end proc:
map(f, [$0..100]); # Robert Israel, Apr 07 2017
MATHEMATICA
Table[k = 0; While[! PrimeQ[n + I k, GaussianIntegers -> True], k++]; k, {n, 0, 100}] (* Michael De Vlieger, Mar 29 2017 *)
PROG
(ANS-Forth)
s" numbertheory.4th" included
: 3mod4_prime \ n -- flag
abs dup isprime swap 3 and 3 = and ;
: isGaussianPrime \ a b -- flag
over 0= if nip 3mod4_prime exit then
dup 0= if drop 3mod4_prime exit then
dup * swap dup * + isprime ;
: Gauss_prime \ n -- a(n)
0
begin 2dup isGaussianPrime 0=
while 1+
repeat nip ;
CROSSREFS
KEYWORD
nonn
AUTHOR
Lars-Erik Svahn, Mar 25 2017
STATUS
approved