A344338 Smallest number that is the sum of two or more consecutive positive n-th powers in more than one way.
9, 365, 33075
Offset: 1
Examples
9 = 2 + 3 + 4 = 4 + 5. 365 = 10^2 + 11^2 + 12^2 = 13^2 + 14^2. 33075 = 11^3 + 12^3 + 13^3 + 14^3 + 15^3 + 16^3 + 17^3 + 18^3 + 19^3 = 15^3 + 16^3 + 17^3 + 18^3 + 19^3 + 20^3.
Programs
-
Python
N=3 # <== Adapt here import heapq sigma=1+2**N h=[(sigma,1,2)] nextcount=3 oldv,olds,oldl=0,0,0 while True: (v,s,l)=heapq.heappop(h) if v==oldv: break if v>=sigma: sigma += nextcount**N heapq.heappush(h, (sigma,1,nextcount)) nextcount+=1 oldv,olds,oldl = v,s,l v-=s**N ; s+=1 ; l+=1 ; v+=l**N heapq.heappush(h,(v,s,l)) print("a(%d) = %d = sum(i^%d, i=%d..%d) = sum(i^%d, i=%d..%d)"% (N,v,N,olds,oldl,N,s,l)) # Bert Dobbelaere, May 16 2021
Comments