Go: package main

import (
	"bufio"
	"os"
		"strings"
	"strconv"
			"fmt"
	)

var scanner = bufio.NewScanner(os.Stdin)
const (
	MAX = 1000000
)
func main() {
	a := make([]int, MAX+1)
	a[1] = 1
	for i := 2; i <= MAX; i *= 2 {
		a[i]++
	}
	for i := 1; i <= MAX; i++ {
		if a[i] != 0 {
			for j := i*3; j <= MAX; j *= 3 {
				if a[j] == 0 {
					a[j]++
				}
			}
		}
	}
	for i := 1; i <= MAX; i++ {
		if a[i] != 0 {
			for j := i*5; j <= MAX; j *= 3 {
				if a[j] == 0 {
					a[j]++
				}
			}
		}
	}
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		m, _ := strconv.Atoi(buf[0])
		if m == 0 {
			break
		}
		n, _ := strconv.Atoi(buf[1])
		cnt := 0
		for i := m; i <= n; i++ {
			if a[i] != 0 {
				cnt++
			}
		}
		fmt.Println(cnt)
	}
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>

#define MAX 1000001

using namespace std;

int main(){
  bool p[MAX];
  memset(p, 0, sizeof(p));
  
  for(int i = 1 ; i < MAX ; i++){
    int tmp = i;
    bool flag = true;
    while(tmp != 1){
      if(tmp % 2 == 0) tmp /= 2;
      else if(tmp % 3 == 0) tmp /= 3;
      else if(tmp % 5 == 0) tmp /= 5;
      else{
	flag = false;
	break;
      }
    }
    if(flag) p[i] = true;
  }

  int n, m;
  while(cin >> m, m){
    cin >> n;
    int cnt = 0;
    for(int i = m ; i <= n ; i++){
      if(p[i]) cnt++;
    }
    cout << cnt << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <set>
#define M 1000001
using namespace std;

int a[M];
int main(){
  set<int> s;
  int t,u;
  s.insert(1);
  s.insert(2);
  s.insert(3);
  s.insert(5);
  set<int>::iterator ite=s.begin();
  while((t=*ite)<M){
    if(t*2>t)s.insert(t*2);
    if(t*3>t)s.insert(t*3);
    if(t*5>t)s.insert(t*5);
    ite++;
  }
  for(ite=s.begin();*ite<M;ite++)a[*ite]=1;
  for(t=0;t<M;t++)a[t]+=a[t-1];
  for(;scanf("%d",&t),t;printf("%d\n",a[u]-a[t-1]))
    scanf("%d",&u);
  return 0;
}

C++: #include<iostream>
using namespace std;

int dp[1000001] = {0};
int main() {
	int k,m,n;
	dp[1] = 1;
	for(int i = 1 ; i <= 500000 ; i++){
		dp[i*2] |= 1;
		dp[i*3] |= 1;
		dp[i*5] |= 1;
	}
	for(int i = 1 ; i <= 1000000 ; i++){
		dp[i] += dp[i-1];
	}
	while(cin >> m&&m){
		cin >> n;
		cout << dp[n] - dp[m-1] << endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main(){

int x,y,c=0;
bool f[1000001];
for(int i=0;i<=1000001;i++)
	f[i]=false;
for(int i=0;i<=1000001;i++)
{
if(i%2==0)f[i]=true;
else if(i%3==0)f[i]=true;
else if(i%5==0)f[i]=true;
}

while(scanf("%d %d",&x,&y)!=EOF)
{
	for(int i=x;i<=y;i++)
{if(f[i]==true)c++;
	}
	
	
	/*
for(int i=x;i<=y;i++)
{
if(i%2==0)c++;
else if(i%3==0)c++;
else if(i%5==0)c++;
}
*/
printf("%d\n",c);c=0;
}
return 0;
}

C++: #include <iostream>
using namespace std;

bool div(int a){
    
    if(a == 1){
        return true;
    }else if(a % 2 == 0){
        return div(a/2);
    }else if(a % 3 == 0){
        return div(a/3);
    }else if(a % 5 == 0){
        return div(a/5);
    }else{
        return false;
    }
    
}

int main(int argc, const char * argv[]) {

    
    while(true){
        int m;
        cin >> m;
        if(m==0){
            break;
        }
        
        int n;
        cin >> n;
        
        int count = 0;
        for(int i=m;i<=n;i++){
            if(div(i)){
                count++;
            }
        }
        
        cout << count;
    }
    

    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>

using namespace std;

int m, n;

int check(int num) {
    if (m <= num && num <= n) return 1;
    return 0;
}

int main (int argc, char *argv[]) {
    while (cin >> m >> n, m) {
        int base = 1;
        int ans = 0;
        for (int i = int(m/2); i  <= int(n/2); ++i)    {
            for (int j = int(m/3); j <= int(n/3); ++j) {
                for (int k = int(m/5); k <= int(n/5); ++k) {
                    ans += check(pow(2, i) * pow(3, j) * pow(5, k));
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstring>
#define INF 1000001
using namespace std;
int main(){
	int m,n;
	bool HAM[INF];
	memset(HAM,false,sizeof(HAM));
	for(int i=1;i<INF;i*=2){
		for(int j=i;j<INF;j*=3){
			for(int k=j;k<INF;k*=5){
				HAM[k] = true;
			}
		}
	}
	while(cin >> m&&m){
		cin >> n;
		int cnt=0;
		for(int i=m;i<=n;i++){
			if(HAM[i]) cnt++;
		}
		cout << cnt << endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

const int MAXN = 1000002;
int S[MAXN], T[MAXN];

int main() {
  S[1] = 1;
  for(int i = 0; i*2 < MAXN; ++i) S[i*2] += S[i];
  for(int i = 0; i*3 < MAXN; ++i) S[i*3] += S[i];
  for(int i = 0; i*5 < MAXN; ++i) S[i*5] += S[i];
  for(int i = 0; i+1 < MAXN; ++i) S[i+1] += S[i];
  int n, m;
  while(cin >> m && m) {
    cin >> n;
    cout << S[n] - S[m-1] << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;

#define MAX 1000001

//最初に列挙
int h_hamingu[MAX] = {0};

//掛ける変数
const int h_kakeru[3] = {2 , 3 , 5};

//----- 関数で列挙 -----//
void f_rekkyo();


int main(void)
{
	//入力変数
	int first = 0;
	int second = 0;

	//関数で列挙
	f_rekkyo();

	while (true)
	{
		//入力
		cin >> first;
		if (first == 0)	{	return 0;	}
		cin >> second;
		//カウント変数
		int count = 0;

		for (int i = first; i <= second; i++)
		{
			if (h_hamingu[i] == 1)
			{
				count++;
			}
		}

		cout << count << endl;
	}

	return 0;
}



//*****----- 最初に列挙 -----*****//

void f_rekkyo()
{
	//1はハミング
	h_hamingu[1] = 1;

	for (int i = 0; i < MAX; i++)
	{
		if (h_hamingu[i] == 1)
		{
			for (int j = 0; j < 3; j++)
			{
				if (i * h_kakeru[j] <= 1000000)
				{
					h_hamingu[i * h_kakeru[j]] = 1;
				}
			}
		}
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
bool a[5000001] = {};

int main(){

  a[1] = true;
  for(int i=1;i<=1000000;i++){
    if(a[i]){
      a[i*2]=true;
      a[i*3]=true;
      a[i*5]=true;

    }
  }
  //for(int j = 2; j < 1000001; j+=2) a[j] = true;
  //for(int j = 3; j < 1000001; j+=3) a[j] = true;
  //for(int j = 5; j < 1000001; j+=5) a[j] = true;

  while(1){
    int m,n;
    cin >> m; if(m == 0)break;
    cin >> n;

    int count = 0;

    for(int i = m; i <= n; i++){
      if(a[i] == true)count++;
    }

    cout << count << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
/*
bool sw[1000001];
int i;
 
void sws(int k){
        if(k==1){
                sw[i]=true;
                return;
        }
        if(k%2==0) sws(k/2);
        else if(k%3==0) sws(k/3);
        else if(k%5==0) sws(k/5);
        return;
}
*/
// korenisuru
int dp[1000001];
int f(int n){
        if(~dp[n]) return dp[n];
        int ans = 0;
        if(n%2==0) ans |= f(n/2);
        else if(n%3==0) ans |= f(n/3);
        else if(n%5==0) ans |= f(n/5);
        return dp[n] = ans;
}
 
int main() {
        int m,n;
        for(int i = 0 ; i <= 1000000 ; i++) dp[i] = -1;
        dp[1] = 1;
        for(int i = 1000000 ; i >= 1 ; i--) f(i);
        while(cin >> m && m){
                cin >> n;
                int ans = 0;
                for(int i = m ; i <= n ; i++) ans += dp[i];
                cout << ans << endl;
        }
        return 0;
}

C++: #include<iostream>
using namespace std;

bool ham[100001];
int m,n;

void solve(){
	for(int i=1; i<6; i++)
		ham[i] = true;
	for(int i=6; i<100001; i++)
		ham[i] = false;
	for(int i=2; i<100001; i++){
		if(ham[i]){
			for(int j=i*2; ; j*=2){
				if(j>100001)
					break;
				ham[j] = true;
			}for(int j=i*3; ; j*=3){
				if(j>100001)
					break;
				ham[j] = true;
			}for(int j=i*5; ; j*=5){
				if(j>100001)
					break;
				ham[j] = true;
			}
		}
	}
}

int main(){
	solve();
	while(true){
		cin >> m >> n;
		if(!m && !n)
			return 0;
		int ans = 0;
		for(int i=m; i<=n; i++)
			if(ham[i])
				ans++;
		cout << ans << endl;
	}
}