Search found 5 matches

by Six of Three
Tue Sep 30, 2003 9:45 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318353

Your formula is the same as mine, only a few more brackets ;)
Guess you have made some other optimization which prevents from computing these numbers which do not fit in Int32. Or which data type do you use?

Hmm... I think Int64 and similar fits best here :)
by Six of Three
Mon Sep 29, 2003 3:59 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318353

Huh, this sounds like the incredible n:=n+n shr 1+1 tweak which delays the crashing point by some numbers. Arr... guess you did not mean that, it would be way too easy. :lol:
Finding (n*3+1)div 2 without "doing it"... sounds a little bit lunatic. I am glad there is another insane here :lol: :lol:

I ...
by Six of Three
Mon Sep 29, 2003 10:51 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318353

You'd better install free pascal if you want to solve more problems.
I see there are good arguments for doing so :-?

There are two 64-bit integer types Int64 (signed) and QWord (unsigned), but you don't need them for this problem; standard integer (32-bit, signed) is enough.
Are you sure? I ...
by Six of Three
Mon Sep 29, 2003 10:22 am
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 108991

Re: 101 output format

[c]printf("%2i:", pos);[/c]
This is similar to the Pascal code
[pascal]write(pos:2,':');[/pascal]
which reproduces the sample output with leading blanks in front of 0-9, but generates a presentation error. The correct output should be achieved by
[c]printf("%i:", pos);[/c]
or the Pascal version ...
by Six of Three
Mon Sep 29, 2003 9:05 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318353

I used a workaround for the problem in PASCAL, combining 2 longints and thus emulating 48bit integers which were long enough.
I wonder if you could use the (AFAIK) 64bit integer type "comp", which I think is only part of Borland (Turbo) Pascal. Is there a similar integer type in freepascal?

Go to advanced search