login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A288574 Total number of distinct primes in all representations of 2*n+1 as a sum of 3 odd primes. 3

%I #41 May 08 2021 23:06:29

%S 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 43,39,41,45,45,48,54,55,52,60,59,56,75,67,67,81,74,76,92,83,85,100,

%U 96,81,106,103,91,121,108,98,131,120,116,143,133,129,151,144,124,163

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

%C 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 Indranil Ghosh (first 200 terms), Hugo Pfoertner, <a href="/A288574/b288574.txt">Table of n, a(n) for n = 0..10000</a>

%p A288574 := proc(n)

%p local a, i, j, k, p, q, r,pqr ;

%p a := 0 ;

%p for i from 2 do

%p p := ithprime(i) ;

%p for j from i do

%p q := ithprime(j) ;

%p for k from j do

%p r := ithprime(k) ;

%p if p+q+r = 2*n+1 then

%p pqr := {p,q,r} ;

%p a := a+nops(pqr) ;

%p elif p+q+r > 2*n+1 then

%p break;

%p end if;

%p end do:

%p if p+2*q > 2*n+1 then

%p break;

%p end if;

%p end do:

%p if 3*p > 2*n+1 then

%p break;

%p end if;

%p end do:

%p return a;

%p end proc:

%p seq(A288574(n),n=0..80) ; # _R. J. Mathar_, Jun 29 2017

%o (PARI) a(n)={my(p,q,r,cnt);n=2*n+1;

%o forprime(p=3,n\3,forprime(q=p,(n-p)\2,

%o if(isprime(r=n-p-q), cnt+=if(p===q&&p==r,1,if(p==q||q==r,2,3)))));cnt}

%o \\ _Franklin T. Adams-Watters_, Jun 28 2017

%o (Python)

%o from sympy import primerange, isprime

%o def a(n):

%o n=2*n + 1

%o c=0

%o for p in primerange(3, n//3 + 1):

%o for q in primerange(p, (n - p)//2 + 1):

%o r=n - p - q

%o if isprime(r): c+=1 if p==q and p==r else 2 if p==q or q==r else 3

%o return c

%o print([a(n) for n in range(66)]) # _Indranil Ghosh_, Jun 29 2017

%Y A288573 appears to be an erroneous version of this sequence.

%Y Cf. A007963, A054860, A087916.

%K nonn

%O 0,6

%A _Franklin T. Adams-Watters_ and _R. J. Mathar_, Jun 28 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 08:27 EDT 2024. Contains 371964 sequences. (Running on oeis4.)