Nice... I'll give this 10/10 since the author stated 'I think, but I've forgotten' in the description! ;)
Never seen that one before! :D
Dabz
Never seen that one before! :D
Dabz
| This function calculates the factors of any number you pass to it. It then stores the numbers in a memory bank (I think, I've had it so long I've forgotten how to use it) whick you peekint (is that in B+?) or equivalent to retrive. |
Global FCBnk Function factor (Num) DebugLog"Factor calculating function called" FCBnk=CreateBank (1024) Fact2=1 Repeat Rep=Rep+1 Fact=Fact+1 ;Detect need for change in second number If Fact=num Then Fact2=Fact2+1 Fact=1 EndIf DebugLog "Checking For Factor, "+Fact+" * "+Fact2 ;Detect factor Test=Fact*Fact2 If Test=Num Then PokeInt FCBnk,Ofst,Fact DebugLog "Factor Calculated,"+Fact ofst=ofst+3 EndIf Until (Test=Num And Fact=1) DebugLog"Factor of 1 reached, end computation." End Function |