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.

A288574 Total number of distinct primes in all representations of 2*n+1 as a sum of 3 odd primes.

This page as a plain text file.
%I A288574 #45 Apr 23 2025 04:50:25
%S A288574 0,0,0,0,1,2,4,4,6,7,9,10,12,15,17,16,19,19,23,25,26,26,28,33,32,35,
%T A288574 43,39,41,45,45,48,54,55,52,60,59,56,75,67,67,81,74,76,92,83,85,100,
%U A288574 96,81,106,103,91,121,108,98,131,120,116,143,133,129,151,144,124,163
%N A288574 Total number of distinct primes in all representations of 2*n+1 as a sum of 3 odd primes.
%C A288574 That is, a representation 2n+1 = p+p+p counts as 1, as p+p+q counts as 2, and p+q+r counts as 3. If each representation is counted once, we simply get A007963.
%H A288574 Indranil Ghosh (first 200 terms), Hugo Pfoertner, <a href="/A288574/b288574.txt">Table of n, a(n) for n = 0..10000</a>
%p A288574 A288574 := proc(n)
%p A288574     local a, i, j, k, p, q, r,pqr ;
%p A288574     a := 0 ;
%p A288574     for i from 2 do
%p A288574         p := ithprime(i) ;
%p A288574         for j from i do
%p A288574             q := ithprime(j) ;
%p A288574             for k from j do
%p A288574                 r := ithprime(k) ;
%p A288574                 if p+q+r = 2*n+1 then
%p A288574                     pqr := {p,q,r} ;
%p A288574                     a := a+nops(pqr) ;
%p A288574                 elif p+q+r > 2*n+1 then
%p A288574                     break;
%p A288574                 end if;
%p A288574             end do:
%p A288574             if p+2*q > 2*n+1 then
%p A288574                 break;
%p A288574             end if;
%p A288574         end do:
%p A288574         if 3*p > 2*n+1 then
%p A288574             break;
%p A288574         end if;
%p A288574     end do:
%p A288574     return a;
%p A288574 end proc:
%p A288574 seq(A288574(n),n=0..80) ; # _R. J. Mathar_, Jun 29 2017
%t A288574 Table[x = 2 n + 1; max = PrimePi[x]; Total[Length /@ Tally /@ DeleteDuplicates[Sort /@ Select[Tuples[Range[2, max], 3], Prime[#[[1]]] + Prime[#[[2]]] + Prime[#[[3]]] == x &]]], {n, 0, 100}] (* _Robert Price_, Apr 22 2025 *)
%o A288574 (PARI) a(n)={my(p,q,r,cnt);n=2*n+1;
%o A288574 forprime(p=3,n\3,forprime(q=p,(n-p)\2,
%o A288574 if(isprime(r=n-p-q), cnt+=if(p===q&&p==r,1,if(p==q||q==r,2,3)))));cnt}
%o A288574 \\ _Franklin T. Adams-Watters_, Jun 28 2017
%o A288574 (Python)
%o A288574 from sympy import primerange, isprime
%o A288574 def a(n):
%o A288574     n=2*n + 1
%o A288574     c=0
%o A288574     for p in primerange(3, n//3 + 1):
%o A288574         for q in primerange(p, (n - p)//2 + 1):
%o A288574             r=n - p - q
%o A288574             if isprime(r): c+=1 if p==q and p==r else 2 if p==q or q==r else 3
%o A288574     return c
%o A288574 print([a(n) for n in range(66)]) # _Indranil Ghosh_, Jun 29 2017
%Y A288574 A288573 appears to be an erroneous version of this sequence.
%Y A288574 Cf. A007963, A054860, A087916.
%K A288574 nonn
%O A288574 0,6
%A A288574 _Franklin T. Adams-Watters_ and _R. J. Mathar_, Jun 28 2017