P27832 [洛谷] [Information and Future 2021] Lucky Numbers
普及-
题目描述

Problem Description

A positive integer $n$ is considered a lucky number if it does not contain the digit $0$ when represented in base 5, base 7, and base 9. For example:

  • $(987)_{10} = (12422)_5 = (2610)_7 = (1316)_9$, thus $n = 987$ is not a lucky number.

  • $(988)_{10} = (12423)_5 = (2611)_7 = (1317)_9$, thus $n = 988$ is a lucky number.

Write a program to find out how many lucky numbers are there between $a$ and $b$ inclusive.

Input Format

Input consists of two positive integers $a$ and $b$ on a single line.

Output Format

Output a single line indicating the number of lucky numbers between $a$ and $b$ inclusive.

Sample Input and Output

Sample Input #1

100 1000

Sample Output #1

203

Sample Input #2

900 4096

Sample Output #2

389

Notes

For $40\%$ of the test cases, $1 \leq a \leq b \leq 10^3$.

For $100\%$ of the test cases, $1 \leq a \leq b \leq 10^6$.

The original full score for this problem was $15\text{pts}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
100 1000
样例输出
203