A127542
Number of subsets of {1,2,3,...,n} whose sum is prime.
Original entry on oeis.org
0, 2, 4, 7, 12, 22, 42, 76, 139, 267, 516, 999, 1951, 3824, 7486, 14681, 28797, 56191, 108921, 210746, 410016, 804971, 1591352, 3153835, 6249154, 12380967, 24553237, 48731373, 96622022, 191012244, 376293782, 739671592, 1454332766, 2867413428, 5678310305
Offset: 1
The subsets of {1,2,3} that sum to a prime are {1,2}, {2}, {3}, {2,3}. Thus a(3)=4.
-
import Data.List (subsequences)
a127542 = length . filter ((== 1) . a010051 . sum) .
subsequences . enumFromTo 1
-- Reinhard Zumkeller, Feb 22 2012, Oct 27 2010
-
with(combinat): a:=proc(n) local ct, pn, j:ct:=0: pn:=powerset(n): for j from 1 to 2^n do if isprime(add(pn[j][i],i=1..nops(pn[j]))) =true then ct:=ct+1 else ct:=ct fi: od: end: seq(a(n),n=1..18);
# second Maple program:
b:= proc(n, s) option remember; `if`(n=0,
`if`(isprime(s), 1, 0), b(n-1, s)+b(n-1, s+n))
end:
a:= n-> b(n, 0):
seq(a(n), n=1..44); # Alois P. Heinz, Oct 22 2023
-
g[n_] := Block[{p = Product[1 + z^i, {i, n}]},Sum[Boole[PrimeQ[k]]*Coefficient[p, z, k], {k, 0, n*(n + 1)/2}]];Array[g, 34] (* Ray Chandler, Mar 05 2007 *)
-
a(n)=my(v=Vec(prod(i=1,n,x^i+1)),s);forprime(p=2,#v,s+=v[p]);s \\ Charles R Greathouse IV, Dec 19 2014
-
first(n)=my(v=vector(n),P=1,s); for(k=1,n, P*=1+'x^n; s=0; forprime(p=2,k*(k+1)/2,s+=polcoeff(P,p)); v[k]=s); v \\ Charles R Greathouse IV, Dec 19 2014
A359675
Positions of first appearances in the sequence of zero-based weighted sums of prime indices (A359674).
Original entry on oeis.org
1, 4, 6, 8, 12, 14, 16, 20, 24, 30, 32, 36, 40, 48, 52, 56, 72, 80, 92, 96, 100, 104, 112, 124, 136, 148, 152, 172, 176, 184, 188, 212, 214, 236, 244, 248, 262, 268, 272, 284, 292, 304, 316, 328, 332, 346, 356, 376, 386, 388, 398, 404, 412, 428, 436, 452, 458
Offset: 1
The terms together with their prime indices begin:
1: {}
4: {1,1}
6: {1,2}
8: {1,1,1}
12: {1,1,2}
14: {1,4}
16: {1,1,1,1}
20: {1,1,3}
24: {1,1,1,2}
30: {1,2,3}
32: {1,1,1,1,1}
36: {1,1,2,2}
40: {1,1,1,3}
48: {1,1,1,1,2}
Positions of first appearances in
A359674.
A053632 counts compositions by zero-based weighted sum.
A124757 gives zero-based weighted sum of standard compositions, rev
A231204.
-
nn=100;
primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
wts[y_]:=Sum[(i-1)*y[[i]],{i,Length[y]}];
seq=Table[wts[primeMS[n]],{n,1,nn}];
Select[Range[nn],FreeQ[seq[[Range[#-1]]],seq[[#]]]&]
A359680
Positions of first appearances in the sequence of zero-based weighted sums of reversed prime indices (A359677).
Original entry on oeis.org
1, 4, 8, 9, 16, 18, 32, 36, 50, 54, 64, 72, 81, 100, 108, 128, 144, 216, 243, 256, 288, 300, 400, 432, 486, 512, 576, 600, 648, 729, 800, 864, 1024, 1152, 1296, 1350, 1728, 1944, 2048, 2187, 2304, 2400, 2916, 3375, 3456, 3600, 4096, 4374, 4608, 4800, 5184
Offset: 1
The terms together with their prime indices begin:
1: {}
4: {1,1}
8: {1,1,1}
9: {2,2}
16: {1,1,1,1}
18: {1,2,2}
32: {1,1,1,1,1}
36: {1,1,2,2}
50: {1,3,3}
54: {1,2,2,2}
64: {1,1,1,1,1,1}
72: {1,1,1,2,2}
81: {2,2,2,2}
100: {1,1,3,3}
108: {1,1,2,2,2}
128: {1,1,1,1,1,1,1}
This is the sorted version of
A359681.
A053632 counts compositions by zero-based weighted sum.
A124757 gives zero-based weighted sums of standard compositions, rev
A231204.
-
nn=1000;
primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
wts[y_]:=Sum[(i-1)*y[[i]],{i,Length[y]}];
seq=Table[wts[Reverse[primeMS[n]]],{n,1,nn}];
Select[Range[nn],FreeQ[seq[[Range[#-1]]],seq[[#]]]&]
A359754
Positions of first appearances in the sequence of weighted sums of reversed prime indices (A318283).
Original entry on oeis.org
1, 2, 3, 4, 6, 8, 10, 12, 16, 18, 19, 24, 27, 32, 36, 43, 48, 59, 61, 64, 67, 71, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269
Offset: 1
The terms together with their prime indices begin:
1: {}
2: {1}
3: {2}
4: {1,1}
6: {1,2}
8: {1,1,1}
10: {1,3}
12: {1,1,2}
16: {1,1,1,1}
18: {1,2,2}
19: {8}
24: {1,1,1,2}
27: {2,2,2}
32: {1,1,1,1,1}
36: {1,1,2,2}
43: {14}
48: {1,1,1,1,2}
This is the sorted version of
A359679.
A053632 counts compositions by weighted sum.
-
nn=100;
primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
ots[y_]:=Sum[i*y[[i]],{i,Length[y]}];
seq=Table[ots[Reverse[primeMS[n]]],{n,1,nn}];
Select[Range[nn],FreeQ[seq[[Range[#-1]]],seq[[#]]]&]
A068052
Start from 1, shift one left and sum mod 2 (bitwise-XOR) to get 3 (11 in binary), then shift two steps left and XOR to get 15 (1111 in binary), then three steps and XOR to get 119 (1110111 in binary), then four steps and so on.
Original entry on oeis.org
1, 3, 15, 119, 1799, 59367, 3743271, 481693095, 123123509927, 62989418816679, 64491023022979239, 132015402419352060071, 540829047855347718631591, 4430403202865824763042320551, 72583450474242118015031400337575, 2378466805556971511916001231449723047
Offset: 0
Same sequence shown in binary:
A068053.
Cf.
A000120,
A003987,
A028362 (using + instead of XOR),
A048675,
A053632,
A080791,
A248663,
A285101,
A285102,
A285103,
A285105.
-
with(gfun,seriestolist); [seq(foo(map(`mod`,seriestolist(series(mul(1+(z^i),i=1..n),z,binomial(n+1,2)+1)),2)), n=0..20)];
foo := proc(a) local i; add(a[i]*2^(i-1),i=1..nops(a)); end;
# second Maple program:
a:= proc(n) option remember; `if`(n=0, 1,
(t-> Bits[Xor](2^n*t, t))(a(n-1)))
end:
seq(a(n), n=0..16); # Alois P. Heinz, Mar 07 2024
-
FoldList[BitXor[#, #*#2]&, 1, 2^Range[20]] (* Paolo Xausa, Mar 07 2024 *)
-
a(n) = if(n<1, 1, bitxor(a(n - 1), 2^n*a(n - 1))); \\ Indranil Ghosh, Apr 15 2017, after formula by Antti Karttunen
A363532
Number of integer partitions of n with weighted alternating sum 0.
Original entry on oeis.org
1, 0, 0, 1, 0, 0, 2, 2, 0, 3, 3, 3, 5, 5, 10, 12, 7, 14, 25, 18, 22, 48, 48, 41, 67, 82, 89, 111, 140, 170, 220, 214, 264, 392, 386, 436, 623, 693, 756, 934, 1102, 1301, 1565, 1697, 2132, 2616, 2727, 3192, 4062, 4550, 5000, 6132, 7197, 8067, 9338, 10750, 12683
Offset: 0
The a(11) = 3 through a(15) = 12 partitions (A = 10):
(33221) (84) (751) (662) (A5)
(44111) (6222) (5332) (4442) (8322)
(222221) (7311) (6421) (5531) (9411)
(621111) (532111) (43331) (722211)
(51111111) (42211111) (54221) (831111)
(65111) (3322221)
(432221) (3333111)
(443111) (4422111)
(32222111) (5511111)
(33311111) (22222221)
(72111111)
(6111111111)
These partitions have ranks
A363621.
The version for compositions is
A363626.
A363619 gives weighted alternating sum of prime indices, reverse
A363620.
A363624 gives weighted alternating sum of Heinz partition, reverse
A363625.
-
altwtsum[y_]:=Sum[(-1)^(k-1)*k*y[[k]],{k,1,Length[y]}];
Table[Length[Select[IntegerPartitions[n],altwtsum[#]==0&]],{n,0,30}]
A363626
Number of integer compositions of n with weighted alternating sum 0.
Original entry on oeis.org
1, 0, 0, 1, 1, 0, 2, 5, 7, 8, 14, 38, 64, 87, 174, 373, 649, 1069, 2051, 4091, 7453, 13276, 25260, 48990, 91378, 168890, 321661, 618323, 1169126, 2203649, 4211163, 8085240, 15421171, 29390131, 56382040, 108443047, 208077560, 399310778
Offset: 0
The a(3) = 1 through a(10) = 14 compositions:
(21) (121) . (42) (331) (242) (63) (541)
(3111) (1132) (1331) (153) (2143)
(2221) (11132) (4122) (3232)
(21121) (12221) (5211) (4321)
(112111) (23111) (13122) (15112)
(121121) (14211) (31231)
(1112111) (411111) (42121)
(1311111) (114112)
(212122)
(213211)
(311221)
(322111)
(3111121)
(21211111)
A363619 gives weighted alternating sum of prime indices, reverse
A363620.
A363624 gives weighted alternating sum of Heinz partition, reverse
A363625.
-
altwtsum[y_]:=Sum[(-1)^(k-1)*k*y[[k]],{k,1,Length[y]}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],altwtsum[#]==0&]],{n,0,10}]
A222970
Number of 1 X (n+1) 0..1 arrays with every row least squares fitting to a positive-slope straight line and every column least squares fitting to a zero- or positive-slope straight line, with a single point array taken as having zero slope.
Original entry on oeis.org
1, 2, 6, 12, 28, 54, 119, 230, 488, 948, 1979, 3860, 7978, 15624, 32072, 63014, 128746, 253588, 516346, 1019072, 2069590, 4091174, 8291746, 16412668, 33210428, 65808044, 132985161, 263755984, 532421062, 1056789662, 2131312530, 4233176854
Offset: 1
Some solutions for n=3:
0 1 0 1 0 1 1 1 0 0 1 0 0 0 1 1 0 0 0 1
For >= instead of > we have
A222855.
A053632 counts compositions by weighted sum (or reverse-weighted sum).
A231429
Number of partitions of 2n into distinct parts < n.
Original entry on oeis.org
1, 0, 0, 0, 0, 1, 2, 4, 8, 14, 22, 35, 53, 78, 113, 160, 222, 306, 416, 558, 743, 980, 1281, 1665, 2149, 2755, 3514, 4458, 5626, 7070, 8846, 11020, 13680, 16920, 20852, 25618, 31375, 38309, 46649, 56651, 68616, 82908, 99940, 120192, 144238, 172730, 206425
Offset: 0
a(5) = #{4+3+2+1} = 1;
a(6) = #{5+4+3, 5+4+2+1} = 2;
a(7) = #{6+5+3, 6+5+2+1, 6+4+3+1, 5+4+3+2} = 4;
a(8) = #{7+6+3, 7+6+2+1, 7+6+3, 7+5+3+1, 7+4+3+2, 6+5+4+1, 6+5+3+2, 6+4+3+2+1} = 8;
a(9) = #{8+7+3, 8+7+2+1, 8+6+4, 8+6+3+1, 8+5+4+1, 8+5+3+2, 8+4+3+2+1, 7+6+5, 7+6+4+1, 7+6+3+2, 7+5+4+2, 7+5+3+2+1, 6+5+4+3, 6+5+4+2+1} = 14.
A053632 counts compositions by weighted sum.
-
a231429 n = p [1..n-1] (2*n) where
p _ 0 = 1
p [] _ = 0
p (k:ks) m = if m < k then 0 else p ks (m - k) + p ks m
-
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], Total[Accumulate[#]]==3n&]],{n,0,15}] (* Gus Wiseman, Jun 17 2023 *)
A359401
Nonnegative integers whose sum of positions of 1's in their binary expansion is greater than the sum of positions of 1's in their reversed binary expansion, where positions in a sequence are read starting with 1 from the left.
Original entry on oeis.org
11, 19, 23, 35, 37, 39, 43, 47, 55, 67, 69, 71, 75, 77, 79, 83, 87, 91, 95, 103, 111, 131, 133, 134, 135, 137, 139, 141, 142, 143, 147, 149, 151, 155, 157, 158, 159, 163, 167, 171, 173, 175, 179, 183, 187, 191, 199, 203, 207, 215, 223, 239, 259, 261, 262, 263
Offset: 1
A230877 adds up positions of 1's in binary expansion, reverse
A029931.
A326669 lists numbers with integer mean position of a 1 in binary expansion.
Cf.
A000120,
A048793,
A051293,
A053632,
A222955,
A231204,
A291166,
A304818,
A326672,
A326673,
A359043.
-
sap[q_]:=Sum[q[[i]]*(2i-Length[q]-1),{i,Length[q]}];
Select[Range[0,100],sap[IntegerDigits[#,2]]>0&]
Comments