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.

A051839 Number of partitions of n with parts (with repetitions) forming a division lattice (i.e., closed under GCD and LCM).

This page as a plain text file.
%I A051839 #23 Aug 03 2017 00:56:52
%S A051839 1,2,3,5,6,10,11,16,19,26,27,41,42,55,64,81,83,113,115,149,165,197,
%T A051839 203,266,276,329,358,429,440,553,565,672,722,832,874,1060,1085,1252,
%U A051839 1342,1558,1603,1901,1955,2249,2410,2708,2805,3287,3394,3852,4078,4594,4756,5456,5668,6379,6738,7484,7767,8884
%N A051839 Number of partitions of n with parts (with repetitions) forming a division lattice (i.e., closed under GCD and LCM).
%e A051839 For n=6, the only one of the 11 partitions of 6 that fails is [3,2,1]; so a(6) = 10.
%p A051839 with(combinat): ans := []: b := []: for n to 30 do p := partition(n): np := nops(p): nn := np: print(n); for i to np do ss := convert(p[i],set):s := convert(ss,list): ns := nops(s): t := true:
%p A051839 for j to ns-1 do for k from j+1 to ns do if evalb(not(member(gcd(s[j],s[k]),s)) or not(member(lcm(s[j],s[k]),s))) then t := false: fi: od: od:
%p A051839 if t=false then nn := nn-1:fi od: ans := [op(ans),[n,np,nn]]: b := [op(b),[nn]]: od: print(ans); print(b); save b,ans,bans;
%t A051839 ok[partition_] := Module[{p = Flatten[ If[ Length[#] > 2, Take[#, 2], #] & /@ Split[partition]], m}, m = Length[p]; Do[ If[ ! MemberQ[p, GCD[p[[i]], p[[j]]]] || ! MemberQ[p, LCM[p[[i]], p[[j]]]], Return[False]], {i, 1, m-1}, {j, i+1, m}] =!= False]; a[n_] := Length[ Select[ IntegerPartitions[n], ok]]; Table[an = a[n]; Print[an]; an, {n, 1, 60}] (* _Jean-François Alcover_, Sep 21 2012 *)
%o A051839 (PARI) ok(v)=v=vecsort(Vec(v),,8); for(i=if(v[1]==1,2,1),#v-1,for(j=i+1,#v, if(!vecsearch(v, gcd(v[i],v[j])) || !vecsearch(v,lcm(v[i],v[j])), return(0))));1
%o A051839 a(n)=my(P=partitions(n));sum(i=1,#P,ok(P[i])) \\ _Charles R Greathouse IV_, Sep 21 2012
%o A051839 (Sage)
%o A051839 def A051839(n):
%o A051839     def closed(P):
%o A051839         S = Set(iter(P))
%o A051839         for p in S.subsets(2):
%o A051839             if not lcm(p) in S or not gcd(p) in S: return false
%o A051839         return true
%o A051839     count = 0
%o A051839     for p in Partitions(n):
%o A051839         if closed(p): count += 1
%o A051839     return count
%o A051839 # _Peter Luschny_, Sep 21 2012
%K A051839 nonn,nice
%O A051839 1,2
%A A051839 John McKay (mckay(AT)cs.concordia.ca), Dec 13 1999
%E A051839 More terms from Antonio G. Astudillo (afg_astudillo(AT)lycos.com), Apr 05 2003
%E A051839 a(46)-a(60) from _Charles R Greathouse IV_, Sep 21 2012