I'm probably misunderstanding something, because my results vary slightly from yours. Here's what I think you described:
perfectNumber = PerfectNumber[2];
Length[Intersection[Divisors[10^IntegerLength[perfectNumber]], #]] & /@
Divisors /@ DeleteCases[NumberExpand[perfectNumber], 0]
(* {6, 3} *)
If we bundle this into a function, we can use it repeatedly.
FancyFunction[n_] :=
With[
{perf = PerfectNumber[n]},
Length[Intersection[Divisors[10^IntegerLength[perf]], #]] & /@
Divisors /@ DeleteCases[NumberExpand[perf], 0]];
FancyFunction[1]
(* {2} , which is different from your results*)
FancyFunction[2]
(* {6, 3} *)
FancyFunction[3]
(* {12, 4, 2} *)
FancyFunction[4]
(* {20, 9, 6, 4} , another deviation from your results *)
FancyFunction[5]
(* {64, 49, 42, 30, 9, 4, 2} *)
FancyFunction[6]
(* {110, 90, 88, 49, 54, 30, 16, 6, 2} *)