SM-5-Exercise8

4133 days ago by dmanna

#Stirling number of the second kind #defined from sum def S(n,k): sum = 0 for j in range(k+1): sum = sum + (-1)^(k-j)*binomial(k,j)*j^n sum = sum/factorial(k) return sum 
       
# p-adic valuation of an integer n def nu(p,n): out=oo if n!=0: out=0 while n%p==0: out=out+1 n=n/p return out 
       
#creating a list-type sequence of the first N p-adic valuations of {S_{n,k} n>=k} for given fixed k def Seq(p,k,N): list=[] for j in range(N): list.append(nu(p,S(k+j,k))) return list 
       
#creates a plot of the previous sequence. I have the options set to connect the dots and make the plot black. def PlotSeq(p,k,N): return list_plot(Seq(p,k,N),plotjoined=True,rgbcolor=(0,0,0)) 
       
#A few examples PlotSeq(2,7,100) 
       
PlotSeq(2,6,100) 
       
PlotSeq(2,195,200) 
       
PlotSeq(7,144,500)