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<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#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()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

#define MAX 1000001

int h[MAX];

int main(){
  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] = 1;
  int a,b;
  while(scanf("%d",&a),a){
    int ans = 0;
    scanf("%d",&b);
    while(a <= b) ans += h[a++];
    printf("%d\n",ans);
  }
  return 0;
}

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

int main(){
  int m;
  int n,a,cnt;
  m =0 , n=0, a=0, cnt =0;
  while(1){
    cin >> m;
    if(m == 0) break;
    cin >> n;
 
    for(int i=m;i<=n;i++){
      a = i;
      
      while(a % 2 ==0) a = a / 2;
      while(a % 3 ==0) a = a / 3;
      while(a % 5 ==0) a = a / 5;

      if(a == 1) cnt++;
    }


    cout << cnt << endl;
    cnt =0;

  }



}

C++: #include<iostream>
#include<cmath>
#define MAX 1000005
bool ham[MAX];
int num_ham[MAX];
using namespace std;
void MakeHammings(){
	const int mul[] = {2,3,5};
	ham[1] = true;
	num_ham[0] = 0;
	for(int i = 1; i < MAX; ++i){
		num_ham[i] = num_ham[i-1];
		if( ham[i] ){
			num_ham[i]++;		
			for(int k = 0; k < sizeof(mul)/sizeof(*mul); ++k){
				for(int j = 1; i * (int)pow((double)mul[k],j) < MAX; ++j){
					ham[i*(int)pow((double)mul[k],j)] = true;
				}
			}
		}
	}
}
int main(){
	MakeHammings();
	while(true){
		int m,n;
		scanf("%d", &m);
		if(m==0)break;
		scanf("%d",&n);
		printf("%d\n", num_ham[n]-num_ham[m]+(ham[m]?1:0));
	}
}

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

vector<int> hamming;

void ham() {
  int temp;
  for(int i=0;i<20;i++) {
    for(int j=0;j<20;j++) {
      for(int k=0;k<20;k++) {
        temp = pow(2.0,(double)i)*pow(3.0,(double)j)*pow(5.0,(double)k);
        if(temp <= 1000000 && temp >= 0) {
        hamming.push_back(temp);
        cout << temp << endl;
        }
        else {
          break;
        }
      }
    }
  }
}

int main() {
  int m,n,from,to;
  vector<int>::iterator low,up;
  ham();
  sort(hamming.begin(),hamming.end());
  while(cin >> m >> n) {
    low=lower_bound(hamming.begin(), hamming.end(), m);
    up=upper_bound(hamming.begin(),hamming.end(),n);
    from = int(low-hamming.begin());
    to = int(up-hamming.begin());
    cout << to-from << endl;
  }
}

C++: #include<iostream>
#include<algorithm>
#define MAXNUM 1e+6

using namespace std;

int ham[4]={1,2,3,5};
bool memo[(int)MAXNUM+1]={false};

void func(int n){
	if(n>MAXNUM || memo[n]){
		return ;
	}
	memo[n]=true;
	func(n*2);
	func(n*3);
	func(n*5);
}

