[seqfan] checking A179385 (parts equal to 1 in restricted partitions of n)
Richard Mathar
mathar at strw.leidenuniv.nl
Wed Jul 14 16:09:30 CEST 2010
I am unable to reproduce http://oeis.org/classic/A179385
(count of parts equal to 1 in all partitions of n, all parts
either 1 or prime, and no repeated prime in any partition)
but get instead
1, 2, 4, 7, 10, 15, 20, 27, 35, 44, 55, 67, 81, 97, 115, 135, 158, 183, 212,
244, 280, 320, 364, 413, 467, 526, 591, 661, 737, 820, 909, 1007, 1112,
1226, 1349
Can someone confirm/check this modification?
A179385 := proc(n)
local p,a ;
ps := combinat[partition](n) ;
# the number to be returned
a := 0 ;
# loop over all possible partitions of n
for p in ps do
# set of all the primes seen so far in the partition
pbag := {} ;
# flag to indicate that this is a valid partition
wrks := true ;
# loop over the parts in that partition
for c in p do
# reject partition with composites
if c >1 and not isprime(c) then
wrks := false;
end if;
# reject partition with repeated primes
if c >1 and c in pbag then
wrks := false;
end if;
# put the 1s and primes into the bag to remember
pbag := pbag union {c} ;
end do:
# that's an allowed parition: add all its 1's to the result
if wrks then
for c in p do
if c =1 then
a := a+1 ;
end if;
end do:
end if;
end do:
a ;
end proc:
seq(A179385(n),n=1..35) ;
More information about the SeqFan
mailing list