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 <cstring>
#include <vector>
#include <algorithm>
using namespace std;

int main(void){
	bool isham[1000001];
	vector<int> ham;
	isham[1] = true;
	ham.push_back(1);
	for(int i=1;i<500001;i++){
		if(!isham[i]) continue;
		if(i*2 < 1000001){
			isham[i*2] = true;
			if(find(ham.begin(),ham.end(),i*2) == ham.end()){
				ham.push_back(i*2);
			}
		}
		if(i*3 < 1000001){
			isham[i*3] = true;
			if(find(ham.begin(),ham.end(),i*3) == ham.end()){
				ham.push_back(i*3);
			}
		}
		if(i*5 < 1000001){
			isham[i*5] = true;
			if(find(ham.begin(),ham.end(),i*5) == ham.end()){
				ham.push_back(i*5);
			}
		}
	}
	sort(ham.begin(),ham.end());

	int n,m;
	while(cin >> n && n){
		cin >> m;
		cout << upper_bound(ham.begin(),ham.end(),m) - lower_bound(ham.begin(),ham.end(),n) << endl;
	}
}

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 k,m,n;
        for(int i = 0 ; i <= 1000000 ; i++) dp[i] = -1;
        dp[1] = 1;
        /*
        for(int j=0;j<1000001;j++) sw[j]=false;
        for(i=1;i<1000001;i++) sws(i);
        while(cin >> m,m){
                int ans=0;
                cin >> n;
                for(int j=m;j<=n;j++) if(sw[j]==true) ans++;
                cout << ans << endl;
        }*/
        while(cin >> m && m){
                cin >> n;
                int ans = 0;
                for(int i = m ; i <= n ; i++) ans += f(i);
                cout << ans << endl;
        }
        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;

const int MAX = 1000001;

int main (int argc, char *argv[]) {
    int m, n;
    bool h[MAX];
    for(int i = 1; i < MAX; i *= 2){
        for(int j = i; j < MAX; j *= 3){
            for(int k = j; k < MAX; k *= 5) {
                h[k] = true;
            }
        }
    }
    while (cin >> m >> n, m) {
        int ans = 0;
        for (int i = m; i <= n; ++i) {
            if (h[i]) ans++;
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define pp pair<int,int>
#define ll long long
#define ld long double
int inf=100000000;
ll INF=5000000000000000000;
ll MOD=1000000007;


int main() {
    vector<int> dp(1000001),s(1000001);
    s.at(0)=0;
    queue<int> q;
    q.push(1);
    while (!q.empty()){
        int a=q.front();
        q.pop();
        if (a>1000000) continue;
        dp[a]=1;
        q.push(a*2);
        q.push(a*3);
        q.push(a*5);
    }
    for (int i=1;i<1000001;i++){
        s.at(i)=s.at(i-1)+dp.at(i);
    }
    while (true){
    int t,y;
    cin >> t;
    if (t==0) return 0;
    cin >>y;
    cout << s.at(y)-s.at(t-1) << endl;
}
}

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;
    for (int i = 1; i < 1000001; i++) {
        ans[i] = 1;
    }
    for (int i = 7; i < 1000001; i++) {
        if (prime[i]) {
            for (int j = 2; i*j < 1000001; j++) {
                ans[i*j] = 0;
            }
            ans[i] = 0;
        }
    }
    for (int i = 1; i < 1000001; i++) {
        ans[i] += ans[i-1];
    }
}




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++: // 2014/04/27 Tazoe

#include <iostream>
using namespace std;

int main()
{
	bool is_hamming[1000001];

	for(int i=0; i<1000001; i++){
		is_hamming[i] = false;
	}

	for(int i=1; i<1000001; i*=2){
		for(int j=i; j<1000001; j*=3){
			for(int k=j; k<1000001; k*=5){
				is_hamming[k] = true;
			}
		}
	}

	int n_hamming[1000001];

	int cnt = 0;
	for(int i=0; i<1000001; i++){
		if(is_hamming[i]){
			cnt++;
		}
		n_hamming[i] = cnt;
	}

	while(true){
		int m;
		cin >> m;

		if(m==0)
			break;

		int n;
		cin >> n;

		cout << n_hamming[n]-n_hamming[m-1] << endl;
	}

	return 0;
}

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

int main() {
  int m, n;
  int num;

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

    int count = 0;
    for(int i = m; i <= n; i++) {
      num = i;
      while(1) {
        if(num == 1) {
          count++;
          break;
        }
        if(num % 2 == 0)
          num =	num / 2;
        else if(num % 3 == 0)
          num =	num / 3;
        else if(num % 5 == 0)
          num = num / 5;
	else
          break;
      }
    }
    cout << count << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int m;
    while(cin>>m,m){
        int n,co=0;
        cin>>n;
        for(int i=m;i<=n;i++){
            if(i==1)co++;
            else{
                long long int kawa=60;
                for(int j=0;j<14;j++){
                    if(kawa%i==0){
                        co++;
                        break;
                    }
                    kawa*=60;
                }
            }
        }
        cout<<co<<endl;
    }
}

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

using namespace std;

int main(){

  int m,n;

  while(cin>>m>>n, m || n){
	
	int count = 0;
	
	for(int i=m;i<=n;++i){

	  int result = i;
	  
	  while(1){

		if(result%2==0)
		  result = result/2;
		else if(result%3==0)
		  result = result/3;
		else if(result%5==0)
		  result = result/5;
		else
		  break;
	  }
	  
	  if(result == 1)
		count++;
	  
	}

	cout<<count<<endl;
	
  }
  
}

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

int ham[1000010]={0};
lld sum[1000010]={0};
int num[] = {2,3,5};

void solve(int now){
  if(now > 1000000) return;
  if(ham[now] != 0) return;
  for(int i=0;i<3;i++){
    solve(now*num[i]);
  }
  ham[now] = 1;
  return;
}

int main(){
  solve(1);
  for(int i=1;i<1000001;i++){
    sum[i] = ham[i] + sum[i-1];
  }
  int m,n;
  while(cin >> m , m){
    cin >> n;
    cout << sum[n] - sum[m-1] << endl;
  }
}