Rewrite dmp_ground_p() to be non-recursive
Rewrite dmp_ground_p() to be non-recursive

As before, this makes it faster:

Recursive:
In [23]: %timeit dmp_ground_p([[[[[[[[[[[[[[2]]]]]]]]]]]]]], 2, 13)
100000 loops, best of 3: 14.8 us per loop

Non-recursive:
In [3]: %timeit dmp_ground_p([[[[[[[[[[[[[[2]]]]]]]]]]]]]], 2, 13)
100000 loops, best of 3: 9.19 us per loop

Signed-off-by: Mateusz Paprocki <4e51c28eba28c1534bcc4a6bd2cccd314d8bf749@gmail.com>

atsao72/sympy,atreyv/sympy,hargup/sympy,beni55/sympy,mcdaniel67/sympy,mafiya69/sympy,kumarkrishna/sympy,Designist/sympy,shikil/sympy,Shaswat27/sympy,skidzo/sympy,pbrady/sympy,Designist/sympy,grevutiu-gabriel/sympy,Mitchkoens/sympy,Davidjohnwilson/sympy,shipci/sympy,Mitchkoens/sympy,kaushik94/sympy,maniteja123/sympy,shipci/sympy,maniteja123/sympy,cswiercz/sympy,kumarkrishna/sympy,VaibhavAgarwalVA/sympy,Designist/sympy,Gadal/sympy,Titan-C/sympy,lidavidm/sympy,cswiercz/sympy,beni55/sympy,kevalds51/sympy,sahmed95/sympy,sahmed95/sympy,srjoglekar246/sympy,Sumith1896/sympy,pbrady/sympy,kevalds51/sympy,sahilshekhawat/sympy,iamutkarshtiwari/sympy,minrk/sympy,pbrady/sympy,ChristinaZografou/sympy,Mitchkoens/sympy,AkademieOlympia/sympy,farhaanbukhsh/sympy,wanglongqi/sympy,drufat/sympy,meghana1995/sympy,Arafatk/sympy,bukzor/sympy,Shaswat27/sympy,garvitr/sympy,farhaanbukhsh/sympy,atreyv/sympy,abloomston/sympy,toolforger/sympy,yashsharan/sympy,beni55/sympy,Titan-C/sympy,oliverlee/sympy,souravsingh/sympy,atreyv/sympy,yukoba/sympy,aktech/sympy,yukoba/sympy,AkademieOlympia/sympy,madan96/sympy,kaushik94/sympy,Curious72/sympy,kaichogami/sympy,vipulroxx/sympy,kmacinnis/sympy,dqnykamp/sympy,iamutkarshtiwari/sympy,atsao72/sympy,flacjacket/sympy,jamesblunt/sympy,vipulroxx/sympy,sunny94/temp,lindsayad/sympy,asm666/sympy,abhiii5459/sympy,MridulS/sympy,MridulS/sympy,amitjamadagni/sympy,jerli/sympy,sunny94/temp,cccfran/sympy,liangjiaxing/sympy,souravsingh/sympy,Vishluck/sympy,jbbskinny/sympy,moble/sympy,kumarkrishna/sympy,rahuldan/sympy,Davidjohnwilson/sympy,mcdaniel67/sympy,oliverlee/sympy,jamesblunt/sympy,toolforger/sympy,Davidjohnwilson/sympy,abhiii5459/sympy,pandeyadarsh/sympy,skidzo/sympy,aktech/sympy,emon10005/sympy,bukzor/sympy,abloomston/sympy,jerli/sympy,mafiya69/sympy,jerli/sympy,AunShiLord/sympy,atsao72/sympy,VaibhavAgarwalVA/sympy,sampadsaha5/sympy,lidavidm/sympy,postvakje/sympy,ahhda/sympy,madan96/sympy,shipci/sympy,wyom/sympy,madan96/sympy,Curious72/sympy,farhaanbukhsh/sympy,mcdaniel67/sympy,oliverlee/sympy,lidavidm/sympy,sahilshekhawat/sympy,amitjamadagni/sympy,debugger22/sympy,yukoba/sympy,abloomston/sympy,pernici/sympy,Vishluck/sympy,chaffra/sympy,diofant/diofant,kmacinnis/sympy,wanglongqi/sympy,kaichogami/sympy,AkademieOlympia/sympy,kmacinnis/sympy,Sumith1896/sympy,bukzor/sympy,garvitr/sympy,ga7g08/sympy,wyom/sympy,kaichogami/sympy,ChristinaZografou/sympy,shikil/sympy,lindsayad/sympy,wyom/sympy,liangjiaxing/sympy,postvakje/sympy,MechCoder/sympy,cccfran/sympy,debugger22/sympy,Titan-C/sympy,postvakje/sympy,jaimahajan1997/sympy,dqnykamp/sympy,MridulS/sympy,jbbskinny/sympy,ChristinaZografou/sympy,lindsayad/sympy,ga7g08/sympy,sahmed95/sympy,yashsharan/sympy,grevutiu-gabriel/sympy,emon10005/sympy,cswiercz/sympy,hrashk/sympy,pandeyadarsh/sympy,asm666/sympy,aktech/sympy,ahhda/sympy,saurabhjn76/sympy,MechCoder/sympy,pandeyadarsh/sympy,moble/sympy,mafiya69/sympy,drufat/sympy,saurabhjn76/sympy,kaushik94/sympy,hargup/sympy,abhiii5459/sympy,dqnykamp/sympy,Arafatk/sympy,jaimahajan1997/sympy,jaimahajan1997/sympy,rahuldan/sympy,iamutkarshtiwari/sympy,MechCoder/sympy,cccfran/sympy,AunShiLord/sympy,hargup/sympy,shikil/sympy,meghana1995/sympy,ahhda/sympy,Sumith1896/sympy,hrashk/sympy,souravsingh/sympy,Curious72/sympy,sampadsaha5/sympy,meghana1995/sympy,saurabhjn76/sympy,hrashk/sympy,skirpichev/omg,jamesblunt/sympy,AunShiLord/sympy,liangjiaxing/sympy,garvitr/sympy,ga7g08/sympy,kevalds51/sympy,jbbskinny/sympy,Vishluck/sympy,emon10005/sympy,rahuldan/sympy,vipulroxx/sympy,sunny94/temp,sahilshekhawat/sympy,moble/sympy,skidzo/sympy,wanglongqi/sympy,toolforger/sympy,VaibhavAgarwalVA/sympy,Gadal/sympy,Shaswat27/sympy,asm666/sympy,grevutiu-gabriel/sympy,chaffra/sympy,maniteja123/sympy,minrk/sympy,yashsharan/sympy,Gadal/sympy,drufat/sympy,chaffra/sympy,Arafatk/sympy,sampadsaha5/sympy,debugger22/sympy