generics the sequence_number existence test
refactor powm to Math
remove inline javascript doc fragments; switch to js reference implementation references

* switch to references to javascript reference code