A367021 Numbers that can be written as both the sum of two or more consecutive nonprimes and the sum of two or more consecutive primes.
5, 10, 17, 18, 23, 26, 28, 31, 36, 39, 41, 49, 53, 58, 59, 60, 67, 68, 71, 75, 77, 78, 83, 84, 90, 95, 97, 101, 102, 109, 112, 121, 124, 127, 128, 129, 131, 132, 138, 139, 143, 150, 152, 155, 156, 158, 159, 160, 161, 162, 168, 169, 172, 173, 180, 181, 184, 187, 192
Offset: 1
Keywords
Examples
5 is a term because 5 = 1 + 4 = 2 + 3, which is the sum of two consecutive nonprimes and also the sum of two consecutive primes. 17 is a term because 17 = 8 + 9 = 2 + 3 + 5 + 7, the sum of two consecutive nonprimes and also the sum of four consecutive primes.
Links
- David Consiglio, Jr., Table of n, a(n) for n = 1..1000
Programs
-
Python
from sympy import isprime primes = [x for x in range(2,3000) if isprime(x)] comps = [x for x in range(1,3000) if not isprime(x)] psums = set(sum(primes[p:p+pn]) for pn in range(2,100) for p in range(len(primes)-pn)) csums = set(sum(comps[c:c+cn]) for cn in range(2,100) for c in range(len(comps)-cn)) terms = sorted(list(psums.intersection(csums))) print(terms) # David Consiglio, Jr., Dec 18 2023
Extensions
More terms from David Consiglio, Jr., Dec 18 2023
Comments