Kumba numbers P90371


Statement
 

pdf   zip

0.7 The highest peak of the Montserrat mountains is Sant Jeroni, with an elevation of 1236 meters. Inspired by this nice number, we will say that a natural number nn is a kumba number if

0.3

  • nn is divisible by 2 and by 3,

  • the factorization of the product of the digits of nn only has 2s and 3s.

For instance, 1236 is a kumba number. Note that 0 cannot be factorized.

Given \ell and rr, can you compute how many kumba numbers belong to [,r][\ell, r]?

Input

Input consists of several cases, each with \ell and rr. Assume 1r10121 \le \ell \le r \le 10^{12}.

Output

For every case, print the number of kumba numbers in [,r][\ell, r].

Public test cases
  • Input

    1236 1236
    23 42
    1000 1000000
    1 1000000000000
    

    Output

    1
    3
    26067
    3075841596
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++