int main(){
	int m,n,ans;
	func(1);
	
	while(cin>>m){
		if(m==0){
			break;
		}
		cin>>n;
		ans=0;
		for(int i=m;i<=n;i++){
			if(memo[i]){
				ans++;
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include <cstdio>

int ham[1000010];
int sum[1000010];

int main(){
	ham[1] = 1;
	for(int i = 2; i <= 1000000; ++i){
		int t = 0;
		if(i % 2 == 0){ t |= ham[i / 2]; }
		if(i % 3 == 0){ t |= ham[i / 3]; }
		if(i % 5 == 0){ t |= ham[i / 5]; }
		ham[i] = t;
	}
	for(int i = 1; i <= 1000000; ++i){
		sum[i] = sum[i - 1] + ham[i];
	}
	
	int m, n;
	while(scanf("%d%d", &m, &n) == 2){
		printf("%d\n", sum[n] - sum[m - 1]);
	}
}

C++: #include <iostream>
#include <cstring>
using namespace std;
int memo[1000000];

int solve( int ,int ,int );
int main(){
  int n ,m ,total;
  while( true ){
    total = 0;
    memset( memo ,-1 ,sizeof( memo ) );
    cin >> n;
    if( n == 0 ) break;
    cin >> m;
    solve( 1 ,n ,m );
    for( int i=n-1 ; i<=m ; i++ ){
      if( memo[i] != -1 ) total++;
    }
    cout << total << endl;
  }
}

int solve( int ans ,int n ,int m ){
  if( ans <= m ){
    if( n <= ans && memo[ans] == -1) return memo[ans] = ( solve( ans*2 ,n ,m ) + solve( ans*3 ,n ,m ) +
							  solve( ans*5 ,n ,m ) );
    else return ( solve( ans*2 ,n ,m ) + solve( ans*3 ,n ,m ) +  solve( ans*5 ,n ,m ) );
  }
  else return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
using namespace std;
int main() {
	long a, b;
	vector<long>l;
	while (true){
		cin >> a;
		if (a == 0)break;
		cin >> b;
		long pen;
		for (long i = a; i != b + 1; i++){
			if (i % 2 == 0) {
				i /= 2;
			}
			if (i % 3 == 0) {
				i /= 3;
			}
			if (i % 5 == 0) {
				i /= 5;
			}
			if (i == 0){
				pen += 1;
				continue;
			}
			if (i % 2 != 0 && i % 3 != 0 && i % 5 != 0)
				continue;
		}
		l.push_back(pen);
	}
	for (int i = 0; i < l.size(); i++)
	{
		cout << l[i] << endl;
	}
}

C++: #include<stdio.h>



int main(){

long big=60*60*60*60*60;
int x,y;

while(1)
{
int c=0;
scanf("%d",&x);if(x==0)break;

scanf("%d",&y);

for(int i=x;i<=y;i++)
if(big%i==0)c++;

printf("%d\n",c);

}
return 0;
}

C++: #include <iostream>

using namespace std;

int is_haming(int num)
{
	while (num % 2 == 0) num /= 2;
	while (num % 3 == 0) num /= 3;
	while (num % 5 == 0) num /= 5;

	if (num == 1) return (1);
	else return (0);
}

int main()
{
	int n, m;

	while (cin >> n, n){
		cin >> m;

		int count = 0;
		for (int i = n; i <= m; i++){
			count += is_haming(i);
		}

		cout << count << endl;
	}

	return 0;
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#include<complex>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int m, n;
	vector<int>v(1000001, 1);
	v[0] = v[1] = 0;
	for (int i = 2; i <= sqrt(1000000); i++) {
		if (v[i]) {
			for (int j = 0; i*(j+2) <= 1000000; j++) {
				v[i*(j+2)] = 0;
			}
		}
	}
	//for (int i = 2; i < 100; i++) {
	//	if (v[i])printf("%4d", i);
	//}
	//cout << endl;

	while (cin >> m >> n, m) {
		int cnt = 0;
		for (int i = m; i <= n; i++) {
			if (i == 1)cnt++;
			bool f = false;
			bool g = false;
			if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) {
				g = true;
			}
			for (int j = 7; j < i; j++) {
				if (v[j] && i%j == 0) {
					f = true;
					break;
				}
			}
			if (!f&&g)cnt++;
		}
		cout << cnt << endl;
	}
	return 0;
}

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

using namespace std;


int HammingData[1000001] = {0,1};

void judge() {
	int tmp;
	bool flag;

	for (int i = 2; i < 1000001; i++) {
		tmp = i;
		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) {
			HammingData[i] = 1;
		}
	}
}


int main(void) {
	int n, m, sum;

	judge();

	while (cin >> m, m) {
		cin >> n;
		n++;
		sum = 0;
		for (int i = m; i < n; i++) {
			if (HammingData[i] == 1) {
				sum++;
			}
		}
		cout << sum << endl;
	}

	return 0;
}