Numbers k such that the last letter of k is the same as the first letter of k+1: Difference between revisions
Numbers k such that the last letter of k is the same as the first letter of k+1 (view source)
Revision as of 20:30, 1 July 2023
, 11 months ago→{{header|Python}}
Line 553:
from num2words import num2words
firstcache, lastcache = [s[0] for s in spelledcache], [s[-1] for s in spelledcache]
def
if n == 0:
▲ groups = []
while n > 0:
n,
return
▲ return groups
def lastletter(n):
return lastcache[n % 1000] if n % 1000 > 0 else 'o' if n == 0
def qualifies(n):
|