An open API service indexing awesome lists of open source software.

https://github.com/dnmfarrell/excellent

Haskell module for finding Excellent numbers
https://github.com/dnmfarrell/excellent

Last synced: 12 months ago
JSON representation

Haskell module for finding Excellent numbers

Awesome Lists containing this project

README

          

=pod

=encoding utf8

=head1 Excellent

Excellent - Haskell module for calculating Excellent numbers

=head2 Synopsis

$ ghci
ghci> :l Excellent.hs
[1 of 1] Compiling Excellent ( Excellent.hs, interpreted )

ghci> filter (\x -> intExcellent (intSplit x)) [1..100]
[48]

=head2 Version

0.04

=head2 Description

F exports a boolean function called C which checks for Excellent numbers, and C which divides an integer into two halves.

An excellent number is any even digits-length integer where the difference between its two halves squared equals the original integer.

For example, 48 is excellent:

48 = abs(4^2 - 8^2)

So is 3468:

3468 = abs(34^2 - 68^2)

And so on.

=head2 Compiling

Excellent comes with F which will run forever, printing Excellent numbers to the command line.

$ ghc -O2 main.hs
$ ./main
[48,3468,140400,190476,216513,300625,334668,416768,484848,530901 ...

=head2 Thanks

Thanks to Tom Murphy and L for helping with the Haskell code.

=head2 See Also

This module was inspired by brian d foy's L on calculating Excellent Numbers with Perl, and Mark Jason Dominus' original L on the same topic.

=head2 Author

David Farrell E 2015

=head2 License

FreeBSD, see LICENSE