flake.lock: use jupyenv

This commit is contained in:
Dmitriy Pleshevskiy 2023-05-11 14:03:33 +03:00
parent 89f95d011e
commit 7bb5f5d546
Signed by: pleshevskiy
GPG Key ID: 79C4487B44403985
8 changed files with 519 additions and 130 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.jupyter

View File

@ -3,16 +3,15 @@
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1631705391,
"narHash": "sha256-PzP6vikNJZiS7yANC6sZWQlIDf4E2MTckvAsJxwV0DQ=",
"owner": "teto",
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "8e15c6e3c0f15d0687a2ab6ae92cc7fab896bfed",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "teto",
"ref": "support-packages",
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
@ -20,11 +19,11 @@
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1627913399,
"narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=",
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
@ -49,13 +48,32 @@
"type": "github"
}
},
"flake-utils": {
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"lastModified": 1673956053,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
@ -66,11 +84,11 @@
},
"flake-utils_2": {
"locked": {
"lastModified": 1631561581,
"narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=",
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
@ -110,6 +128,28 @@
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"jupyenv",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hls": {
"inputs": {
"flake-compat": "flake-compat_3",
@ -134,43 +174,101 @@
},
"ihaskell": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"flake-compat": [
"jupyenv",
"flake-compat"
],
"flake-utils": [
"jupyenv",
"flake-utils"
],
"hls": "hls",
"nixpkgs": "nixpkgs_2"
"nixpkgs": [
"jupyenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1661486016,
"narHash": "sha256-Ch9dQ82fLV0QuyrJ+J1tVxxrSLSA+NIdiikvV0+Hvrs=",
"owner": "gibiansky",
"repo": "IHaskell",
"rev": "53f8e0773822ddf2cd392309ba27c8ff8e30202e",
"lastModified": 1671426600,
"narHash": "sha256-MahAFyp6AxY0H61U6zqJXM1NsckNNkK6iqONEtOPSK0=",
"owner": "ihaskell",
"repo": "ihaskell",
"rev": "1c22a874ac0c8ed019229f4a0cd5a0bfda017357",
"type": "github"
},
"original": {
"owner": "gibiansky",
"repo": "IHaskell",
"owner": "ihaskell",
"repo": "ihaskell",
"type": "github"
}
},
"jupyterWith": {
"jupyenv": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"ihaskell": "ihaskell",
"nixpkgs": "nixpkgs_3"
"nix-dart": "nix-dart",
"nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable",
"npmlock2nix": "npmlock2nix",
"opam-nix": "opam-nix",
"poetry2nix": "poetry2nix",
"pre-commit-hooks": "pre-commit-hooks_2",
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1661799532,
"narHash": "sha256-E2YL6Ycf59HWglKjSUV09bV8f15lEBGKLs6ahndmqaM=",
"lastModified": 1679071568,
"narHash": "sha256-3LAo9uXGTmfS4OsiiIuoxX9knEshziCyI1MxR40VKeU=",
"owner": "tweag",
"repo": "jupyterWith",
"rev": "0b7f2e843f023c89283daf53eabce322efc9ca7c",
"repo": "jupyenv",
"rev": "3ad2c9512c9efd586cf63adde454e734a8ce049c",
"type": "github"
},
"original": {
"owner": "tweag",
"repo": "jupyterWith",
"repo": "jupyenv",
"type": "github"
}
},
"mirage-opam-overlays": {
"flake": false,
"locked": {
"lastModified": 1661959605,
"narHash": "sha256-CPTuhYML3F4J58flfp3ZbMNhkRkVFKmBEYBZY5tnQwA=",
"owner": "dune-universe",
"repo": "mirage-opam-overlays",
"rev": "05f1c1823d891ce4d8adab91f5db3ac51d86dc0b",
"type": "github"
},
"original": {
"owner": "dune-universe",
"repo": "mirage-opam-overlays",
"type": "github"
}
},
"nix-dart": {
"inputs": {
"flake-utils": [
"jupyenv",
"flake-utils"
],
"nixpkgs": [
"jupyenv",
"nixpkgs"
],
"pub2nix": "pub2nix"
},
"locked": {
"lastModified": 1673740150,
"narHash": "sha256-JiZrr75JILHW7IaNW3MwpYn+084Q6/gnXScPR7Pozhs=",
"owner": "djacu",
"repo": "nix-dart",
"rev": "8ee4e1a5ec0cc6c1e15860c4733f741485e8231e",
"type": "github"
},
"original": {
"owner": "djacu",
"repo": "nix-dart",
"type": "github"
}
},
@ -190,17 +288,49 @@
"type": "github"
}
},
"nixpkgs_2": {
"nixpkgs-stable": {
"locked": {
"lastModified": 1634515797,
"narHash": "sha256-elgCUC2khtBkOSpE4gDymNvthTZAI4hGI2iNu3YEUkA=",
"lastModified": 1672580127,
"narHash": "sha256-3lW3xZslREhJogoOkjeZtlBtvFMyxHku7I/9IVehhT8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0874168639713f547c05947c76124f78441ea46c",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-22.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1673800717,
"narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5f0194220f2402b06f7f79bba6351895facb5acb",
"rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-22.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1673796341,
"narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6dccdc458512abce8d19f74195bb20fdb067df50",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
@ -208,44 +338,160 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
"lastModified": 1683408522,
"narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
"rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "release-21.11",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"npmlock2nix": {
"flake": false,
"locked": {
"lastModified": 1662096612,
"narHash": "sha256-R+Q8l5JuyJryRPdiIaYpO5O3A55rT+/pItBrKcy7LM4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "21de2b973f9fee595a7a1ac4693efff791245c34",
"lastModified": 1668989938,
"narHash": "sha256-/IxdS0AiqSN0/VEOLnnfHyi4nP17yPrkhGf6KlXVwrc=",
"owner": "nix-community",
"repo": "npmlock2nix",
"rev": "0ba0746d62974403daf717cded3f24c617622bc7",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "nix-community",
"repo": "npmlock2nix",
"rev": "0ba0746d62974403daf717cded3f24c617622bc7",
"type": "github"
}
},
"opam-nix": {
"inputs": {
"flake-compat": [
"jupyenv",
"flake-compat"
],
"flake-utils": [
"jupyenv",
"flake-utils"
],
"mirage-opam-overlays": "mirage-opam-overlays",
"nixpkgs": [
"jupyenv",
"nixpkgs"
],
"opam-overlays": "opam-overlays",
"opam-repository": "opam-repository",
"opam2json": "opam2json"
},
"locked": {
"lastModified": 1669990974,
"narHash": "sha256-wHhdlDUC/tBDVFBemeJPpqdIRdehKKbxbdMP0QjOhM4=",
"owner": "tweag",
"repo": "opam-nix",
"rev": "75199758e1954f78286e7e79c0e3916e28b732b0",
"type": "github"
},
"original": {
"owner": "tweag",
"repo": "opam-nix",
"rev": "75199758e1954f78286e7e79c0e3916e28b732b0",
"type": "github"
}
},
"opam-overlays": {
"flake": false,
"locked": {
"lastModified": 1654162756,
"narHash": "sha256-RV68fUK+O3zTx61iiHIoS0LvIk0E4voMp+0SwRg6G6c=",
"owner": "dune-universe",
"repo": "opam-overlays",
"rev": "c8f6ef0fc5272f254df4a971a47de7848cc1c8a4",
"type": "github"
},
"original": {
"owner": "dune-universe",
"repo": "opam-overlays",
"type": "github"
}
},
"opam-repository": {
"flake": false,
"locked": {
"lastModified": 1661161626,
"narHash": "sha256-J3P+mXLwE2oEKTlMnx8sYRxwD/uNGSKM0AkAB7BNTxA=",
"owner": "ocaml",
"repo": "opam-repository",
"rev": "54e69ff0949a3aaec0d5e3d67898bb7f279ab09f",
"type": "github"
},
"original": {
"owner": "ocaml",
"repo": "opam-repository",
"type": "github"
}
},
"opam2json": {
"inputs": {
"nixpkgs": [
"jupyenv",
"opam-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1665671715,
"narHash": "sha256-7f75C6fIkiLzfkwLpJxlQIKf+YORGsXGV8Dr2LDDi+A=",
"owner": "tweag",
"repo": "opam2json",
"rev": "32fa2dcd993a27f9e75ee46fb8b78a7cd5d05113",
"type": "github"
},
"original": {
"owner": "tweag",
"repo": "opam2json",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": [
"jupyenv",
"flake-utils"
],
"nixpkgs": [
"jupyenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1673926875,
"narHash": "sha256-QOsT76Al0Igpo0u5vtQJuDSOxrocX3sTD523pLPEklc=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "a5c454a834cd290dd4d33102ab8b4aa37d850e65",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-utils": [
"jupyterWith",
"jupyenv",
"ihaskell",
"hls",
"flake-utils"
],
"nixpkgs": [
"jupyterWith",
"jupyenv",
"ihaskell",
"hls",
"nixpkgs"
@ -265,25 +511,95 @@
"type": "github"
}
},
"root": {
"pre-commit-hooks_2": {
"inputs": {
"jupyterWith": "jupyterWith",
"nixpkgs": "nixpkgs_4",
"utils": "utils"
}
},
"utils": {
"flake-compat": "flake-compat_4",
"flake-utils": [
"jupyenv",
"flake-utils"
],
"gitignore": "gitignore_2",
"nixpkgs": [
"jupyenv",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"lastModified": 1674075316,
"narHash": "sha256-0uZuAcYBpNJLxr7n5O0vhwn3rSLpUTm9M5WGgmNQ+wM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "3e42a77571cc0463efa470dbcffa063977a521ab",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"pub2nix": {
"flake": false,
"locked": {
"lastModified": 1594192744,
"narHash": "sha256-pDvcXSG1Mh2BpwkqAcNDJzcupV3pIAAtZJLfkiHMAz4=",
"owner": "paulyoung",
"repo": "pub2nix",
"rev": "0c7ecca590fcd1616db8c6468f799ffef36c85e9",
"type": "github"
},
"original": {
"owner": "paulyoung",
"repo": "pub2nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"jupyenv": "jupyenv",
"nixpkgs": "nixpkgs_3"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"jupyenv",
"flake-utils"
],
"nixpkgs": [
"jupyenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1674008920,
"narHash": "sha256-ugwPxKjvmJ5GpzN/MHg8tuhe8nYi3SbJm5nWNy7CB0Q=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "eecc44934a0f6c02c02856b38bd3b6af3bec0870",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}

View File

@ -1,36 +1,40 @@
{
inputs = {
jupyterWith.url = "github:tweag/jupyterWith";
utils.url = "github:numtide/flake-utils";
};
nixConfig.extra-substituters = [
"https://tweag-jupyter.cachix.org"
];
nixConfig.extra-trusted-public-keys = [
"tweag-jupyter.cachix.org-1:UtNH4Zs6hVUFpFBTLaA4ejYavPo5EFFqgd7G7FxGW9g="
];
outputs = { self, nixpkgs, jupyterWith, utils }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = builtins.attrValues jupyterWith.overlays;
};
inputs.flake-compat.url = "github:edolstra/flake-compat";
inputs.flake-compat.flake = false;
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.jupyenv.url = "github:tweag/jupyenv";
iHaskell = pkgs.kernels.iHaskellWith {
name = "haskell";
packages = p: [ ];
};
iNix = pkgs.kernels.iNixKernel {
name = "nix";
};
jupyterLab = pkgs.jupyterlabWith {
kernels = [ iHaskell iNix ];
};
in
{
apps.default = {
type = "app";
program = "${jupyterLab}/bin/jupyter-lab";
};
devShell = jupyterLab.env;
});
outputs =
{ flake-utils
, jupyenv
, ...
} @ inputs:
flake-utils.lib.eachSystem
[
flake-utils.lib.system.x86_64-linux
]
(
system:
let
inherit (jupyenv.lib.${system}) mkJupyterlabNew;
jupyterlab = mkJupyterlabNew ({ ... }: {
nixpkgs = inputs.nixpkgs;
imports = [ (import ./kernels.nix) ];
});
in
{
packages = { inherit jupyterlab; };
packages.default = jupyterlab;
apps.default.program = "${jupyterlab}/bin/jupyter-lab";
apps.default.type = "app";
}
);
}

6
kernels.nix Normal file
View File

@ -0,0 +1,6 @@
{ pkgs, ... }: {
kernel.haskell."Haskell".enable = true;
kernel.nix."Nix".enable = true;
kernel.rust."Rust".enable = true;
kernel.typescript."Typescript".enable = true;
}

View File

@ -1,3 +1,6 @@
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
# Problem
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get
3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

View File

@ -2,9 +2,11 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 9,
"id": "f6a5bb29-6834-41a0-a929-8e035675eb9d",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"predict x = x `rem` 3 == 0 || x `rem` 5 == 0"
@ -14,7 +16,9 @@
"cell_type": "code",
"execution_count": null,
"id": "3ce07c68-c750-4d39-b593-dcdb6e22fade",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"filtered = filter predict [1..999]"
@ -24,7 +28,9 @@
"cell_type": "code",
"execution_count": null,
"id": "52551454-c27c-4ac7-8967-02d9f1704fc8",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
@ -37,14 +43,28 @@
}
],
"source": [
"-- filtered"
"filtered"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1437aa9e-c83a-4bbb-a5c3-be4415f8b3f2",
"metadata": {},
"id": "311e677a-7185-4718-a839-ace350ecb502",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"main = sum filtered"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1fa76786-d8fa-4a63-9cd6-d4b4ec50634a",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
@ -57,13 +77,13 @@
}
],
"source": [
"sum filtered"
"main"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "311e677a-7185-4718-a839-ace350ecb502",
"id": "938bb0bd-7227-4770-bcd5-3d595c9a8868",
"metadata": {},
"outputs": [],
"source": []
@ -71,12 +91,12 @@
],
"metadata": {
"kernelspec": {
"display_name": "Haskell - haskell",
"display_name": "haskell-Haskell kernel",
"language": "haskell",
"name": "ihaskell_haskell"
"name": "haskell-haskell"
},
"language_info": {
"codemirror_mode": "ihaskell",
"codemirror_mode": "Haskell",
"file_extension": ".hs",
"mimetype": "text/x-haskell",
"name": "haskell",

View File

@ -4,14 +4,16 @@
"cell_type": "code",
"execution_count": 1,
"id": "bff727d0-70bf-42cf-a12c-ee5823037315",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
":l <nixpkgs>\n",
"Added 17051 variables.\u001b[0m\n",
"Added 18073 variables.\u001b[0m\n",
"\n"
]
}
@ -32,7 +34,9 @@
"cell_type": "code",
"execution_count": 2,
"id": "8773113c-494f-45d8-a8c1-4f1ac8b60266",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
@ -59,7 +63,9 @@
"cell_type": "code",
"execution_count": 3,
"id": "25c08a9f-b2ef-451a-9791-f0fd75cf6f00",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
@ -76,9 +82,11 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 4,
"id": "754560b4-01c3-401c-a9ab-14fe56a9a80c",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
@ -95,9 +103,11 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 5,
"id": "1bbc464a-bedc-4742-ae1d-d06039df53f5",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
@ -114,9 +124,11 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 6,
"id": "5a08e129-b2fe-43b5-a22f-bb6a0e69adb6",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
@ -133,30 +145,53 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 8,
"id": "1dcaf52d-5526-4755-9454-d79238b9454f",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sum filtered\n",
"main = sum filtered\n",
"\n"
]
}
],
"source": [
"main = sum filtered"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "49a4669c-047f-4b14-9d9a-a0d9feb4bef9",
"metadata": {
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"main\n",
"\u001b[36;1m233168\u001b[0m\n",
"\n"
]
}
],
"source": [
"sum filtered"
"main"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Nix - nix",
"display_name": "nix-Nix kernel",
"language": "Nix",
"name": "inix_nix"
"name": "nix-nix"
},
"language_info": {
"file_extension": ".nix",

View File

@ -1,5 +1,9 @@
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
# Problem
Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
By considering the terms in the Fibonacci sequence whose values do not exceed
four million, find the sum of the even-valued terms.