How many integers contain a number in a specific range
Bash, 20 bytes
the obvious answer
seq $2 $3|grep -c $1
example
$ bash golf 3 1 100
19
05AB1E, 6 bytes
Input in the form: upper bound, lower bound, number.
Ÿvy³åO
Explanation:
Ÿ # Inclusive range, [a, ..., b]
vy # For each element...
³å # Check if the third input is a substring of the number
O # Sum up the results
Uses the CP-1252 encoding. Try it online!
Perl, 20 bytes
Saved 2 bytes by using grep
as in @ardnew's answer.
Bytecount includes 18 bytes of code and -ap
flags.
$_=grep/@F/,<>..<>
Give the 3 numbers on three separate lines :
perl -ape '$_=grep/@F/,<>..<>' <<< "3
1
100"