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.
%I A332787 #20 May 12 2022 10:01:41 %S A332787 2,3,7,11,13,17,19,23,29,37,41,43,47,53,61,67,71,73,79,83,89,97,101, %T A332787 103,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193, %U A332787 197,199,211,227,229,233,239,241,251,257,263,277,281,283,293,307,311,317,331,337,347,349,353,359,367 %N A332787 Negative-pan primes (see Comments). %C A332787 Take a double-pan balance scale and name the pans "negative" and "positive". At each step, the question is: "Is there an unused prime that would balance the scale if added to the positive pan?" If the answer is yes, add that prime to the positive pan. Otherwise, add the smallest unused prime to the negative pan. %C A332787 The negative pan N can be fractalized, i.e., subdivided into NN and NP pans, where NN ={{2,3,7,11},{13,17,19,29,37,41,43},...} and NP = {{23},{199},...}. Can this fractalization be continued infinitely? %H A332787 Michael S. Branicky, <a href="/A332787/b332787.txt">Table of n, a(n) for n = 1..10000</a> %e A332787 First division: 2 and 3 unbalance the scale (and go to the negative pan N), but 5 = 2 + 3 balances it (and goes to the positive pan P). %e A332787 Second division: 2,3,7 and 11 unbalance the N pan (and go to the NN subpan), but 23 balances it (and goes to NP subpan). %t A332787 a[1]=-2; %t A332787 a[n_]:=a[n]=Module[{tab=Table[a[i],{i,1,n-1}], %t A332787 totalN=Abs[Total[Select[Table[a[i],{i,1,n-1}],Negative]]], %t A332787 totalP=Total[Select[Table[a[i],{i,1,n-1}],Positive]], %t A332787 l=NextPrime[Last[Select[Table[a[i],{i,1,n-1}],Negative]],-1]}, %t A332787 If[ totalN==totalP, %t A332787 If[ PrimePi[tab[[-1]]]-PrimePi[Abs[tab[[-2]]]]==1,-NextPrime[tab[[-1]]], %t A332787 NextPrime[tab[[-2]],-1]], %t A332787 If[PrimeQ[totalN-totalP]&&FreeQ[Abs[tab],totalN-totalP],totalN-totalP, %t A332787 If[FreeQ[Abs[tab], Abs[l]], l, While[!FreeQ[Abs[tab],Abs[l]],l=NextPrime[l,-1]];l] %t A332787 ]]];Abs[Select[a/@Range[78],Negative]] %o A332787 (Python) %o A332787 from itertools import islice %o A332787 from sympy import isprime, nextprime %o A332787 def agen(): # generator of terms %o A332787 used, d, nextp = set(), 0, 2 %o A332787 while True: %o A332787 if d > 0 and d not in used and isprime(d): %o A332787 used.add(d); d = 0 %o A332787 while nextp in used: %o A332787 nextp = nextprime(nextp) %o A332787 used.add(nextp); yield nextp; d += nextp %o A332787 print(list(islice(agen(), 65))) # _Michael S. Branicky_, May 12 2022 %Y A332787 Cf. A249031, A332341, A332788. %K A332787 easy,nonn %O A332787 1,1 %A A332787 _Ivan N. Ianakiev_, Feb 24 2020