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.

Showing 1-4 of 4 results.

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

Views

Author

John W. Layman, Feb 27 2012

Keywords

Comments

From the 9th term onward the differences of this sequence appear to again be the squares. Is there a simple explanation for this?
Similar examples are provided for the positive integers in A000124, the odd integers in A082562 and the primes in A082548.
For n > 9: a(n) - a(n-1) = n^2 up to at least n = 1785. - Zak Seidov and Jud McCranie, Feb 29 2012
To compute the terms in order, start with a list with the element 0. Add 1^2 to each term of the list and add the sum to the list, if it isn't already on the list. The cardinality of the list is a(1). Then a(n+1) is computed by adding n^2 to each member of the list and adding the sum to the list, if it isn't already there. The number of members of the list is a(2). This is much faster than considering every subset. - Jud McCranie, Mar 01 2012

Examples

			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.
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Union[Total /@ Subsets[Range[n]^2]]], {n, 17}] (* T. D. Noe, Feb 28 2012 *)

Formula

Conjectures from Colin Barker, Feb 15 2016: (Start)
a(n) = (2*n^3+3*n^2+n-366)/6 for n>8.
a(n) = 4*a(n-1)-6*a(n-2)+4*a(n-3)-a(n-4) for n>12.
G.f.: x*(2-4*x+4*x^2-2*x^4+8*x^5-7*x^6+7*x^7-10*x^8+6*x^9-6*x^10+4*x^11) / (1-x)^4. (End)
For a proof of these conjectures see the Suzuki (2019) link.

Extensions

a(23)-a(26) from Zak Seidov, Feb 29 2012
a(27)-a(40) from Jud McCranie, Feb 29 2012
a(41)-a(45) from Pontus von Brömssen, Mar 29 2025

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

Views

Author

Paolo Xausa, Apr 30 2021

Keywords

Comments

From Omar E. Pol, Apr 30 2021: (Start)
Irregular triangle read by rows T(n,k) in which row n lists the next p positive integers in decreasing order, where p is the n-th prime, with n >= 1.
The triangle has the following properties:
Column 1 gives the nonzero terms of A007504.
Column 2 gives A237589.
Column 3 gives A071148.
Column 4 gives the terms > 2 of A343859.
Column 5 gives the absolute values of the terms < -1 of A282329.
Column 6 gives the terms > 7 of A082548.
Column 7 gives the terms > 6 of A115030.
Records are in the column 1.
Indices of records are in the right border.
Right border gives A014284.
Row lengths give A000040.
Row products give A078423.
Row sums give A034956. (End)

Examples

			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)
		

Crossrefs

Programs

  • Maple
    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
  • Mathematica
    With[{nn=10},Reverse/@TakeList[Range[Total[Prime[Range[nn]]]],Prime[Range[nn]]]]//Flatten (* Harvey P. Dale, Apr 27 2022 *)

Formula

T(n,k) = A007504(n) - k + 1, with n >= 1 and 1 <= k <= A000040(n). - Omar E. Pol, May 01 2021

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

Views

Author

Naohiro Nomoto, May 05 2003

Keywords

Comments

Beginning with the third term, the first differences are the odd positive integers. - John W. Layman, Feb 28 2012

Crossrefs

Programs

  • Mathematica
    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 *)
  • PARI
    Vec((1-x+x^2+x^3+x^4-x^5)/(1-x)^3 + O(x^100)) \\ Colin Barker, Feb 15 2016

Formula

For n>2, a(n) = n^2-1. The values of m are all values from 2n+1 to (n+1)^2 except 2n+3 and n^2+2n-1. - David Wasserman, Sep 16 2004
From Colin Barker, Feb 15 2016: (Start)
a(n) = n^2-1 for n>2.
a(n) = 3*a(n-1)-3*a(n-2)+a(n-3) for n>5.
G.f.: (1-x+x^2+x^3+x^4-x^5) / (1-x)^3.
(End)

Extensions

More terms from David Wasserman, Sep 16 2004

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

Views

Author

Yigit Oktar, Dec 27 2023

Keywords

Comments

Bit position 0 (which is sum 0) is the least significant bit of a(n).
The resulting binary string is palindromic for all n. A subset sum of zero marks one end of the binary string, while the sum of all n primes marks the other end. Therefore, starting from no primes and adding some and starting from all primes and omitting some correspond to the same pattern. (This is so for any values, not just primes.)
It is observed that for an array of primes, for large values of n, the binary string starts with a certain pattern and ends with the reverse of this certain pattern and consists of all ones in the middle area.

Examples

			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
		

Crossrefs

Cf. A000040, A082548 (number of sums), A007504 (see formula).

Programs

  • Maple
    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
  • Python
    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)

Formula

a(n) = a(n-1) BITOR a(n-1)*2^prime(n).
a(n) = 91*2^(A007504(n)-6) - 83 for n > 3.
Showing 1-4 of 4 results.