login
Lexicographically earliest sequence of distinct nonnegative terms such that the last digit of a(n) is present in a(n+1) and the last letter of the English name of a(n) is present in the English name of a(n+1).
6

%I #18 Feb 18 2024 12:15:13

%S 0,40,20,30,50,60,70,80,90,120,130,140,150,160,170,180,190,220,230,

%T 240,250,260,270,280,290,320,330,340,350,360,370,380,390,420,430,440,

%U 450,460,470,480,490,520,530,540,550,560,570,580,590,620,630,640,650,660,670,680,690,720,730,740,750,760,770,780

%N Lexicographically earliest sequence of distinct nonnegative terms such that the last digit of a(n) is present in a(n+1) and the last letter of the English name of a(n) is present in the English name of a(n+1).

%C When will the first integer not ending in zero appear?

%C Answer: a(83) = 1021. - _Michael S. Branicky_, Feb 18 2024

%H Michael S. Branicky, <a href="/A370402/b370402.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2024/02/talking-to-me.html">Talking to me?</a>, personal blog, Feb 2024.

%e 0 zero, 40 forty, 20 twenty, 30 thirty, 50 fifty, 60 sixty, 70 seventy, 80 eighty, 90 ninety, 120 one hundred twenty, 130 one hundred thirty, 140 one hundred forty, 150 one hundred fifty, 160 one hundred sixty, 170 one hundred seventy, etc.

%t a[1]=0;a[n_]:=a[n]=(k=1;While[MemberQ[Array[a,n-1],k]|| FreeQ[IntegerDigits@k,Mod[a[n-1],10]]|| !StringContainsQ[IntegerName[k,"Words"],Last@Characters@IntegerName[a[n-1],"Words"]],k++];k);Array[a,64]

%o (Python)

%o from num2words import num2words

%o from itertools import count, islice

%o def name(n): return num2words(n).replace(" and","")

%o def agen(): # generator of terms

%o an, aset, mink = 0, set(), 1

%o while True:

%o yield an

%o aset.add(an)

%o t1, t2, k = str(an%10), name(an)[-1], mink

%o an = next(k for k in count(mink) if k not in aset and t1 in str(k) and t2 in name(k))

%o while mink in aset: mink += 1

%o print(list(islice(agen(), 64))) # _Michael S. Branicky_, Feb 18 2024

%Y Cf. A370400, A370401, A370403, A370404, A370405.

%K base,nonn,word

%O 1,2

%A _Eric Angelini_ and _Giorgos Kalogeropoulos_, Feb 17 2024