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.

A379045 a(1) = 1. For n > 1, a(n) is the least odd prime p which cannot be represented as the sum of a subset of the previous terms.

This page as a plain text file.
%I A379045 #23 Feb 02 2025 10:14:57
%S A379045 1,3,5,7,17,19,53,67,173,211,439,997,1993,2801,4969,6791,13697,18661,
%T A379045 50849,50971,106669,152729,310127,412333,826097,1134841,2271053,
%U A379045 2991883,4952809,7223627,18574201,20534933,40243939,60778433,100713031,222270319,241670423,563829493
%N A379045 a(1) = 1. For n > 1, a(n) is the least odd prime p which cannot be represented as the sum of a subset of the previous terms.
%e A379045 11 is not a term since 11 = 7 + 3 + 1.
%e A379045 13 is not a term since 13 = 7 + 5 + 1.
%p A379045 b:= proc(n, i) option remember; n=0 or i>0 and s(i)>=n
%p A379045       and (b(n, i-1) or a(i)<=n and b(n-a(i), i-1))
%p A379045     end:
%p A379045 s:= proc(n) option remember; `if`(n<1, 0, s(n-1)+a(n)) end:
%p A379045 a:= proc(n) option remember; local p; p:= a(n-1);
%p A379045       while b(p, n-1) do p:= nextprime(p) od; p
%p A379045     end: a(1), a(2):=1, 3:
%p A379045 seq(a(n), n=1..26);  # _Alois P. Heinz_, Dec 15 2024
%t A379045 b[n_, i_] := b[n, i] = n == 0 || i > 0 && s[i] >= n
%t A379045    && (b[n, i-1] || a[i] <= n && b[n - a[i], i-1]);
%t A379045 s[n_] := s[n] = If[n < 1, 0, s[n-1] + a[n]];
%t A379045 a[n_] := a[n] = Module[{p = a[n-1]},
%t A379045    While[b[p, n-1], p = NextPrime[p]]; p];
%t A379045 {a[1], a[2]} = {1, 3};
%t A379045 Table[a[n], {n, 1, 30}] (* _Jean-François Alcover_, Feb 02 2025, after _Alois P. Heinz_ *)
%Y A379045 Cf. A060341, A225947.
%K A379045 nonn
%O A379045 1,2
%A A379045 _Chittaranjan Pardeshi_, Dec 14 2024
%E A379045 a(21)-a(37) from _Alois P. Heinz_, Dec 14 2024
%E A379045 a(38) from _Jinyuan Wang_, Dec 16 2024