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<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

ll cnt[1000001];
int main() {
	for (ll i = 1; i <= 1000000; i++) {
		cnt[i] = cnt[i - 1];
		if (!(604661760000000000LL % i))cnt[i]++;
	}
	ll m, n;
	while (scanf("%lld", &m), m) {
		scanf("%lld", &n);
		printf("%lld\n", cnt[n] - cnt[m - 1]);
	}
}

C++: #include<iostream>
using namespace std;
const int MAX_N=1001000;
bool table[MAX_N];

int main(){
	int n,m;
		for(int i=0;i<MAX_N;i++)table[i]=false;
		
		table[2]=table[3]=table[5]=true;
		for(int i=2;i<MAX_N;i++){
		
		if(table[i]){
		if(i*2<MAX_N)table[i*2]=true;
		if(i*3<MAX_N)table[i*3]=true;
		if(i*5<MAX_N)table[i*5]=true;
		}
	}
	
	while(cin>>n>>m,n&&m){
		int ans=0;
		for(int i=n;i<=m;i++){
			if(table[i]){
			ans++;
			}
		}
		cout<<ans<<endl;
	}
	

	

	
	return 0;
}

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

#define MAX 1000000

main(){
    bool H[MAX+1];
    int T[MAX+1];
    for ( int i = 0; i <= MAX; i++ ){
	H[i] = false;
	T[i] = 0;
    }

    H[1] = H[2] = H[3] = H[5] = true;
    for ( long long i = 1; i <= MAX; i *= 2 ){
	for ( long long j = 1; j <= MAX; j *= 3 ){
	    if ( i*j > MAX ) continue;
	    for ( long long k = 1; k <= MAX; k *= 5 ){
		if ( i*j*k > MAX ) continue;
		H[i*j*k] = true;
	    }
	}
    }
    for ( int i = 1; i <= MAX; i++ ){
	T[i] += T[i-1];
	if ( H[i] ) T[i]++;
    }

    int l, r;
    while( cin >> l && l ){
	cin >> r;
	int a = T[r] - T[l];
	if ( H[l] ) a++;
	cout << a << endl;
    }
    
}

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

#define M_N 1000000

int h_num[M_N + 10];

using namespace std;

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

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;

int main(){
   int h[1000001];
   int i,n,m;
   h[1]=1;
   for(i=2;i<=1000000;i*=2)h[i]=1;
   for(i=1;i<=1000000;i++){
       if(h[i]){
           for(int j=i*3;j<=1000000;j*=3){
               if(h[j]==0)h[j]=2;
           }
       }
   }
   for(i=1;i<=1000000;i++){
       if(h[i]){
           for(int j=i*5;j<=1000000;j*=5){
               if(h[j]==0)h[j]=3;
           }
       }
   }
   while(cin>>n>>m&&n){
       int count=0;
       for(i=n;i<=m;i++){
           if(h[i]) count++;
       }
       cout<<count<<endl;
   }
    return 0;
}

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

#define N 1000000
int isHamming(int x){
  while (x%2==0) x /= 2;
  while (x%3==0) x /= 3;
  while (x%5==0) x /= 5;
  return x==1;
}

