Colorful numbers: Difference between revisions
m
→{{header|Rust}}: formatting
m (→{{header|Rust}}: formatting) |
|||
Line 2,195:
fn is_colorful(n: u64) -> bool {
if &n > &
let dig: Vec<u64> = to_digits(n, 10);
if dig.contains(&1) || dig.contains(&0) {
Line 2,236:
let mut n: u64;
for i in 0..8 {
let j: u64 = { if i == 0 { 0 } else { 10_u64.pow(i)
let k: u64 = 10_u64.pow(i + 1) - 1;
n = 0;
Line 2,254:
<pre>
Colorful numbers for 1:25, 26:50, 51:75, and 76:100:
1 2 3 4 5 6 7 8 9
26 27 28 29 32 34 35 36 37 38 39 42 43 45 46 47 48 49
52 53 54 56 57 58 59 62 63 64 65 67 68 69 72 73 74 75
76 78 79 82 83 84 85 86 87 89 92 93 94 95 96 97 98
The count of colorful numbers within the interval
The count of colorful numbers within the interval
The count of colorful numbers within the interval
The count of colorful numbers within the interval
The count of colorful numbers within the interval
The count of colorful numbers within the interval
The count of colorful numbers within the interval
The largest possible colorful number is 98746253.
The total number of colorful numbers is 57256.
|