Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Executable-library/Pike/executable-library-3.pike
Normal file
23
Task/Executable-library/Pike/executable-library-3.pike
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
void main()
|
||||
{
|
||||
mapping long = ([]);
|
||||
|
||||
foreach (allocate(100000); int start; )
|
||||
long[sizeof(.Hailstone.hailstone(start))]++;
|
||||
|
||||
analyze(long);
|
||||
}
|
||||
|
||||
void analyze(mapping long)
|
||||
{
|
||||
mapping max = ([ "count":0, "length":0 ]);
|
||||
foreach (long; int length; int count)
|
||||
{
|
||||
if (count > max->count)
|
||||
{
|
||||
max->length = length;
|
||||
max->count = count;
|
||||
}
|
||||
}
|
||||
write("most common length %d appears %d times\n", max->length, max->count);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue