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

m
→‎{{header|Julia}}: refine histograms
m (→‎{{header|Julia}}: refine histograms)
Line 82:
ncount = 0
lastdigits = UInt8[]
println("First 50 qualifying numbers:")
for n in 0:typemax(Int32)
if qualifies(n)
Line 92:
println("\nThe $(spell(ncount))th number is $(format(n, commas = true)).")
println("Breakdown by last digit of the qualifiers up to this:")
display(histogram(lastdigits, nbins=10))
println()
ncount == 1_000_000 && break
Line 103:
</syntaxhighlight>{{out}}
<pre>
First 50 qualifying numbers:
0 18 28 38 79 81 83 85 97 102
122 132 142 152 162 172 182 192 208 228
Line 146:
The one hundred thousandth number is 1,095,542.
Breakdown by last digit of the qualifiers up to this:
┌ ┐
[ 0.0, 0 1.50) ┤█▋ 1 122
[0.5, 1.0) ┤, 2.0) ┤████████████████▊ 11 301
[ 2.0, 2 3.50) ┤████████████████████████████▎ 18 829
[1.0, 1.5) ┤████████████████▊ 11 301
[1 3.50, 2 4.0) ┤ 0 ┤████████████████▊ 11 301
[ 4.0, 4. 5.0) ┤█▋ 1 121
[2.0, 2.5) ┤████████████████████████████▎ 18 829
[2 5.50, 3 6.0) ┤ 0 ┤████████████████▊ 11 301
[3 6.0, 3 7.50) ┤████████████████▊┤█▋ 1 121 11 301
[3 7.50, 4 8.0) ┤ 0 ┤████████████████▊ 11 211
[ 8.0, 8 9.50) ┤████████████████████████████████ 21 392
[4.0, 4.5) ┤█▋ 1 121
[4 9.50, 510.0) ┤ 0 ┤████████████████▊ 11 301
└ ┘
[5.0, 5.5) ┤████████████████▊ 11 301
[5.5, 6.0) ┤ 0 Frequency
[6.0, 6.5) ┤█▋ 1 121
[6.5, 7.0) ┤ 0
[7.0, 7.5) ┤████████████████▊ 11 211
[7.5, 8.0) ┤ 0
[8.0, 8.5) ┤████████████████████████████████ 21 392
[8.5, 9.0) ┤ 0
[9.0, 9.5) ┤████████████████▊ 11 301
└ ┘
Frequency
 
 
The one millionth number is 10,984,428.
Breakdown by last digit of the qualifiers up to this:
┌ ┐
[ 0.0, 0 1.50) ┤█▎ 11 123
[0.5, 1.0) ┤, 2.0) ┤███████████▌ 111 301
[1 2.0, 1 3.50) ┤███████████▌┤███████████▍ 111110 301230
[1 3.50, 2 4.0) ┤ 0 ┤███████████▌ 111 301
[2 4.0, 2. 5.0) ┤███████████▍┤█▎ 11 121 110 230
[2 5.50, 3 6.0) ┤ 0 ┤███████████▌ 111 301
[3 6.0, 3 7.50) ┤███████████▌┤█▎ 11 121 111 301
[3 7.50, 4 8.0) ┤ 0 ┤███████████▌ 111 211
[ 8.0, 8 9.50) ┤███████████████████████████████ 299 990
[4.0, 4.5) ┤█▎ 11 121
[4 9.50, 510.0) ┤ 0 ┤███████████▌ 111 301
[5.0, 5.5) ┤███████████▌ 111 301
[5.5, 6.0) ┤ 0 Frequency
[6.0, 6.5) ┤█▎ 11 121
[6.5, 7.0) ┤ 0
[7.0, 7.5) ┤███████████▌ 111 211
[7.5, 8.0) ┤ 0
[8.0, 8.5) ┤███████████████████████████████ 299 990
[8.5, 9.0) ┤ 0
[9.0, 9.5) ┤███████████▌ 111 301
└ ┘
Frequency
 
</pre>
 
 
=={{header|Wren}}==
4,107

edits