{Algoritme for 3n+1 problemet.}

1. Input n	{et naturlig tall}

2. Repeat

2.1. If (n even) then

2.1.1. n ← n/2

else

2.1.2. n ← 3n+1

2.2. Output n

until n=1

{Alternativ algoritme}

1. Input n

2. While n ≠ 1 do

2.1. If (n even) then

2.1.1. n ← n/2

else

2.1.2. n ← 3n+1

2.2. Output n

2005-01-12T12:08:24