>This is due tomorrow
Bummer.
>and i am absoltuly lost
Try paying attention in class.
>can anyone help with some examples or point in the right direction
Sure, post your attempt and we'll help. Nobody is going to do your homework for you. Especially since it seems like you're terribly lazy. I wrote this program in about 30 seconds, including the time it took to create, write and save the source file and the time to compile it.
WOULD THIS HELP YOU INSTEAD OF ACCUSATIONS OF LAZYNESS??
PROGRAM week5Program1 (input, output);
{$APPTYPE CONSOLE}
Uses
sysutils;
var
num1,count :integer;
begin
writeln ('Enter a positive integer to see its Ulam sequence, or a zero to exit:');
readln (num1);
if (num1 = 0) then
begin
writeln ('Thank you! You have chosen to exit');
writeln ('Press <enter> to exit.');
readln;
end;
while (num1 < 1) and (num1 <> 0) do
begin
writeln (' The number you enter must be a postive number');
writeln ('Enter a POSITIVE integer:');
readln (num1);
end;
while (num1 <> 1) do
BEGIN
begin
IF (num1 mod 2 <> 0) then {if even}
BEGIN
num1 := num1 div 2 ;
writeln (num1);
count := count + 1
END
ELSE {if odd}
begin
num1 := 3 * num1 + 1;
num1 := num1 div 2;
writeln (num1) ;
count := count + 1
end
end;
writeln ('The sequence in the Ulam algorithm for the number you entered are:',num1);
writeln ('There are',count,'numbers in the sequence.');
writeln ('Press <enter> to continue.');
readln;
END;
end.