login
A295996
One quarter of number of Gaussian primes whose norm is 4*n+1 or less.
5
0, 3, 4, 6, 8, 8, 8, 10, 10, 12, 14, 14, 15, 17, 17, 19, 19, 19, 21, 21, 21, 21, 23, 23, 25, 27, 27, 29, 31, 31, 32, 32, 32, 32, 34, 34, 34, 36, 36, 38, 38, 38, 38, 40, 40, 42, 42, 42, 44, 46, 46, 46, 46, 46, 46, 46, 46, 48, 50, 50, 52, 52, 52, 52, 54, 54, 54, 56
OFFSET
0,2
LINKS
Eric Weisstein's World of Mathematics, Gaussian Prime
EXAMPLE
The Gaussian primes whose norm is 9 or less;
* 3i,
* * -1+2i, 1+2i
* * * * -2+i, -1+i, 1+i, 2+i
* * -3, 3
* * * * -2-i, -1-i, 1-i, 2-i
* * -1-2i, 1-2i
* -3i
a(2) = 16/4 = 4.
PROG
(Ruby)
require 'prime'
def A(k, n)
ary = []
cnt = 0
k.step(4 * n + k, 4){|i|
cnt += 1 if i.prime?
ary << cnt
}
ary
end
def A295996(n)
ary1 = A(1, n)
ary3 = A(3, Math.sqrt(n).to_i) + [0]
[0] + (1..n).map{|i| 1 + 2 * ary1[i] + ary3[(Math.sqrt(4 * i + 1).to_i - 3) / 4]}
end
p A295996(100)
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Dec 02 2017
STATUS
approved