Running this code in pythonista causes the app to crash entirely... It's related to the bug in my code (after d=0 I should return d, if I add in that line then it works a charm). It's funny that an app so stable might have one tiny little circumstance which would probably never happen... I'd be interested in hearing about what in the app's code caused this bug :D
Edited to use a gist cos otherwise a distinct lack of tabulation occurs.
When I run that code, I get a RuntimeError ("maximum recursion depth exceeded"), but it doesn't crash. What kind of device are you using?
You get the crash because you're creating an infinite recursion - dPrev starts as none and hits the part where it calls numDigitsDec(n-1).
It never gets out without that return, it just goes deeper and deeper.
Pythonista is likely crashing because you're hitting the memory limits of an iOS app on your device before Pythonista reached maximum stack recursion depth.
The standard depth is around 1000 levels. You're just hitting RAM limits before that.
My guess is you're on an iPod Touch.
I was running that on an iPad 3.
I have just restarted my iPad (to free up memory) but it still crashed when I ran it. I checked sys.getrecursionlimit() and it gives me 256, so not excessively high...