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

J draft
(J draft)
Line 34:
* [[Number names]]
<br>
=={{header|J}}==
 
Using [[Number names#J|Number names]], we can generate a sample of the desired numbers which (in this example) are smaller than a million:
 
<syntaxhighlight lang=J> #sample=: I.({.=1|.!.' '{:)|:({.,{:)@us"0 i.1e6
91403
5 10$sample NB. first fifty
1 8 9 11 27 37 80 82 84 88
96 101 121 131 141 151 161 171 181 191
207 227 237 247 257 267 277 287 297 307
327 337 347 357 367 377 387 397 800 802
804 808 811 820 822 824 828 830 832 834
(],. sample {~ <:) 1e3 1e4 NB. 1000th and 10000th
1000 10967
10000 106631
(~.,.#/.~) /:~10|1e3{.sample NB. counts by final digit
0 111
1 112
2 111
3 11
4 111
5 11
6 111
7 298
8 112
9 12
(~.,.#/.~) /:~10|1e4{.sample NB. counts by final digit
0 1301
1 829
2 1301
3 121
4 1301
5 121
6 1211
7 2391
8 1302
9 122</syntaxhighlight>
 
=={{header|Wren}}==
{{libheader|Wren-fmt}}
6,962

edits