login
Numbers that can be expressed both as the sum of first primes and as the sum of first composites.
2

%I #34 Mar 11 2024 01:53:57

%S 0,10,1988,14697,83292,1503397,18859052,93952013,89171409882,

%T 9646383703961,209456854921713,3950430820867201,

%U 13113506646374409451778

%N Numbers that can be expressed both as the sum of first primes and as the sum of first composites.

%e From _Jon E. Schoenfield_, Feb 10 2018: (Start)

%e 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).

%e 1988 is in the sequence because Sum_{i=1..33} prime(i) = A007504(33) = Sum_{i=1..51} composite(i) = A053767(51) = 1988.

%e a(n) = A007504(j)

%e n j k = A053767(k)

%e == ======== ======== =================

%e 1 0 0 0

%e 2 3 2 10

%e 3 33 51 1988

%e 4 80 147 14697

%e 5 175 361 83292

%e 6 660 1582 1503397

%e 7 2143 5699 18859052

%e 8 4556 12821 93952013

%e 9 118785 403341 89171409882

%e 10 1131142 4229425 9646383703961

%e 11 5012372 19786181 209456854921713

%e 12 20840220 86192660 3950430820867201 (End)

%t 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 *)

%t 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 *)

%Y Intersection of A007504 and A053767.

%Y Cf. A066527, A154587.

%K nonn,more,nice

%O 1,2

%A _Max Alekseyev_, Feb 10 2018