I'm looking for program code to deal with cyclic quotient singularities on normal surfaces. In particular, at the moment I need that given a singularity $p$ like $p=\frac{1}{n}(1,a)$ the code computes:

- Its continuous fraction decomposition (i.e. $\frac{1}{n}(1,a)=[b_1,\ldots,b_k]$). Of course, the $b_i$ are the self-intersection numbers of the exceptional curves of the minimal resolution.
- The discrepancies of the resolution, i.e. if the minimal resolution of $p$ is $f:Y\rightarrow X$ and has exceptional curves $E_i$, then we can write $$f^*(K_X)=K_Y+\sum a_i E_i.$$ I want to find the values of $a_i$ automatically.

I know there is code written for 1. for instance in Magma or in several pages on the Internet, but I haven't seen any for the second one, and having asked around no one seem to know about it.

I know both things are pretty much automatic, for the second one we just need to intersect the above formula with each E_i, use the genus formula and resolve a linear system of equations. It should not be a difficult task (albeit a boring one) to write this code myself in Maple (which is the only mathematical language I've ever used) but I'd like to save myself the hassle and time. Moreover, I will most likely need to add code for other computations on top of this code. Code that maybe (let me dream), other people may useful in the future. I'd rather prefer to add something to an existing library than have several partial-functional libraries in different languages around.

Also, if no one knows about (2) but knows code or settings in Magma, Macaulay2... that deals easily with (1), please refer me to it and I'll build (2) over that.

Thanks!