Euler problem 8.3

Directory[]

mString := Import["n.txt"]

nString := StringDelete[mString, "\n" | "\r"]

nList := Map[FromDigits, Characters[nString]]

take13[lst_] := Times @@ Take[lst,13]

Fmax13n[lst_, n_] := If[Length[lst] < 13,
                        n,
                        With[{t13 = take13[lst]},
                            If[n > t13,
                                Fmax13n[Rest[lst], n],
                                Fmax13n[Rest[lst], t13]]]]

Fmax13n[nList, 0]

Wmax13n[lst_, n_] := Which[
                        Length[lst] < 13, n,
                        t13 = take13[lst];
                            n > t13, Wmax13n[Rest[lst], n],
                            True, Wmax13n[Rest[lst], t13]]

Wmax13n[nList, 0]

Fmax13n[nList, 0] - Wmax13n[nList, 0]

— colorized by palette fm

— Me@2022-11-24 05:51:56 PM

.

.

2022.11.24 Thursday (c) All rights reserved by ACHK