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.

A192274 Numbers which are both Zumkeller numbers and anti-Zumkeller numbers.

This page as a plain text file.
%I A192274 #34 Nov 27 2024 18:26:13
%S A192274 42,70,78,88,126,160,176,228,234,258,270,280,308,342,350,368,378,380,
%T A192274 390,396,402,438,448,462,468,490,500,522,532,540,552,558,560,572,580,
%U A192274 588,608,618,620,630,644,650,690,702,732,756,770,780,798,812,822,852,858
%N A192274 Numbers which are both Zumkeller numbers and anti-Zumkeller numbers.
%C A192274 Numbers n whose sets of divisors and anti-divisors can each be partitioned into two disjoint sets whose sums are sigma(n)/2 for the sets in the divisors partition and sigma*(n)/2 for the anti-divisors partition, where sigma*(n) is the sum of the anti-divisors of n.
%H A192274 Chai Wah Wu, <a href="/A192274/b192274.txt">Table of n, a(n) for n = 1..10000</a>
%e A192274 270-> divisors: 1,2,3,5,6,9,10,15,18,27,30,45,54,90,135,270; sigma(270)/2=360; 1+2+3+5+6+9+10+15+18+27+30+45+54+135=90+270=360.
%e A192274 270-> anti-divisors: 4,7,11,12,20,36,49,60,77,108,180; sigma*(270)/2=282; 4+7+11+20+60+180=12+36+49+77+108=282.
%p A192274 with(combstruct);
%p A192274 with(numtheory);
%p A192274 P:=proc(i)
%p A192274 local S,R,Stop,Comb,a,b,c,d,k,m,n,s;
%p A192274 for n from 3 to i do
%p A192274   a:={};
%p A192274   for k from 2 to n-1 do if abs((n mod k)- k/2) < 1 then a:=a union {k}; fi; od;
%p A192274   b:=nops(a); c:=op(a); s:=0;
%p A192274    if b>1 then for k from 1 to b do s:=s+c[k]; od;
%p A192274    else s:=c;
%p A192274   fi;
%p A192274   if (modp(s,2)=0 and 2*n<=s) then
%p A192274      S:=1/2*s-n; R:=select(m->m<=S,[c]); Stop:=false; Comb:=iterstructs(Combination(R));
%p A192274      while not (finished(Comb) or Stop) do Stop:=add(d,d=nextstruct(Comb))=S; od;
%p A192274      if Stop then
%p A192274         s:=sigma(n);
%p A192274         if (modp(s,2)=0 and 2*n<=s) then
%p A192274           S:=1/2*s-n; R:=select(m->m<=S,divisors(n)); Stop:=false;       Comb:=iterstructs(Combination(R));
%p A192274           while not (finished(Comb) or Stop) do Stop:=add(d,d=nextstruct(Comb))=S; od;
%p A192274           if Stop then print(n); fi;
%p A192274         fi;
%p A192274      fi;
%p A192274   fi;
%p A192274 od;
%p A192274 end:
%p A192274 P(10000);
%o A192274 (Python)
%o A192274 from sympy import divisors
%o A192274 from sympy.combinatorics.subsets import Subset
%o A192274 def antidivisors(n):
%o A192274     return [2*d for d in divisors(n) if n > 2*d and n % (2*d)] + \
%o A192274            [d for d in divisors(2*n-1) if n > d >=2 and n % d] + \
%o A192274            [d for d in divisors(2*n+1) if n > d >=2 and n % d]
%o A192274 for n in range(1, 10**3):
%o A192274     d = divisors(n)
%o A192274     s = sum(d)
%o A192274     if not s % 2 and max(d) <= s/2:
%o A192274         for x in range(1, 2**len(d)):
%o A192274             if sum(Subset.unrank_binary(x, d).subset) == s/2:
%o A192274                 d = antidivisors(n)
%o A192274                 s = sum(d)
%o A192274                 if not s % 2 and max(d) <= s/2:
%o A192274                     for x in range(1, 2**len(d)):
%o A192274                         if sum(Subset.unrank_binary(x, d).subset) == s/2:
%o A192274                             print(n, end=', ')
%o A192274                             break
%o A192274                 break
%o A192274 # _Chai Wah Wu_, Aug 14 2014
%o A192274 (Python)
%o A192274 from sympy import divisors
%o A192274 import numpy as np
%o A192274 A192274 = []
%o A192274 for n in range(3,10**3):
%o A192274     d = divisors(n)
%o A192274     s = sum(d)
%o A192274     if not s % 2 and 2*n <= s:
%o A192274         d.remove(n)
%o A192274         s2, ld = int(s/2-n), len(d)
%o A192274         z = np.zeros((ld+1,s2+1),dtype=int)
%o A192274         for i in range(1,ld+1):
%o A192274             y = min(d[i-1],s2+1)
%o A192274             z[i,range(y)] = z[i-1,range(y)]
%o A192274             z[i,range(y,s2+1)] = np.maximum(z[i-1,range(y,s2+1)],z[i-1,range(0,s2+1-y)]+y)
%o A192274             if z[i,s2] == s2:
%o A192274                 d2 = [2*x for x in d if n > 2*x and n % (2*x)] + \
%o A192274                 [x for x in divisors(2*n-1) if n > x >=2 and n % x] + \
%o A192274                 [x for x in divisors(2*n+1) if n > x >=2 and n % x]
%o A192274                 s, dmax = sum(d2), max(d2)
%o A192274                 if not s % 2 and 2*dmax <= s:
%o A192274                     d2.remove(dmax)
%o A192274                     s2, ld = int(s/2-dmax), len(d2)
%o A192274                     z = np.zeros((ld+1,s2+1),dtype=int)
%o A192274                     for i in range(1,ld+1):
%o A192274                         y = min(d2[i-1],s2+1)
%o A192274                         z[i,range(y)] = z[i-1,range(y)]
%o A192274                         z[i,range(y,s2+1)] = np.maximum(z[i-1,range(y,s2+1)],z[i-1,range(0,s2+1-y)]+y)
%o A192274                         if z[i,s2] == s2:
%o A192274                             A192274.append(n)
%o A192274                         break
%o A192274                 break
%o A192274 # _Chai Wah Wu_, Aug 19 2014
%Y A192274 Cf. A083207, A066272, A192273.
%K A192274 nonn
%O A192274 1,1
%A A192274 _Paolo P. Lava_, Jun 28 2011
%E A192274 Corrected entries and comment by _Chai Wah Wu_, Aug 13 2014