<commit_before>use v6;

=begin pod

=TITLE Divisibility streaks

=AUTHOR <NAME>

L<http://projecteuler.net/problem=601>


=head2 Usage

=end pod

sub calc_P($s, $N)
{
    my $l = [lcm] 1 .. $s;
    my $i = 0;
    my $ret = 0;
    my $t = $s + 1;
    my $M = $N - 1;
    while (($i = $i + $l) < $M)
    {
        ++$ret if $i % $t;
    }
    return $ret;
}

sub print_P($s, $N)
{
    my $ret = calc_P($s, $N);
    say "calc_P(s=$s, N=$N) = $ret";
    return $ret;<commit_msg>Speedup by using native ints.<commit_after>use v6;

=begin pod

=TITLE Divisibility streaks

=AUTHOR <NAME>

L<http://projecteuler.net/problem=601>


=head2 Usage

=end pod

sub calc_P($s, $N)
{
    my int $l = [lcm] 1 .. $s;
    my int $i = 0;
    my int $ret = 0;
    my int $t = $s + 1;
    my int $M = $N - 1;
    while (($i = $i + $l) < $M)
    {
        ++$ret if $i % $t;
    }
    return $ret;
}

sub print_P($s, $N)
{
    my $ret = calc_P($s, $N);
    say "calc_P(s=$s, N=$N) = $ret";
    return $ret;
{'fraction_non_alphanumeric': 0.20426829268292682, 'fraction_numerical': 0.02032520325203252, 'mean_word_length': 2.167202572347267, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3380006', 'n_tokens_mistral': 488, 'n_tokens_neox': 464, 'n_words': 128}