[seqfan] Re: A122036

Richard Mathar mathar at strw.leidenuniv.nl
Mon Mar 28 15:37:18 CEST 2011

```This is the Maple function that checks entries in A122036;
hastily commented, hazardous if swallowed with an empty stomach etc:

# This function checks whether the argument n is a member of A005231
# it is if the sigma function of the argument is larger than 2n.
isA005231 := proc(n)
is(numtheory[sigma](n) > 2*n );
end proc:

# recursive function which tests whether n can be written as a sum
# over a subset of elements of the set s
isA136446a := proc(s, n)
if n in s then
# if n is a member of s, the answer is yes (just take n)
return true;
elif add(i, i=s) < n then
# if the sum over all elements of s is smaller than n,
return false;
elif nops(s) = 1 then
# if there is exactly one element in s, the answer is yes
# if that element equals n, otherwise the anise is no
is(op(1, s)=n) ;
else
# Put the set s in a sorted state
sl := sort(convert(s, list), `>`) ;
for i from 1 to nops(sl) do
# assume that the maximum element of the subset that adds to n
# is m and take m in decreasing order from the sorted list.
m := op(i, sl) ;
if n -m = 0 then return
# if taking m exactly matches n, the answer is yes
# (this is probably redundant as a check, see above)
true;
end if ;
# If that largest m in the subset is not larger than n,
# try to find other elements to complete n
if n-m > 0 then
# the recursive call: define the subset of elements
# which are each smaller than n
sr := [op(i+1..nops(sl), sl)] ;
# .. and test whether (assuming m is taken) the remainder n-m
# can be matched by another subset
if procname(convert(sr, set), n-m) then
return true;
end if;
end if;
end do;
return false;
end if;
end proc:

# test whether the argument n is a member o fA136446
# return true if yes
isA136446 := proc(n)
# this is done by taking the set of divisors without 1 and n,
# testing whether n can be written as a sum of a subset of these
isA136446a( numtheory[divisors](n) minus {1, n}, n) ;
end proc:

# Main loop over all odd n
for n from 1 by 2 do
#if n is in A005231 then check whether it is in A136446
if isA005231(n) then
if not isA136446(n) then
printf("%d,\n",n) ;
end if;
end if;
# print progress bars
if n mod 150000 = 1 then
printf("%d,...\n",n);
end if;
end do:

```