A085472 Duplicate of A054242.
1, 1, 1, 1, 2, 1, 2, 3, 3, 2, 2, 5, 5, 5, 2, 3, 7, 9, 9, 7, 3, 4, 10, 14, 17, 14, 10, 4, 5, 14, 21
Offset: 0
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.
G.f. = 1 + x + x^2 + 2*x^3 + 2*x^4 + 3*x^5 + 4*x^6 + 5*x^7 + 6*x^8 + 8*x^9 + ... G.f. = q + q^25 + q^49 + 2*q^73 + 2*q^97 + 3*q^121 + 4*q^145 + 5*q^169 + ... The partitions of n into distinct parts (see A118457) for small n are: 1: 1 2: 2 3: 3, 21 4: 4, 31 5: 5, 41, 32 6: 6, 51, 42, 321 7: 7, 61, 52, 43, 421 8: 8, 71, 62, 53, 521, 431 ... From _Reinhard Zumkeller_, Jun 13 2009: (Start) a(8)=6, A140207(8)=#{5+2+1,4+3+1}=2, A003056(8)=3, A051162(8)=5; a(9)=8, A140207(9)=#{6+2+1,5+3+1,4+3+2}=3, A003056(9)=3, A051162(9)=6; a(10)=10, A140207(10)=#{4+3+2+1}=1, A003056(10)=4, A051162(10)=4. (End)
import Data.MemoCombinators (memo2, integral) a000009 n = a000009_list !! n a000009_list = map (pM 1) [0..] where pM = memo2 integral integral p p _ 0 = 1 p k m | m < k = 0 | otherwise = pM (k + 1) (m - k) + pM (k + 1) m -- Reinhard Zumkeller, Sep 09 2015, Nov 05 2013
# uses A010815 using Memoize @memoize function A000009(n) n == 0 && return 1 s = sum((-1)^k*A000009(n - k^2) for k in 1:isqrt(n)) A010815(n) - 2*s end # Peter Luschny, Sep 09 2021
Coefficients(&*[1+x^m:m in [1..100]])[1..100] where x is PolynomialRing(Integers()).1; // Sergei Haller (sergei(AT)sergei-haller.de), Dec 21 2006
N := 100; t1 := series(mul(1+x^k,k=1..N),x,N); A000009 := proc(n) coeff(t1,x,n); end; spec := [ P, {P=PowerSet(N), N=Sequence(Z,card>=1)} ]: [ seq(combstruct[count](spec, size=n), n=0..58) ]; spec := [ P, {P=PowerSet(N), N=Sequence(Z,card>=1)} ]: combstruct[allstructs](spec, size=10); # to get the actual partitions for n=10 A000009 := proc(n) local x,m; product(1+x^m,m=1..n+1) ; expand(%) ; coeff(%,x,n) ; end proc: # R. J. Mathar, Jun 18 2016 lim := 99; # Enlarge if more terms are needed. simplify(expand(QDifferenceEquations:-QPochhammer(-1, x, lim)/2, x)): seq(coeff(%, x, n), n=0..55); # Peter Luschny, Nov 17 2016 # Alternative: a:= proc(n) option remember; `if`(n=0, 1, add(a(n-j)*add( `if`(d::odd, d, 0), d=numtheory[divisors](j)), j=1..n)/n) end: seq(a(n), n=0..55); # Alois P. Heinz, Jun 24 2025
PartitionsQ[Range[0, 60]] (* Harvey Dale, Jul 27 2009 *) a[ n_] := SeriesCoefficient[ Product[ 1 + x^k, {k, n}], {x, 0, n}]; (* Michael Somos, Jul 06 2011 *) a[ n_] := SeriesCoefficient[ 1 / Product[ 1 - x^k, {k, 1, n, 2}], {x, 0, n}]; (* Michael Somos, Jul 06 2011 *) a[ n_] := With[ {t = Log[q] / (2 Pi I)}, SeriesCoefficient[ q^(-1/24) DedekindEta[2 t] / DedekindEta[ t], {q, 0, n}]]; (* Michael Somos, Jul 06 2011 *) a[ n_] := SeriesCoefficient[ 1 / QPochhammer[ x, x^2], {x, 0, n}]; (* Michael Somos, May 24 2013 *) a[ n_] := SeriesCoefficient[ Series[ QHypergeometricPFQ[ {q}, {q x}, q, - q x], {q, 0, n}] /. x -> 1, {q, 0, n}]; (* Michael Somos, Mar 04 2014 *) a[ n_] := SeriesCoefficient[ QHypergeometricPFQ[{}, {}, q, -1] / 2, {q, 0, n}]; (* Michael Somos, Mar 04 2014 *) nmax = 60; CoefficientList[Series[Exp[Sum[(-1)^(k+1)/k*x^k/(1-x^k), {k, 1, nmax}]], {x, 0, nmax}], x] (* Vaclav Kotesovec, Aug 25 2015 *) nmax = 100; poly = ConstantArray[0, nmax + 1]; poly[[1]] = 1; poly[[2]] = 1; Do[Do[poly[[j + 1]] += poly[[j - k + 1]], {j, nmax, k, -1}];, {k, 2, nmax}]; poly (* Vaclav Kotesovec, Jan 14 2017 *)
num_distinct_partitions(60,list); /* Emanuele Munarini, Feb 24 2014 */
h(n):=if oddp(n)=true then 1 else 0; S(n,m):=if n=0 then 1 else if nVladimir Kruchinin, Sep 07 2014 */
{a(n) = if( n<0, 0, polcoeff( prod( k=1, n, 1 + x^k, 1 + x * O(x^n)), n))}; /* Michael Somos, Nov 17 1999 */
{a(n) = my(A); if( n<0, 0, A = x * O(x^n); polcoeff( eta(x^2 + A) / eta(x + A), n))};
{a(n) = my(c); forpart(p=n, if( n<1 || p[1]<2, c++; for(i=1, #p-1, if( p[i+1] > p[i]+1, c--; break)))); c}; /* Michael Somos, Aug 13 2017 */
lista(nn) = {q='q+O('q^nn); Vec(eta(q^2)/eta(q))} \\ Altug Alkan, Mar 20 2018
# uses A010815 from functools import lru_cache from math import isqrt @lru_cache(maxsize=None) def A000009(n): return 1 if n == 0 else A010815(n)+2*sum((-1)**(k+1)*A000009(n-k**2) for k in range(1,isqrt(n)+1)) # Chai Wah Wu, Sep 08 2021
import numpy as np n = 1000 arr = np.zeros(n,dtype=object) arr[0] = 1 for i in range(1,n): arr[i:] += arr[:n-i] print(arr) # Yigit Oktar, Jul 12 2025
# uses[EulerTransform from A166861] a = BinaryRecurrenceSequence(0, 1) b = EulerTransform(a) print([b(n) for n in range(56)]) # Peter Luschny, Nov 11 2020
The second row (n=1) is 1,1 since (1,0) and (0,1) each have a single partition. The third row (n=2) is 2, 2, 2 from (2,0) = (1,0)+(1,0), (1,1) = (1,0)+(0,1), (0,2) = (0,1)+(0,1). In the fourth row (n=3), T(2,1)=4 from (2,1) = (2,0)+(0,1) = (1,0)+(1,1) = (1,0)+(1,0)+(0,1). The triangle begins: 1; 1, 1; 2, 2, 2; 3, 4, 4, 3; 5, 7, 9, 7, 5; 7, 12, 16, 16, 12, 7; 11, 19, 29, 31, 29, 19, 11; 15, 30, 47, 57, 57, 47, 30, 15; 22, 45, 77, 97, 109, 97, 77, 45, 22; ... A further example: T(2,2) = 9: [(2,2)], [(2,1),(0,1)], [(2,0),(0,2)], [(2,0),(0,1),(0,1)], [(1,2),(1,0)], [(1,1),(1,1)], [(1,1),(1,0),(0,1)], [(1,0),(1,0),(0,2)], [(1,0),(1,0),(0,1),(0,1)].
see Zumkeller link.
read transforms; t1 := mul( mul( 1/(1-x^(i-j)*y^j), j=0..i), i=1..11): SERIES2(t1,x,y,6);
rows = 11; se = Series[ Product[ 1/(1-x^(n-k)*y^k), {n, 1, rows}, {k, 0, n}], {x, 0, rows}, {y, 0, rows}]; coes = CoefficientList[ se, {x, y}]; Flatten[ Table[ coes[[n-k+1, k]], {n, 1, rows+1}, {k, 1, n}]] (* Jean-François Alcover, Nov 21 2011, after g.f. *) p = 2; q = 3; b[n_, k_] := b[n, k] = If[n>k, 0, 1] + If[PrimeQ[n], 0, Sum[If[d>k, 0, b[n/d, d]], {d, DeleteCases[Divisors[n], 1|n]}]]; t[n_, k_] := b[p^(n-k)*q^k, p^(n-k)*q^k]; Table[t[n, k], {n, 0, 11}, {k, 0, n}] // Flatten (* Jean-François Alcover, Mar 13 2014, after Alois P. Heinz *)
{T(n, k) = if( n<0 || k<0, 0, polcoeff( polcoeff( prod( i=1, n, prod( j=0, i, 1 / (1 - x^i * y^j), 1 + x * O(x^n))),n),k))} /* Michael Somos, Apr 19 2005 */
a(2) = 4: [(2,0)], [(1,1)], [(1,0),(0,1)], [(0,2)].
b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0, add( b(n-i*j, min(n-i*j, i-1))*binomial(i+1, j), j=0..n/i))) end: a:= n-> b(n$2): seq(a(n), n=0..42); # Alois P. Heinz, Sep 19 2019
nmax=50; CoefficientList[Series[Product[(1+x^k)^(k+1),{k,1,nmax}],{x,0,nmax}],x] (* Vaclav Kotesovec, Mar 07 2015 *)
Partitions of (2,1) into distinct positive pairs, T(2,1) = 3: (2,1), (2,0) + (0,1), (1,1) + (1,0); Partitions of (2,2) into distinct positive pairs, T(2,2) = 5: (2,2), (2,1) + (0,1), (2,0) + (0,2), (1,2) + (1,0), (1,1) + (1,0) + (0,1). First ten rows of triangle: 0: 1 1: 1 2 2: 1 3 5 3: 2 5 9 17 4: 2 7 14 27 46 5: 3 10 21 42 74 123 6: 4 14 31 64 116 197 323 7: 5 19 44 93 174 303 506 809 8: 6 25 61 132 254 452 769 1251 1966 9: 8 33 83 185 363 659 1141 1885 3006 4660
-- see link.
nmax = 10; f[x_, y_] := Product[1 + x^n y^k, {n, 0, nmax}, {k, 0, nmax}]/2; se = Series[f[x, y], {x, 0, nmax}, {y, 0, nmax}]; coes = CoefficientList[se, {x, y}]; t[n_ /; n >= 0, k_] /; 0 <= k <= n := coes[[n-k+1, k+1]]; T[n_, k_] := t[n+k, k]; Table[T[n, k], {n, 0, nmax}, {k, 0, n}] // Flatten (* Jean-François Alcover, Nov 08 2021 *)
a(0) = 1: []. a(1) = 2: [(1,1)], [(1,0),(0,1)]. a(2) = 5: [(2,2)], [(2,1),(0,1)], [(2,0),(0,2)], [(1,2),(1,0)], [(1,1),(1,0),(0,1)].
(* This program is not convenient for a large number of terms *) a[n_] := If[n == 0, 1, (1/2) Coefficient[Product[O[x]^(n+1) + O[y]^(n+1) + (1 + x^i y^j ), {i, 0, n}, {j, 0, n}] // Normal, (x y)^n]]; a /@ Range[0, 31] (* Jean-François Alcover, Jun 26 2013, updated Sep 16 2019 *) nmax = 20; p = 1; Do[Do[p = Expand[p*(1 + x^i*y^j)]; If[i*j != 0, p = Select[p, (Exponent[#, x] <= nmax) && (Exponent[#, y] <= nmax) &]], {i, 0, nmax}], {j, 0, nmax}]; p = Select[p, Exponent[#, x] == Exponent[#, y] &]; Flatten[{1, Table[Coefficient[p, x^n*y^n]/2, {n, 1, nmax}]}] (* Vaclav Kotesovec, Jan 15 2016 *)
Partitions of (3,1) into positive pairs, T(3,1) = 7: (3,1), (3,0) + (0,1), (2,1) + (1,0), (2,0) + (1,1), (2,0) + (1,0) + (0,1), (1,1) + (1,0) + (1,0), (1,0) + (1,0) + (1,0) + (0,1). First ten rows of triangle: 0: 1 1: 1 2 2: 2 4 9 3: 3 7 16 31 4: 5 12 29 57 109 5: 7 19 47 97 189 339 6: 11 30 77 162 323 589 1043 7: 15 45 118 257 522 975 1752 2998 8: 22 67 181 401 831 1576 2876 4987 8406 9: 30 97 267 608 1279 2472 4571 8043 13715 22652 X: 42 139 392 907 1941 3804 7128 12693 21893 36535 59521
-- see link.
max = 10; se = Series[ Sum[ Log[1 - x^(n-k)*y^k], {n, 1, 2max }, {k, 0, n}], {x, 0, 2max }, {y, 0, 2max }]; coes = CoefficientList[ Series[ Exp[-se], {x, 0, 2max }, {y, 0, 2max }], {x, y}]; t[n_, k_] := coes[[n+1, k+1]]; Flatten[ Table[ t[n, k], {n, 0, max}, {k, 0, n}]] (* Jean-François Alcover, Dec 05 2011 *) p = 2; q = 3; b[n_, k_] := b[n, k] = If[n > k, 0, 1] + If[PrimeQ[n], 0, Sum[If[d > k, 0, b[n/d, d]], {d, DeleteCases[Divisors[n] , 1|n]}]]; t[n_, k_] := b[p^n*q^k, p^n*q^k]; Table[t[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Mar 13 2014, after Alois P. Heinz *)
see Haskell link, 3.2.2 a225561 n = length $ takeWhile (not . null) $ map (ps [] $ a027750_row n) [1..] where ps qs _ 0 = [qs] ps [] = [] ps qs (k:ks) m = if m == 0 then [] else ps (k:qs) ks (m - k) ++ ps qs ks m -- Reinhard Zumkeller, May 11 2013
a[n_] := First[Complement[Range[DivisorSigma[1, n] + 1], Total /@ Subsets[Divisors[n]]]] - 1; Array[a, 100] (* Jean-François Alcover, Sep 27 2018 *) f[p_, e_] := (p^(e + 1) - 1)/(p - 1); g[n_] := If[(ind = Position[(fct = FactorInteger[n])[[;; , 1]]/(1 + FoldList[Times, 1, f @@@ Most@fct]), ?(# > 1 &)]) == {}, n, Times @@ (Power @@@ fct[[1 ;; ind[[1, 1]] - 1]])]; a[n] := DivisorSigma[1, g[n]]; Array[a, 100] (* Amiram Eldar, Sep 27 2019 *)
a(n)=my(d=divisors(n),t,v=vector(2^#d-1,i,t=vecextract(d,i); sum(j=1,#t,t[j]))); v=vecsort(v,,8); for(i=1,#v,if(v[i]!=i,return(i-1)));v[#v]
from sympy import divisors def A225561(n): c = {0} for d in divisors(n,generator=True): c |= {a+d for a in c} k = 1 while k in c: k += 1 return k-1 # Chai Wah Wu, Jul 05 2023
max=50; col=2; s1=Series[Product[(1+x^(n-k)*y^k), {n, 1, max+2}, {k, 0, n}], {y, 0, col}]//Normal; s2=Series[s1, {x, 0, max+1}]; a[n_]:=SeriesCoefficient[s2, {x, 0, n}, {y, 0, col}]; Table[a[n], {n, 0, max}] (* after Jean-François Alcover *) nmax = 50; CoefficientList[Series[(1 + x - x^2)/((1 - x)*(1 - x^2)) * Product[1 + x^k, {k, 1, nmax}], {x, 0, nmax}], x]
max=50; col=3; s1=Series[Product[(1+x^(n-k)*y^k), {n, 1, max+2}, {k, 0, n}], {y, 0, col}]//Normal; s2=Series[s1, {x, 0, max+1}]; a[n_]:=SeriesCoefficient[s2, {x, 0, n}, {y, 0, col}]; Table[a[n], {n, 0, max}] (* after Jean-François Alcover *) nmax = 50; CoefficientList[Series[((2 + x - x^2 - x^3 - x^4 + x^5) / ((1 - x)*(1 - x^2)*(1 - x^3))) * Product[1 + x^k, {k, 1, nmax}], {x, 0, nmax}], x]
Comments