cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A295996 One quarter of number of Gaussian primes whose norm is 4*n+1 or less.

Original entry on oeis.org

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

Views

Author

Seiichi Manyama, Dec 02 2017

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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)