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.

A384103 a(n) = y with minimum |x| >= |y| > 0, such that n = |6xy + x + y|, or 0 if no such x, y exist. If x and -x are solutions, choose x > 0 > y = -x.

This page as a plain text file.
%I A384103 #10 Jul 22 2025 10:31:40
%S A384103 0,0,0,-1,0,-1,0,1,-1,0,-1,0,1,-1,1,-1,0,0,-1,-2,-1,1,0,-2,0,-1,1,2,1,
%T A384103 0,-2,0,0,1,-2,1,2,0,-1,0,2,-2,1,-1,0,-2,0,-3,-1,2,-1,0,-2,-3,1,-1,-2,
%U A384103 0,-1,3,-1,1,2,-2,-3,-1,2,-2,1,0,-3,0,3,-1,-2,2,0,1,3,2,-1,-3,1,-1,1,-2,0,-4,2,-2
%N A384103 a(n) = y with minimum |x| >= |y| > 0, such that n = |6xy + x + y|, or 0 if no such x, y exist. If x and -x are solutions, choose x > 0 > y = -x.
%C A384103 (6n-1, 6n+1) are twin primes iff a(n) = 0, that is, if there are no nonzero integers x, y such that n = |6xy + x + y|. These n are listed in A002822, the complement is A067611.
%C A384103 The corresponding x-values are listed in A384102.
%H A384103 Robert Israel, <a href="/A384103/b384103.txt">Table of n, a(n) for n = 1..10000</a>
%e A384103 For n = 1, 2 and 3, there are no nonzero x,y such that n = |6xy + x + y|, and (6n-1, 6n+1) = (5, 7), (11, 13) and (17, 19) are indeed twin primes.
%e A384103 For n = 4 we have x = y = -1 such that |6xy + x + y| = |6 - 1 - 1| = 4 and (23, 25) is indeed not a twin prime pair.
%p A384103 f:= proc(n) local V, C, t, m, v, r;
%p A384103        V:= numtheory:-divisors(6*n+1) minus {1, 6*n+1};
%p A384103        C:= map(u -> `if`(u mod 6 = 1,  [(u-1)/6, ((6*n+1)/u - 1)/6], [(-u-1)/6, (-(6*n+1)/u - 1)/6]), V);
%p A384103        V:= numtheory:-divisors(6*n-1) minus {1, 6*n-1};
%p A384103        C:= C union map(u -> `if`(u mod 6 = 1, [(u-1)/6, ((-6*n+1)/u - 1)/6], [(-u-1)/6, ((6*n-1)/u - 1)/6]), V);
%p A384103        C:= select(t -> abs(t[1]) >= abs(t[2]), C);
%p A384103        if C = {} then return 0 fi;
%p A384103        m:= infinity;
%p A384103        for t in C do
%p A384103          if abs(t[1]) < m then m:= abs(t[1]); r:= t[2];
%p A384103          elif abs(t[1]) = m and t[1] > 0 then r:= t[2]
%p A384103          fi
%p A384103        od;
%p A384103        r
%p A384103  end proc:
%p A384103 map(f, [$1..100]); # _Robert Israel_, Jul 21 2025
%o A384103 (PARI) apply( {A384103(n)=for(x=1,n\/5, my(p=6*x+1, q=6*x-1, y=if((n-x)%p==0, (n-x)\p, (n+x)%p==0, -(n+x)\p, (n-x)%q==0, (n-x)\q, (n+x)%q==0,-(n+x)\q)); y && abs(y) <= x && return(y))}, [1..90])
%Y A384103 Cf. A384102 (the corresponding x-values).
%Y A384103 Cf. A002822 (indices of zeros: n such that 6n-1 and 6n+1 are twin primes).
%Y A384103 Cf. A077800 (list of twin primes), A060461, A171696 (none among 6n+-1 is prime), A067611 (n = 6xy +- x +- y: 6n-1 or 6n+1 is composite).
%K A384103 sign,look
%O A384103 1,20
%A A384103 _M. F. Hasler_, Jun 20 2025