Ulam episode

from Wikipedia, the free encyclopedia

The (u, v) -Ulam sequence is a sequence of numbers defined by the Polish mathematician Stanisław Marcin Ulam . Here u and v are natural numbers. The consequence is defined by:

is the smallest natural number that is greater than and can be clearly represented as the sum of two numbers from .

Example: The (1,2) -Ulam sequence has the terms

.

5 does not belong to the sequence, because 5 = 2 + 3 = 4 + 1 cannot be clearly represented. The other following members are

.

The terms of an Ulam sequence are also called (u, v) -Ulam numbers .

Realization of the (1,2) -Ulam sequence in C ++

#include <iostream>
#define N 100		    	// beliebige Obergrenze der Folge

using namespace std;

int main(){
	int ulam[N]={};		// Ulamfolge als Array
	ulam[0] = 1;			// Deklaration des 1.
	ulam[1] = 2;			// und 2. Elements
	
	for(int i=2; i< N; i++){
		int x = ulam[i-1];	// potentiell nächsthöherer Listeneintrag 
		int c;		       	// Zähler der möglichen Kombinationen
		
		do {
			c = 0;
			x++;		
				        	// Durchexerzieren aller möglichen
				        	// Kombinationen bisherigen Listenelemente
			for(int k=0; k<i; k++){
				for(int n=0; n<k; n++){
					
				        	// Zähler Inkrementation bei Gültiger Kombination:
					if(ulam[n] + ulam[k] == x){
						c++;
					}
					
				}
			}
		} while(c!=1);		// Abbruchbedingung für den Fall einer einzigen(!)
				        	// möglichen Kombination
		
		ulam[i] = x;		// Zuweisen des Wertes mit gültiger kombination
		cout << x << endl;	// Ausgabe
		
	}
	return 0;
}

In this way any Ulam sequence (u, v) can be realized by writing in code

ulam[0] = u;
ulam[1] = v;

begins.

literature

  • Richard Guy: Unsolved Problems in Number Theory. 3rd ed. Springer, New York a. a. 2004, ISBN 0-387-20860-7 . Pp. 166-167

Web links