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.

A281315 Number of 2 X 2 matrices with all elements in {0,...,n} and prime determinant.

Original entry on oeis.org

0, 0, 13, 46, 83, 191, 272, 509, 687, 1010, 1291, 2019, 2364, 3468, 4132, 5079, 6072, 8298, 9234, 12189, 13621, 15984, 18095, 22965, 24886, 29942, 33248, 38385, 42073, 51053, 53882, 64609, 70619, 78663, 85424, 96024, 101521, 118804, 127940, 140598, 149375, 172123, 179424, 205334, 218216
Offset: 0

Views

Author

Indranil Ghosh, Jan 20 2017

Keywords

Examples

			For n = 3, a few of the possible matrices are [1,0;3,3], [1,1;0,2], [1,1;0,3], [1,1;1,3], [1,2;0,2], [1,2;0,3], [1,3;0,2], [1,3;0,3], [2,0;0,1], [2,0;1,1], [2,0;2,1], [2,0;3,1], [2,1;0,1], [2,1;1,2], [2,1;1,3], [3,1;3,2], [3,2;0,1], [3,2;1,3], [3,2;2,2], [3,2;2,3], ... There are 46 possibilities.
Here each of the matrices M is defined as M = [a,b;c,d], where a= M[1][1], b = M[1][2], c = M[2][1] and d = M[2][2]. So, a(3) = 46.
		

Crossrefs

Cf. A210000.

Programs

  • Python
    from sympy import isprime
    def t(n):
        s=0
        for a in range(n+1):
            for d in range(n+1):
                ad = a * d
                for c in range(n+1):
                    for b in range(n+1):
                        if isprime(ad-b*c):
                            s+=1
        return s
    for i in range(187):
        print(str(i)+" "+str(t(i)))
    
  • Sage
    def A281315(n):
        T = Tuples([i for i in range(n+1)], 4); i = 0
        for t in T: i += is_prime(t[0]*t[3]-t[1]*t[2])
        return i
    [A281315(n) for n in range(20)] # Peter Luschny, Jul 23 2017