A060341
Non-adding primes: next term is smallest prime not the sum of any primes so far.
Original entry on oeis.org
2, 3, 7, 11, 17, 41, 47, 83, 89, 307, 311, 613, 617, 919, 2801, 3109, 3413, 9283, 15461, 25087, 37781, 87613, 106181, 284509, 296591, 618269, 1196609, 1774921, 3564677, 5339287, 9818789, 14295223, 23196731, 46393469, 93691861, 98171363, 190948399, 429204473
Offset: 1
5 is not included because 2 + 3 = 5. Given 2, 3, 7 we can get 5 but not 11, so term after 7 is 11.
13 is not included because 2 + 11 = 13.
-
lista(nn) = my(p=2, i, j, s, t, u, v=[2, 1], w); print1(p); for(n=2, nn, u=0; i=1; j=1; w=List([]); s=0; t=1; while(i<=#v, if(j>#v, if(i%2==t, s+=v[i], t=!t; listput(w, s); s=v[i]); i++, if(v[i]>u, if((i%2&&j%2)==t, s+=u, t=!t; listput(w, s); s=u); v[i]-=u; if(j++<=#v, u=v[j]), if((i%2&&j%2)==t, s+=v[i], t=!t; listput(w, s); s=v[i]); if(v[i]==u, if(j++<=#v, u=v[j]), u-=v[i]); i++))); listput(w, s); v=w; s=0; i=0; until(isprime(p), p++; while(s<=p&&i<#v, s+=v[i++]); if(s>p&&!(i%2), p=s)); print1(", ", v[1]=p)); \\ Jinyuan Wang, Dec 17 2024
A226076
Lexicographically least sequence of squares that are sum-free.
Original entry on oeis.org
1, 4, 9, 16, 36, 64, 144, 256, 289, 576, 1024, 1156, 2304, 4096, 4624, 9216, 16384, 18496, 36864, 65536, 73984, 147456, 262144, 295936, 589824, 1048576, 1183744, 2359296, 4194304, 4734976, 9437184, 16777216, 18939904, 37748736, 67108864, 75759616, 150994944
Offset: 1
a(10)=576 as 576 is the next square after a(9)=289 that cannot be formed from distinct sums of a(1),...,a(9) (1,4,9,16,36,64,144,256,289).
-
memberQ[n1_, k1_] := If[Select[IntegerPartitions[n1^2, Length[k1], k1], Sort@#==Union@# &]=={}, False, True]; k={1}; n=1; While[Length[k]<20, (If[!memberQ[n, k], k=Append[k, n^2]]; n++)]; k
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.
Original entry on oeis.org
1, 3, 5, 7, 17, 19, 53, 67, 173, 211, 439, 997, 1993, 2801, 4969, 6791, 13697, 18661, 50849, 50971, 106669, 152729, 310127, 412333, 826097, 1134841, 2271053, 2991883, 4952809, 7223627, 18574201, 20534933, 40243939, 60778433, 100713031, 222270319, 241670423, 563829493
Offset: 1
11 is not a term since 11 = 7 + 3 + 1.
13 is not a term since 13 = 7 + 5 + 1.
-
b:= proc(n, i) option remember; n=0 or i>0 and s(i)>=n
and (b(n, i-1) or a(i)<=n and b(n-a(i), i-1))
end:
s:= proc(n) option remember; `if`(n<1, 0, s(n-1)+a(n)) end:
a:= proc(n) option remember; local p; p:= a(n-1);
while b(p, n-1) do p:= nextprime(p) od; p
end: a(1), a(2):=1, 3:
seq(a(n), n=1..26); # Alois P. Heinz, Dec 15 2024
-
b[n_, i_] := b[n, i] = n == 0 || i > 0 && s[i] >= n
&& (b[n, i-1] || a[i] <= n && b[n - a[i], i-1]);
s[n_] := s[n] = If[n < 1, 0, s[n-1] + a[n]];
a[n_] := a[n] = Module[{p = a[n-1]},
While[b[p, n-1], p = NextPrime[p]]; p];
{a[1], a[2]} = {1, 3};
Table[a[n], {n, 1, 30}] (* Jean-François Alcover, Feb 02 2025, after Alois P. Heinz *)
Showing 1-3 of 3 results.
Comments