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.

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.

This page as a plain text file.
%I A367021 #37 Dec 31 2023 00:12:45
%S A367021 5,10,17,18,23,26,28,31,36,39,41,49,53,58,59,60,67,68,71,75,77,78,83,
%T A367021 84,90,95,97,101,102,109,112,121,124,127,128,129,131,132,138,139,143,
%U A367021 150,152,155,156,158,159,160,161,162,168,169,172,173,180,181,184,187,192
%N 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.
%C A367021 It seems that more than one consecutive number set from one kind or the other may exist for a term. Also, for some terms, an equal number of addends from each kind may correspond.
%H A367021 David Consiglio, Jr., <a href="/A367021/b367021.txt">Table of n, a(n) for n = 1..1000</a>
%e A367021 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.
%e A367021 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.
%o A367021 (Python)
%o A367021 from sympy import isprime
%o A367021 primes = [x for x in range(2,3000) if isprime(x)]
%o A367021 comps = [x for x in range(1,3000) if not isprime(x)]
%o A367021 psums = set(sum(primes[p:p+pn]) for pn in range(2,100) for p in range(len(primes)-pn))
%o A367021 csums = set(sum(comps[c:c+cn]) for cn in range(2,100) for c in range(len(comps)-cn))
%o A367021 terms = sorted(list(psums.intersection(csums)))
%o A367021 print(terms)
%o A367021 # _David Consiglio, Jr._, Dec 18 2023
%Y A367021 Cf. A018252, A050936, A366976.
%K A367021 nonn
%O A367021 1,1
%A A367021 _Tamas Sandor Nagy_, Nov 01 2023
%E A367021 More terms from _David Consiglio, Jr._, Dec 18 2023