int main(void){
  int cnt[N+1], a, b;
  
  cnt[0] = 0;
  for (int i=1; i<=N; i++){
    cnt[i] = cnt[i-1] + isHamming(i);
  }
  while (cin >> a){
    if (a==0) break;
    cin >> b;
    cout << (cnt[b] - cnt[a-1]) << endl;
  } 
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

bool is_h[1000001];
ll cnt[1000001];
int main() {
	cnt[1] = is_h[1] = 1;
	for (ll i = 2; i <= 1000000; i++) {
		cnt[i] = cnt[i - 1];
		if ((!(i % 2) && is_h[i / 2]) || (!(i % 3) && is_h[i / 3]) || (!(i % 5) && is_h[i / 5])) {
			cnt[i]++;
			is_h[i] = 1;
		}
	}
	ll m, n;
	while (scanf("%lld", &m), m) {
		scanf("%lld", &n);
		printf("%lld\n", cnt[n] - cnt[m - 1]);
	}
}

C++: #include<iostream>
using namespace std;
bool t[1000001];
int  u[1000001];
int N =1000000;
int n,m;
void make_table(){
  for(int i=0;i<=N;i++){
    t[i]=false;
    u[i]=0;
  }

  t[1]=true;

  for(int i=1;i<=N;i++){
    u[i]=u[i-1];
    if(t[i]==false)continue;
    u[i]++;
    if(i*2<=N)t[i*2]=true;
    if(i*3<=N)t[i*3]=true;
    if(i*5<=N)t[i*5]=true;
  }
}



int main(){
  make_table();
  while(cin>>n>>m){
    cout<<u[m]-u[n]+t[n]<<endl;
  }
}

C++: #include<iostream>
#include<vector>
using namespace std;
int a[1000001];
int b[1000001];
int n,m;

int main(){
  a[1]=1;
  for(int i=2;i<=1000000;i++){
    if(i%2==0){
      a[i]=a[i/2];
    }else if(i%3==0){
      a[i]=a[i/3];
    }else if(i%5==0){
      a[i]=a[i/5];
    }
  }

  for(int i=1;i<=1000000;i++)b[i]=a[i]+b[i-1];
  
  while(1){
    cin>>n;
    if(n==0)break;
    cin>>m;
    cout<<b[m]-b[n-1]<<endl;
  }
  return 0;
}

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

int main(){
    bool isHamming[1000001] = {};
    isHamming[1] = true;
    for(int i = 1; i <= 1000000; i++){
        if(isHamming[i]){
            if(i*2 <= 1000000)  isHamming[i*2] = true;
            if(i*3 <= 1000000)  isHamming[i*3] = true;
            if(i*5 <= 1000000)  isHamming[i*5] = true;
        }
    }

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

        int cnt = 0;
        for(int i = m; i <= n; i++) if(isHamming[i])    cnt++;
        cout << cnt << endl;
    }
    return 0;
}

C++: #include<queue>
#include<iostream>
#include<functional>

using namespace std;

bool bh[1000001];

int main()
{
	priority_queue< int,vector<int>,greater<int> > pq;
	pq.push(1);	bh[1]=true;
	while(pq.top()<1000000){
		int a=pq.top();	pq.pop();
		if(2*a<=1000000&&!bh[2*a])	pq.push(2*a),bh[2*a]=true;
		if(3*a<=1000000&&!bh[3*a])	pq.push(3*a),bh[3*a]=true;
		if(5*a<=1000000&&!bh[5*a])	pq.push(5*a),bh[5*a]=true;
	}

	vector<int> ham;
	for(int i=0;i<=1000000;i++)	if(bh[i])	ham.push_back(i);

	for(int m,n;scanf("%d%d",&m,&n),m;){
		printf("%d\n",
			distance(lower_bound(ham.begin(),ham.end(),m),
					 upper_bound(ham.begin(),ham.end(),n))
		);
	}

	return 0;
}

C++: #include <iostream>
#include <memory>
#include <memory.h>
#include <cmath>
#include <fstream>
#include <cmath>
#include <numeric>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <map>
#include <iomanip>
#include <list>
#include <cctype>
#include <algorithm>
#include <complex>
#define USE_MATH_DEFINES
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<int, PP> PPP;
const int INF = 1 << 29;
const double EPS = 1E-10;

bool nums[2000000];

int main(){
	memset(nums, false, sizeof(nums));
	nums[1] = true;
	rep2(i, 2, 2000000){
		if(i % 2 == 0 && nums[i/2]) nums[i] = true;
		if(i % 3 == 0 && nums[i/3]) nums[i] = true;
		if(i % 5 == 0 && nums[i/5]) nums[i] = true;
	}
	int m, n;
	while(cin >> m && m){
		int cnt = 0;
		cin >> n;
		rep2(i, m, n + 1) if(nums[i]) cnt++;
		cout << cnt << endl;
	}
	return 0;
}