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 <vector>
#include <algorithm>
#include <cstring>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int hum[1000001];

int main()
{	
	memset(hum,0,sizeof(hum));
	int count = 1;
	REP(i,1,1000001)
	{
		int temp = i;
		while(temp != 1)
		{
			if(temp%2 == 0) temp /= 2;
			else if(temp%3 == 0) temp /= 3;
			else if(temp%5 == 0) temp /= 5;
			else break;
		}

		if(temp == 1)
		{
			hum[i] = count;
			count++;
		}
		else
		{
			hum[i] = hum[i-1];
		}
	}
	
	int n,m;
	while(cin >> n && n)
	{
		cin >> m;	
		cout << hum[m] - hum[n-1]<< endl;
	}
	return 0;
}

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

bool x[N + 1];

void setn();
int cntham(int m, int n);

int main(){
	setn();
	int m, n;
	while(cin >>m){
		if(m == 0) break;
		cin >>n;
		cout <<cntham(m, n) <<endl;
	}
	return 0;
}

void setn(){
	for(int i = 1; i <= N; i *= 2){
		x[i] = true;
	}
	for(int i = 1; i <= N; ){
		if(i * 3 <= N) x[i * 3] = true;
		if(i * 5 <= N) x[i * 5] = true;
		i++;
		while(x[i] == false && i < N){
			i++;
		}
	}
}

int cntham(int m, int n){
	int cnt = 0;
	for(int i = m; i <= n; i++){
		if(x[i] == true) cnt++;
	}
	return cnt;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <sstream>
#include <cassert>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
typedef pair<int,int> PI;
typedef vector<int> vi;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#define pb push_back
#define f first
#define s second

int h[1000001];

main(){
  ll p=108839116800000000LL;
  rep(k,1000001){
    if(k==0)continue;
    if(p%k==0)h[k]=h[k-1]+1;
    else h[k]=h[k-1];
  }
  int m,n;
  while(cin>>m,m){
    cin>>n;
    cout<<h[n]-h[m-1]<<endl;
  }
}

C++: #include<bits/stdc++.h>

using namespace std;

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

    int ans = 0;

    for(int i = m;i <= n;++i){
      int temp = i;

      for(int j = temp;j > 1;){
        if(temp % 5 == 0){
          temp = temp / 5;
        }
        else if(temp % 3 == 0){
          temp = temp / 3;
        }
        else if(temp % 2 == 0){
          temp = temp / 2;
        }
        else{
          break;
        }
      }
      
      if(temp == 1){
        ++ans;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

C++: #include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <cstring>
#include <deque>
#include <cstdio>
#include <cmath>
#include <complex>
#include <iostream>
#include <iterator>

using namespace std;

#define reep(i,f,t) for(int i=f ; i<int(t) ; ++i)
#define rep(i,n) reep(i, 0, n) 

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

const int MAX = 1000000;

int main()
{
	vi hamming;
	for(int i=1; i<=MAX; i*=2){
		for(int j=i; j<=MAX; j*=3){
			for(int k=j; k<=MAX; k*=5){
				hamming.push_back(k);
			}
		}
	}
	sort(hamming.begin(), hamming.end());
	
	int m;
	while(scanf("%d", &m), m){
		int n;
		scanf("%d", &n);
		m = distance(hamming.begin(), lower_bound(hamming.begin(), hamming.end(), m));
		n = distance(hamming.begin(), upper_bound(hamming.begin(), hamming.end(), n));
		printf("%d\n", n-m);
	}
	
	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

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

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

bool h[1000001];
const int a[3] = {2,3,5};

int main(){
	h[0] = h[1] = true;
	for(int i=1;i<=1000000;i++){
		if(!h[i]) continue;
		for(int j=0;j<3;j++) if(i*a[j]<=1000000) h[i*a[j]] = true;
	}
	int M,N;
	while(cin>>M,M){
		cin>>N;
		int ans = 0;
		for(int i=M;i<=N;i++) ans += h[i];
		printf("%d\n",ans);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int hum(int);

int main(){
	int m,n;
	int h=0;
	cin>>m;
	while(m>0){
		cin>>n;
		for(int i=m;i<=n;i++){
			h+=hum(i);
		}
		cout<<h<<endl;
		h=0;
		cin>>m;
	}	
	return 0;
}

int hum(int x){
	while(x%2==0){
		x/=2;
	}
	while(x%3==0){
		x/=3;
	}
	while(x%5==0){
		x/=5;
	}
	if(x==1){
		return 1;
	}else{
		return 0;
	}
}

C++: #include<iostream>

bool ham[1000001];
int cnt[1000001];

int main()
{
	ham[1] = true;

	cnt[1] = 1;

	for( int i = 2; i <= 1000000; ++i )
	{
		if( ( i % 2 == 0 && ham[i/2] ) || ( i % 3 == 0 && ham[i/3] ) || ( i % 5 == 0 && ham[i/5] ) )
			ham[i] = true;

		cnt[i] = cnt[i-1] + ham[i];
	}

	int m, n;
	while( std::cin >> m, m )
	{
		std::cin >> n;

		std::cout << cnt[n] - cnt[m-1] << std::endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
bool a[1000001];
int main()
{
  int i,j,m,n;
  for(i=1;i<1000001;i++){
    j = i;
    while(j % 2 == 0) j /= 2;
    while(j % 3 == 0) j /= 3;
    while(j % 5 == 0) j /= 5;
    if(j==1) a[i] = true;
  }
  for(;;){
    cin >> m;
    if(m==0) break;
    cin >> n;
    j = 0;
    for(i=m;i<=n;i++){
      if(a[i]) j++;
    }
    cout << j << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;

#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second

static const double PI=6*asin(0.5);
typedef pair<double,double> P;
typedef complex<double> CP;
typedef long long ll;

bool a[1000010];
int b[1000010]={0};

int main(){
	rep(i,1000010){
		a[i]=false;
	}
	a[1]=true;
	for(int i=1;i<1000010;i++){
		if(a[i]){
			if(2*i<1000010) a[2*i]=true;
			if(3*i<1000010) a[3*i]=true;
			if(5*i<1000010) a[5*i]=true;
		}
	}
	/*
	rep(i,100){
		if(a[i]){
			cout<<i<<" ";
		}
	}
	cout<<endl;
	*/
	rep(i,1000010){
		if(i==0) continue;
		b[i]=b[i-1];
		if(a[i]) b[i]++;
	}
	b[0]=0;
	int m,n;
	while(cin>>m,m){
		cin>>n;
		cout<<b[n]-b[m]+1<<endl;
	}
	return 0;
}

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

int main(){
	int n,m,ret,c;
	while(cin >> n && n){
		cin >> m;
		ret = 0;
		for(int i=n;i<=m;i++){
			c = i;
			while(c%2==0){
				c/=2;
			}
			while(c%3==0){
				c/=3;
			}
			while(c%5==0){
				c/=5;
			}
			if(c==1)ret++;
		}
		cout << ret << endl;
	}
}