%I #14 Jan 17 2021 11:57:17
%S 1,17,193,197,198,293,297,298,301,302,306,310,693,697,698,701,702,706,
%T 710,801,802,806,810,1013,1014,1018,1019,1041,1042,1046,1051,1052,
%U 1056,1061,1062,1066,1104,1105,1109,1173,1177,1178,1273,1277,1278,1673,1677,1678
%N Numbers that have the letter "n" in the middle of their names when written in American English.
%e oNe, seveNteen, onehundredNinetythree, ...
%t ok[n_] := Block[{s = StringReplace[IntegerName[n, "Words"], "," | " " | "\[Hyphen]" -> ""], m}, m = StringLength[s]; OddQ[m] && (m = (m + 1)/2; StringTake[s, {m, m}] == "n")]; Select[Range[5000], ok] (* _Giovanni Resta_, May 01 2017 *)
%o (Python)
%o from num2words import num2words
%o def middle(s): return s[len(s)//2] if len(s)%2 == 1 else None
%o def n2w(n):
%o map = {ord(c): None for c in "-, "}
%o return num2words(n).replace(" and", "").translate(map)
%o def aupto(nn): return [n for n in range(1, nn+1) if middle(n2w(n)) == 'n']
%o print(aupto(1678)) # _Michael S. Branicky_, Jan 17 2021
%Y Cf. A160659, A160660, A160661, A160662.
%K nonn,word,less
%O 1,2
%A _Claudio Meller_, May 22 2009
%E a(24)-a(47) from _Giovanni Resta_, May 01 2017
|