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<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  vi hamming(1000001,0);
  loop(i,1,1000001){
    int t=i;
    while(t%2==0)t/=2;
    while(t%3==0)t/=3;
    while(t%5==0)t/=5;
    if(t==1)hamming[i]++;
  }
  rep(i,1000000)
    hamming[i+1]+=hamming[i];
 
  while(1){
    int n,m;
    cin>>n;
    if(n==0)break;
    cin>>m;
    cout<<hamming[m]-hamming[n-1]<<endl;
  }
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>
#include<math.h>


using namespace std;

bool f[10000002];

int main(){
	
	f[1]=true;f[3]=true;f[5]=true;

	for(int i=2;i<10000001;i*=2)
	{
		f[i]=true;
	}
	//cout<<"#";
	for(int i=3;i<10000001;i*=3)
	{
		f[i]=true;
	}
	for(int i=5;i<10000001;i*=5)
	{
		f[i]=true;
	}
	for(int i=2;i<10000001;i++)
	{
		if(f[i]==true){
		for(int j=i;j<10000001;j*=5)
		f[j]=true;
		for(int j=i;j<10000001;j*=3)
		f[j]=true;
		for(int j=i;j<10000001;j*=2)
		f[j]=true;
			}
	}

	int a,b;

	while(1){
		int ans=0;
		cin>>a;if(a==0)break;
		cin>>b;
		
		for(int i=a;i<=b;i++)
			if(f[i]==true){ans++;}//cout<<i<<endl;}

		cout<<ans<<endl;
	}


	return 0;
}

C++: #include<stdio.h>

int main(){

int x,y,c=0;

while(scanf("%d %d",&x,&y))
{
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;

int size = 100001;
bool ham[100001];
int m,n;

void solve(){
	for(int i=1; i<6; i++)
		ham[i] = true;
	for(int i=6; i<size; i++)
		ham[i] = false;
	for(int i=2; i<size; i++)
		if(ham[i]){
			for(int j=i*2; j<size; j*=2)
				ham[j] = true;
			for(int j=i*3; j<size; j*=3)
				ham[j] = true;
			for(int j=i*5; j<size; j*=5)
				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;
	}
}

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

C++: #include<stdio.h>

int judge(int,int);

int memo[1000001];

int main(void){
  int n,m,i,count;

  for(i=0;i<1000001;i++)
    memo[i]=-1;
  
  memo[0]=1;
  memo[1]=0;

  while(scanf("%d",&n),n){
      scanf("%d",&m);

    count=0;
    for(i=n;i<=m;i++){
      if(judge(i,1)==0){
	memo[i]=0;
	count++;
      }
    }
    printf("%d\n",count);
  }
  return 0;
}

int judge(int x,int fg){

  if(x%2==0)judge(x/2,2);
  else if(x%3==0)judge(x/3,3);
  else if(x%5==0)judge(x/5,5);

  if(memo[x]==0){
    memo[x*fg]=0;
    return 0;
  }
  return memo[x]=1;
}

C++: #include <iostream>
#include <cstring>
#include <sstream>
//#include <fstream>

using namespace std;

const int MAX_N = 1000000;
bool hamming[MAX_N + 1];

bool ishamming (int n )
{
	while (n % 2 == 0 ){
		n /= 2;
	} // end while
	while (n % 3 == 0 ){
		n /= 3;
	} // end while
	while (n % 5 == 0 ){
		n /= 5;
	} // end while

	return (n == 1 );
}
	
void make_hamming (void )
{
	memset (hamming, false , sizeof (hamming ) );

	for (int i = 1; i <= MAX_N; ++i){
		if (ishamming(i ) ){
			hamming[i] = true;
		} // end if
	} // end for
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.hamming", "r", stdin );
	string str = "";

	make_hamming();

	while (getline (cin, str ) ){
		int m, n;

		if (str.length() == 1 && str[0] == '0'){
			break;
		} // end if

		stringstream ss (str );
		ss >> m >> n;
		
		int res = 0;

		for (int i = m; i <= n; ++i){
			if (hamming[i] ){
				++res;
			} // end if
		} // end for
		cout << res << endl;
	} // end loop
		
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#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 INF 1<<30

int main() {
  int N = 1000000;
  bool dp[N+1];
  dp[1] = true;
  for (int i=2; i<=N; ++i) {
    if (i%2==0&&dp[i/2] || i%3==0&&dp[i/3] || i%5==0&&dp[i/5])
      dp[i] = true;
  }
  int m,n;
  while(cin>>m,m) {
    cin >> n;
    cout << count(dp+m, dp+n+1, true) << endl;
  }
}

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

int dp[1000001];

int main() {
    int num = 60 * 60 * 60 * 60;
    for (int i = 1; i < 1000001; i++) {
        if (num % i == 0) dp[i] = 1;
        dp[i] += dp[i-1];
    }

    int M, N;
    while (cin >> M, M) {
        cin >> N;
        cout << dp[N] - dp[M-1] << endl;
    }


    return 0;
}

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

using namespace std;

bool prime[10000];
int ans[1000001];

void erat()
{

    for (int i = 2; i < 10000; i++) {
        prime[i] = true;
    }

    for (int i = 2; i < 5000; i++) {
        if (prime[i]) {
            for (int j = 2; j*i < 10000; j++) {
                prime[i*j] = false;
            }
        }
    }
}

void solve()
{
    ans[0] = 0;
    ans[1] = 0;
    for (int i = 2; i < 1000001; i++) {
        int fl = 1;
        for (int j = 7; j*j <= i; j++) {
            if (prime[j] && !(i % j)) {
                fl = 0;
                break;
            }
        }
        ans[i] = ans[i-1] + fl;
    }
}




int main() 
{
    int m, n;
    cin >> m;

    erat();
    solve();

    while (m) {
        cin >> n;
        cout << ans[n] - ans[m-1] << endl;
        cin >> m;
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define N 100
using namespace std;
int main(){
	bool hamming[N]={false};
	hamming[1] = true;
	for(int j=2;j<N;j++){
		int i=j;
		while(i%2==0) i /= 2;
		while(i%3==0) i /= 3;
		while(i%5==0) i /= 5;
		if(i==1) hamming[j] = true;
	}

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

		int count=0;
		for(int i=m;i<=n;i++)
			if(hamming[i])
				count++;
		
		cout<<count<<endl;
	}

	return 0;
}