After programming a simple program that calculates all prime factors of a number and a program that calculates all divisors of a number (by checking for each number beneath the square root of the number wether it divides it without decimals), I realised you could use a number's prime factors to calculate it's divisors. I then programmed this monstrosity using 5 lists in total and which doesn't work:

```
PROGRAM:AAA
:ClrHome
:DelVar L2
:DelVar L3
:0->C
:5->D
:Input "WHOLE POSITIVE: ",A
:Disp "CALCULATING..."
:While .5A=int(.5A)
:C+1->C
:.5A->A
:2->L3(C)
:End
:Lbl A
:D-2->D
:For(B,D,A^.5,2)
:D+2->D
:While A/B=int(A/B)
:C+1->C
:A/B->A
:B->L3(C)
:Goto A
:End
:End
:C+1->C
:A->L3(C)
:1->E
:0->F
:DelVar LA
:For(C,2,dim(L3))
:1->LA(E)
:If L3(C-1)=L3(C)
:Then
:F+1->F
:Else
:LA(E)+F->LA(E)
:E+1->E
:0->F
:End
:End
:F+1->LA(E)
:DelVar LB
:For(C,1,dim(LA))
:L3(sum(LA,1,C))->LB(C)
:End
:1->A
:0->E
:LA->LC
:Lbl B
:1->D
:If LC(A)=-1
:Then
:If A=dim(LA)
:Goto C
:A+1->A
:Goto B
:Else
:For(B,1,A-1)
:LA(B)->LC(B)
:End
:LC(A)-1->LC(A)
:For(C,1,dim(LA))
:DLB(C)^LC(C)->D
:End
:E+1->E
:D->L2(E)
:1->A
:Goto B
:End
:Lbl C
:Disp "FACTORS IN L3","DIVISORS IN L2","AMOUNT:",dim(L2)
:Pause
:ClrHome
```

Running the program for A=500 gives the following lists:

LA: {2 3}

LB: {2 5}

LC: {-1 -1}

L3: {2 2 5 5 5}

L2: {250 125 62.5 100 50 25 12.5 20 10 5 2.5 4 2 1 .5 .8 .4 .2 .1}

Which is really like it should be, except for L2. I've gone through the process step by step and I can't find why it should give L2 the way it does. If anyone can point out where I've gone wrong with this I'd appreciate it.