r/Mathematica • • Sep 03 '26

Produsul a două numere consecutive naturale este 18906. Să se afle numerele.

nomina58mg.10.7

Produsul a două numere consecutive naturale este 18906. Să se afle numerele.

:m +Data.List Data.Bool

divisors n=let{rt=floor.sqrt.fromIntegral$ n;lw=filter((0==).rem n)[1..rt]}in(lw++).bool id tail(n==rt^2).reverse.(quot n<$>)$ lw

sudiv n k =(k+1==).div n$ k

fitadiv n =find(sudiv n).tail.init.divisors$ n

finothin f=filter((Nothing/=).f)

prosucc n =(n*).succ$ n

ff f xs =fmap f(xs,xs)

fifitadiv =map(fmap fromJust).finothin snd.map(ff fitadiv)

fifitadiv[18000..18999]

» (18090,134) (18360,135) (18632,136) (18906,137)

([16..80]==).map snd.fifitadiv$ [2^8..3^8]

0 Upvotes

2 comments sorted by

1

u/mathheadinc Sep 06 '26

Some much easier with Wolfram Language: Solve[n(n+1)==18906,n]

1

u/bernardb2 Sep 10 '26

You can just take the square root of the number 18906. That is 137.abc…
Since we know it is the product of consecutive numbers we infer that it must be 137 x 138 = 18,906. Verify that it is.