Date: Thu, 26 Jul 2007 22:19:12 +0200 From: Richard Mathar (mathar(AT)strw.leidenuniv.nl) Maple code for A092931 # return list of lists with non-ordered factorizations. # example: n=6 returns [[2,3],[6]] # example: n=8 returns [[2,2,2],[2,4],[8]] # example: n=9 returns [[3,3],[9]] # example: n=17 returns [[17]] # 'n' is the number to be factored, # 'minF' is the minimium divisor which is a guard keeper that we do not # return all ordered factorizations. Example: If n=8 and we have already split off # the factor 4, we do not allow the 2 to show up as another factor, because # this has already been dealt with while handling the divisor 2. facts := proc(n,minF) local dvs,i,d,rst,chi,resul,c ; dvs := numtheory[divisors](n) minus {1} ; dvs := convert(dvs,list) ; resul := [] ; if nops(dvs) = 1 then if op(1,dvs) >= minF then resul := [dvs] ; fi ; RETURN(resul) ; fi ; # Grap for i from 1 to nops(dvs) do d := op(i,dvs) ; if d >= minF then rst := n/d ; if rst >= minF then chi := facts(rst, max(minF,d) ) ; for c from 1 to nops(chi) do resul := [op(resul),[d,op(op(c,chi))]] ; od ; elif rst = 1 then resul := [op(resul),[d]] ; fi ; fi ; od ; RETURN(resul) ; end: A092931 := proc(n) local a,ifs,i,f; # get the list of all factorizations ifs := facts(n,2) ; a := 0 ; # for each factorization check the sum of the factors for divisibility for f in ifs do if n mod add(i,i=f) = 0 then a := a+1 ; fi ; od ; RETURN(a) ; end: # this for b-file: each line n and the A092931(n) for n from 1 to 10000 do printf("%d %d\n",n,A092931(n)) ; od; #--- # Richard J Mathar Tel (+31) (0) 71 527 8459 # Sterrewacht Universiteit Leiden Fax (+31) (0) 71 527 5819 # Postbus 9513 # 2300 RA Leiden # The Netherlands URL http://www.strw.leidenuniv.nl/~mathar # office: Niels Bohrweg 2, 2333 CA Leiden, #456