# Question:How do I add to the list in my procedure in Maple?

## Question:How do I add to the list in my procedure in Maple?

Maple 2020

THE ISSUE: It's returning a list of [1] when it should be returning [1,1,1,7]

##Find remainder##
rm := proc(a, b) local n; n := 0; while 0 <= b - n*a do n := n + 1; end do; b - (n - 1)*a; end proc;
rm := proc (a, b) local n; n := 0; while 0 <= b-n*a do n := n+1

end do; b-(n-1)*a end proc

rm(8, 3657);
1

rm(16, 12345);
9

##FINDING THE WHOLE NUMBER PORTION ##
whole := proc(a, b) local r, i; r := 0; i := 0; if a < b then r := rm(a, b); i := (b - r)/a; else 0; end if; end proc;
whole := proc (a, b) local r, i; r := 0; i := 0; if a < b then

r := rm(a, b); i := (b-r)/a else 0 end if end proc

whole(8, 3657);
457

whole(16, 12345);
771

j = whole(8, 3657);
j = 457

k = rm(8, 3657);
k = 1

L := [];
L := []

L := [op(L), rm(8, 8657)];
L := [1]

j = whole(8, 457);
j = 57

##GETTING THE LIST OF DIGITS (BEFORE REVERSING)##
HELPER := proc(a, b, L) local j; j := whole(a, b); [op(L), rm(a, b)]; if 0 < j then HELPER(a, j, L); else ; end if; L; end proc;
HELPER := proc (a, b, L) local j; j := whole(a, b); [op(L),

rm(a, b)]; if 0 < j then HELPER(a, j, L) else  end if; L end

proc

CNS := proc(a, b) HELPER(a, b, L); end proc;
CNS := proc (a, b) HELPER(a, b, L) end proc

CNS(8, 3657);
[1]

HELPER(8, 3657, L);
[1]

﻿