A294174 Numbers that can be expressed both as the sum of first primes and as the sum of first composites.
0, 10, 1988, 14697, 83292, 1503397, 18859052, 93952013, 89171409882, 9646383703961, 209456854921713, 3950430820867201, 13113506646374409451778
Offset: 1
Examples
From _Jon E. Schoenfield_, Feb 10 2018: (Start) 10 is in the sequence because prime(1) + prime(2) + prime(3) = 2 + 3 + 5 = 10 and composite(1) + composite(2) = 4 + 6 = 10 (where composite(i) is the i-th composite number). 1988 is in the sequence because Sum_{i=1..33} prime(i) = A007504(33) = Sum_{i=1..51} composite(i) = A053767(51) = 1988. a(n) = A007504(j) n j k = A053767(k) == ======== ======== ================= 1 0 0 0 2 3 2 10 3 33 51 1988 4 80 147 14697 5 175 361 83292 6 660 1582 1503397 7 2143 5699 18859052 8 4556 12821 93952013 9 118785 403341 89171409882 10 1131142 4229425 9646383703961 11 5012372 19786181 209456854921713 12 20840220 86192660 3950430820867201 (End)
Programs
-
Mathematica
nextComposite[n_] := Block[{k = n + 1}, While[PrimeQ@k, k++]; k]; c = sc = 4; p = sp = 2; lst = {0}; While[p < 1000000000, If[ sc == sp, AppendTo[lst, sc]; c = nextComposite@c; sc += c]; While[ sp < sc, p = NextPrime@ p; sp += p]; While[ sc < sp, c = nextComposite@ c; sc += c]]; lst (* Robert G. Wilson v, Feb 11 2018 *) Module[{pr=Accumulate[Prime[Range[5*10^7]]],co=Accumulate[Select[ Range[ 11*10^7], CompositeQ]]},Join[ {0},Intersection[pr,co]]] (* The program generates the first 12 terms of the sequence; to generate the 13th term increase the Range specifications substantially, but the program will take a long time to run. *) (* Harvey P. Dale, Sep 17 2019 *)