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.

A102330 Triangle read by rows: n-th row consists of the lexicographically earliest set of n distinct primes whose sum is A068873(n).

This page as a plain text file.
%I A102330 #26 May 14 2025 01:18:49
%S A102330 2,2,3,3,5,11,2,3,5,7,3,5,7,11,17,2,3,5,7,11,13,3,5,7,11,13,17,23,2,3,
%T A102330 5,7,11,13,19,23,3,5,7,11,13,17,19,23,29,2,3,5,7,11,13,17,19,23,31,3,
%U A102330 5,7,11,13,17,19,23,29,31,41,2,3,5,7,11,13,17,19,23,29,31,37,3,5,7,11,13,17
%N A102330 Triangle read by rows: n-th row consists of the lexicographically earliest set of n distinct primes whose sum is A068873(n).
%H A102330 David A. Corneth, <a href="/A102330/b102330.txt">Table of n, a(n) for n = 1..10011</a> (first 141 rows flattened, first 300 terms from Jean-Francois Alcover, terms 301..2485 from Robert Israel)
%H A102330 Robert Israel, <a href="/A102330/b102330_1.txt">Table of n, a(n) for n = 1..2485</a> (rows 1 to 70, flattened), replacing incorrect b-file from Jean-Francois Alcover
%e A102330 Triangle begins:
%e A102330   2
%e A102330   2,3
%e A102330   3,5,11
%e A102330   2,3,5,7
%e A102330   3,5,7,11,17
%e A102330   2,3,5,7,11,13
%e A102330   3,5,7,11,13,17,23
%e A102330   2,3,5,7,11,13,19,23
%e A102330   3,5,7,11,13,17,19,23,29
%e A102330   2,3,5,7,11,13,17,19,23,31
%e A102330   3,5,7,11,13,17,19,23,29,31,41
%e A102330   2,3,5,7,11,13,17,19,23,29,31,37
%e A102330   3,5,7,11,13,17,19,23,29,31,37,41,47
%e A102330   2,3,5,7,11,13,17,19,23,29,31,37,41,43
%e A102330   3,5,7,11,13,17,19,23,29,31,37,41,43,47,53
%p A102330 g:= proc(n,k,m) option remember; # lex earliest set of k distinct primes > m with sum n
%p A102330    local q,v;
%p A102330   if k = 1 then
%p A102330     if isprime(n) and n > m then return [n] else return NULL fi
%p A102330   fi;
%p A102330   q:= m;
%p A102330   do
%p A102330     q:= nextprime(q);
%p A102330     if n < k*q then return NULL fi;
%p A102330     v:= procname(n-q,k-1,q);
%p A102330     if v <> NULL then return [q,op(v)] fi
%p A102330   od
%p A102330 end proc:
%p A102330 f:= proc(k)
%p A102330 local p,i,v;
%p A102330 p:= add(ithprime(i),i=1..k)-1;
%p A102330 do
%p A102330   p:= nextprime(p);
%p A102330   v:= g(p,k,0);
%p A102330   if v <> NULL then return v fi
%p A102330 od
%p A102330 end proc:
%p A102330 for k from 1 to 30 do
%p A102330   f(k)
%p A102330 od; # _Robert Israel_, May 12 2025
%t A102330 (* Computation verified with A068873. *)
%t A102330 row[n_] := Module[{s, m}, s = Select[{#, Total[#]}& /@ Subsets[ Prime[ Range[n+4]], {n}], PrimeQ[#[[2]]]&]; m = MinimalBy[s, #[[2]]&, 1]; If[s != {}, Return[m[[1, 1]]]]];
%t A102330 Array[row, 49] // Flatten (* _Jean-François Alcover_, Apr 23 2020 *)
%Y A102330 By definition, row sums are A068873.
%K A102330 easy,nonn,tabl
%O A102330 1,1
%A A102330 _Giovanni Teofilatto_, Jan 30 2005
%E A102330 Edited, corrected and extended by _Ray Chandler_, Feb 02 2005
%E A102330 Edited by _N. J. A. Sloane_, May 07 2014