A208531
Number of distinct sums of subsets of the first n squares {1,4,9,...,n^2}.
Original entry on oeis.org
2, 4, 8, 16, 28, 52, 89, 147, 224, 324, 445, 589, 758, 954, 1179, 1435, 1724, 2048, 2409, 2809, 3250, 3734, 4263, 4839, 5464, 6140, 6869, 7653, 8494, 9394, 10355, 11379, 12468, 13624, 14849, 16145, 17514, 18958, 20479, 22079, 23760, 25524, 27373, 29309, 31334
Offset: 1
All subsets of {1,4,9,16} give distinct sums, so a(4)=16. Four pairs of subsets of {1,4,9,16,25} have the same sum, for example {9,16} and {25}, resulting in a(5)=28.
A343809
Divide the positive integers into subsets of lengths given by successive primes, then reverse the order of terms in each subset.
Original entry on oeis.org
2, 1, 5, 4, 3, 10, 9, 8, 7, 6, 17, 16, 15, 14, 13, 12, 11, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59
Offset: 1
From _Omar E. Pol_, Apr 30 2021: (Start)
Written as an irregular triangle in which row lengths give A000040 the sequence begins:
2, 1;
5, 4, 3;
10, 9, 8, 7, 6;
17, 16, 15, 14, 13, 12, 11;
28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18;
41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29;
58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42;
77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59;
...
(End)
Cf.
A000027,
A000040,
A007504,
A014284,
A034956,
A038722,
A071148,
A073612 (fixed points),
A078423,
A082548,
A115030,
A237589,
A282329,
A343859,
A344891.
-
R:= NULL: t:= 1:
for i from 1 to 20 do
p:= ithprime(i);
R:= R, seq(i,i=t+p-1..t,-1);
t:= t+p;
od:
R; # Robert Israel, Apr 30 2021
-
With[{nn=10},Reverse/@TakeList[Range[Total[Prime[Range[nn]]]],Prime[Range[nn]]]]//Flatten (* Harvey P. Dale, Apr 27 2022 *)
A082562
a(n) = number of values of m such that m can be expressed as the sum of distinct odd numbers with largest odd number in the sum = 2n+1.
Original entry on oeis.org
1, 2, 4, 8, 15, 24, 35, 48, 63, 80, 99, 120, 143, 168, 195, 224, 255, 288, 323, 360, 399, 440, 483, 528, 575, 624, 675, 728, 783, 840, 899, 960, 1023, 1088, 1155, 1224, 1295, 1368, 1443, 1520, 1599, 1680, 1763, 1848, 1935, 2024, 2115, 2208, 2303, 2400, 2499
Offset: 0
-
Join[{1, 2, 4}, LinearRecurrence[{3, -3, 1}, {8, 15, 24}, 80]] (* and *) Join[{1, 2, 4}, Table[n^2 - 1, {n, 3, 80}]] (* Vladimir Joseph Stephan Orlovsky, Feb 13 2012 *)
-
Vec((1-x+x^2+x^3+x^4-x^5)/(1-x)^3 + O(x^100)) \\ Colin Barker, Feb 15 2016
A368491
a(n) is the integer whose bits designate the possible subset sums of the first n prime numbers.
Original entry on oeis.org
1, 5, 45, 1453, 186285, 381681581, 3126736191405, 409827566090715053, 214867674970568857223085, 1802440697199513680253124870061, 967677980931418755473971539884090851245, 2078072640579877586820864371518464918573279084461, 285608128960093974754528418755948821932657172723113570336685
Offset: 0
For n = 0, there are no terms from which to calculate a subset sum. An empty array gives zero as the only possible sum. This is designated by the binary string 1 which has a value of 1 in base 10.
For n = 2, sums of 0,2,3,5 are possible, yielding a binary string of 101101, which has a value of 45 in base 10. The impossibility of sums 1 and 4 is indicated by 0's in the binary string.
For n = 3, the primes are 2,3,5 and their subset sums 0, 2, 3, 5, 7, 8, 10 are the positions of 1 bits in a(3) = 1453,
10 8 7 5 3 2 0 bit positions
a(n) = 1 0 1 1 0 1 0 1 1 0 1 binary
-
a:= proc(n) option remember; `if`(n=0, 1,
Bits[Or](a(n-1), a(n-1)*2^ithprime(n)))
end:
seq(a(n), n=0..15); # Alois P. Heinz, Mar 20 2025
-
from primesieve import *
n = 20
ps = generate_n_primes(n)
res = 1
a = []
a.append(res)
for v in ps:
res = (res | (res << v))
a.append(res)
print(a)
Showing 1-4 of 4 results.
Comments