OFFSET
1,2
MAPLE
# Comma Successor in Maple in base "bas", from N. J. A. Sloane, Dec 06 2023
bas := 3;
Ldigit:=proc(n) local v; v:=convert(n, base, bas); v[-1]; end; # Returns leading digit
# Return comma-successor to a or -1 if no successor exists
commsucc := proc(a) local f, i, d;
f := (a mod bas);
d:=bas*f;
for i from 1 to bas-1 do
d := d+1;
if Ldigit(a+d) = i then return(a+d); fi;
od:
return(-1);
end;
a:=[1]; s:=1; for n from 1 to 16 do s:=commsucc(s); a:=[op(a), s]; od: a;
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
N. J. A. Sloane, Nov 18 2023
STATUS
approved