# Kumba numbers

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 $n$ is a *kumba number* if

0.3

::: center
![image](sant-jeroni.eps){width="4.2cm"}
:::

- $n$ is divisible by 2 and by 3,

- the factorization of the product of the digits of $n$ only has 2s and
  3s.

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

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

## Input

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

## Output

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

## Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:51:05.671Z

© *Jutge.org*, 2006--2026.\
<https://jutge.org>
