Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
project euler 6, haskell
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
--http://www.haskell.org/haskellwiki/Euler_problems/1_to_10 --The sum of the squares of the first ten natural numbers is, --12 + 22 + ... + 102 = 385 --The square of the sum of the first ten natural numbers is, --(1 + 2 + ... + 10)2 = 552 = 3025 --Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640. --Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. problem_6 = (sum [1..100])^2 - sum (map (^2) [1..100]) main = print $ problem_6
ghc
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.32 sec, absolute running time: 0.14 sec, cpu time: 0 sec, memory peak: 2 Mb, absolute service time: 0.84 sec
fork mode
|
history
|
discussion
25164150