Numbers k such that the last letter of k is the same as the first letter of k+1: Difference between revisions

m
→‎{{header|Python}}: cleanuup unneeded
(Python example)
m (→‎{{header|Python}}: cleanuup unneeded)
Line 330:
except for numbers > 1000 which are divisible by 1000 """
groups = []
if n < 1: # exception for zero, return array containing zero
return [n]
while n > 0:
n, r = divmod(n, 1000)
Line 344 ⟶ 342:
 
def lastletter(n):
return num2words(n)[-1] if n > 1000 and n % 1000 == 0 \else spelledcache[nonzerogroupings(n)[0]][-1]
else spelledcache[nonzerogroupings(n)[0]][-1]
 
def qualifies(n):
4,105

edits