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.

A187401 Numbers k such that k^2 + 1 = p*q, p and q primes and |p-q| is square.

Original entry on oeis.org

30, 100, 144, 274, 484, 516, 526, 756, 1046, 1250, 1714, 1806, 1834, 2284, 2440, 2610, 2940, 3524, 3824, 4190, 5084, 5746, 6766, 7486, 9746, 9920, 10310, 13024, 13210, 15396, 16916, 17546, 18726, 19256, 20000, 21194, 23214, 24964, 30370, 30394, 31126, 31496, 35180, 36680, 37816
Offset: 1

Views

Author

Michel Lagneau, Mar 09 2011

Keywords

Comments

Note that if k^2+1 = p*q, then p+q cannot be a square. Proof by contradiction. There are two cases: p an odd prime and p=2. Case 1: suppose p and q are odd primes and q = y^2-p. Note that y must be an even number in order for q to be odd. Then p(y^2-p) = x^2+1 for some even x. Rearranging terms, we obtain p*y^2-1 = p^2+x^2. Looking at this equation modulo 4, we obtain -1 = 1, a contradiction. Case 2: Let p=2. Then we obtain 2y^2-x^2 = 5, which has no solutions in integers. - T. D. Noe, Mar 10 2011

Examples

			20000 is in the sequence because 20000^2+1 = 19801 * 20201 and 20201 - 19801 = 20^2.
		

Crossrefs

Programs

  • Maple
    with(numtheory):nn:=50000:for i from 1 to nn do: n:=i^2+1:x:=factorset(n):x1:=nops(x):x2:=bigomega(n):if  x1=2 and x2=2 then z:=x[2]-x[1] :w:=sqrt(z):if w= floor(w) then printf(`%d,  `, i):else fi:else fi :od:
    # Alternative:
    N:= 500: # to get a(1) to a(N)
    count:= 0:
    for k from 2 by 2 while count < N do
      f:= ifactors(k^2+1)[2];
      if nops(f) = 2 and {f[1,2],f[2,2]}={1} and issqr(abs(f[1,1]-f[2,1])) then
        count:= count+1;
        A[count]:= k;
      fi
    od:
    seq(A[i],i=1..count); # Robert Israel, Jun 09 2014
  • Mathematica
    okQ[k_] := Module[{ff = FactorInteger[k^2+1]}, Length[ff] == 2 && ff[[All, 2]] == {1, 1} && IntegerQ[Sqrt[ff[[2, 1]] - ff[[1, 1]]]]];
    Select[Range[2, 40000, 2], okQ] (* Jean-François Alcover, Jun 25 2019 *)
  • Sage
    A = []
    for k in range(2, 2000, 2):
        K = k^2 + 1
        f = prime_divisors(K)
        if len(f) == 2:
            if mul(f) == K:
                if is_square(abs(f[0]-f[1])):
                    A.append(k)
    print(A) # Peter Luschny, Jun 10 2014