{"id":6259,"date":"2020-05-02T18:38:03","date_gmt":"2020-05-02T09:38:03","guid":{"rendered":"https:\/\/pandanote.info\/?p=6259"},"modified":"2020-05-02T18:38:03","modified_gmt":"2020-05-02T09:38:03","slug":"n-bonacci%e6%95%b0%e5%88%97%e3%82%92%e5%87%ba%e5%8a%9b%e3%81%99%e3%82%8bscala%e3%81%ae%e3%82%b3%e3%83%bc%e3%83%89%e3%82%92%e6%9b%b8%e3%81%84%e3%81%a6%e3%81%bf%e3%81%9f%e3%80%82","status":"publish","type":"post","link":"https:\/\/pandanote.info\/?p=6259","title":{"rendered":"n-bonacci\u6570\u5217\u3092\u51fa\u529b\u3059\u308bScala\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u307f\u305f\u3002"},"content":{"rendered":"<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p><a href=\"https:\/\/sidestory.pandanote.info\/nbonacci.html\">\u3053\u306e\u8a18\u4e8b<\/a>\u3067nbonacci\u6570\u5217\u3092\u8a08\u7b97\u3059\u308bPython3\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u307f\u305f\u306e\u3067\u3001\u305d\u306e\u52e2\u3044\u306b\u4e57\u3063\u3066Scala\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3082\u66f8\u3044\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>\u3055\u3063\u305d\u304f\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002<\/h2>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002sbt\u3092\u4f7f\u3063\u3066FAT jar\u3092\u4f5c\u3063\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u307b\u307c\u524d\u63d0\u306e\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u306b\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u51e6\u7406\u306bscopt\u3092\u4f7f\u3046\u306e\u304c\u524d\u63d0\u306e\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u305f\u308a\u3057\u307e\u3059\u304c\u3001\u305d\u306e\u3042\u305f\u308a\u306e\u70b9\u306f\u5e73\u306b\u3054\u5bb9\u8d66\u304f\u3060\u3055\u3044\u3002\ud83d\ude47\u200d\u2642\ufe0f<br \/>\n<script src=\"https:\/\/gist.github.com\/pandanote-info\/4fa7111d4d6df5e7b4f1f9b0bc3c9c05.js\"><\/script><br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001scopt\u3092\u7528\u3044\u305f\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u51e6\u7406\u306e\u305f\u3081\u306e\u30b3\u30fc\u30c9\u304c\u884c\u6570\u306b\u3057\u3066\u5168\u4f53\u306e2\/3\u304f\u3089\u3044\u3092\u5360\u3081\u308b\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u3066\u3001nbonacci\u6570\u5217\u306e\u8a08\u7b97\u3092\u884c\u3046\u30b3\u30fc\u30c9\u306f46\u884c\u76ee\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002<a href=\"https:\/\/sidestory.pandanote.info\/nbonacci.html\">\u3053\u306e\u8a18\u4e8b<\/a>\u306ePython3\u306e\u6570\u5217\u306e\u8a08\u7b97\u3092\u884c\u3046\u305f\u3081\u306e\u30b3\u30fc\u30c9\u3068\u6bd4\u8f03\u3059\u308b\u3068\u3001Scala\u306e\u65b9\u3067\u306f\u30b3\u30fc\u30c9\u30d6\u30ed\u30c3\u30af\u306e\u5883\u754c\u3092\u793a\u3059\u62ec\u5f27({,})\u304c\u3042\u308b\u5206\u3060\u3051\u30b3\u30fc\u30c9\u306e\u884c\u6570\u304c\u5897\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u52d5\u4f5c\u306e\u78ba\u8a8d\u3002<\/h2>\n<p>\u524d\u7bc0\u3067\u793a\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3067FAT jar\u3092\u4f5c\u6210\u3057\u3066\u52d5\u4f5c\u78ba\u8a8d\u3067\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u4f7f\u7528\u3067\u304d\u308b\u4ed5\u69d8\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ul>\n<li>-a &lt;integer&gt;: \u6b21\u306e\u9805\u3092\u6c42\u3081\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u9805\u306e\u6570\u30023\u9805\u9593\u6f38\u5316\u5f0f\u3067\u3042\u308c\u30702\u3068\u306a\u308a\u307e\u3059\u3002<\/li>\n<li>-n &lt;integer&gt;: \u8a08\u7b97\u306e\u5bfe\u8c61\u3068\u306a\u308b\u9805\u306e\u6570\u3002\u521d\u9805\u304b\u3089\u306e\u9805\u6570\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u3001&#8221;-a&#8221;\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u3068\u3082\u306b\u6307\u5b9a\u3057\u305f\u5024\u3092a\u3001&#8221;-n&#8221;\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u3068\u3082\u306b\u6307\u5b9a\u3057\u305f\u5024\u3092n\u3068\u305d\u308c\u305e\u308c\u304a\u304d\u307e\u3059\u3002<\/p>\n<h3>a = 2, n = 10<\/h3>\n<p><code><br \/>\nC:\\Users\\Pandanote\\scala\\NBonacciTest>java -jar target\\scala-2.13\\nbonaccitest-assembly-0.1.0-SNAPSHOT.jar -a 2 -n 10<br \/>\n0<br \/>\n1<br \/>\n1<br \/>\n2<br \/>\n3<br \/>\n5<br \/>\n8<br \/>\n13<br \/>\n21<br \/>\n34<br \/>\n<\/code><\/p>\n<h3>a = 3, n = 10<\/h3>\n<p><code>C:\\Users\\Pandanote\\scala\\NBonacciTest> java -jar target\\scala-2.13\\nbonaccitest-assembly-0.1.0-SNAPSHOT.jar -a 3 -n 10<br \/>\n0<br \/>\n0<br \/>\n1<br \/>\n1<br \/>\n2<br \/>\n4<br \/>\n7<br \/>\n13<br \/>\n24<br \/>\n44<br \/>\n<\/code><\/p>\n<h3>a = 4, n = 15<\/h3>\n<p><code>C:\\Users\\Pandanote\\scala\\NBonacciTest> java -jar target\\scala-2.13\\nbonaccitest-assembly-0.1.0-SNAPSHOT.jar -a 4 -n 15<br \/>\n0<br \/>\n0<br \/>\n0<br \/>\n1<br \/>\n1<br \/>\n2<br \/>\n4<br \/>\n8<br \/>\n15<br \/>\n29<br \/>\n56<br \/>\n108<br \/>\n208<br \/>\n401<br \/>\n773<br \/>\n<\/code><\/p>\n<h3>a = 5, n = 30<\/h3>\n<p><code>C:\\Users\\Pandanote\\scala\\NBonacciTest> java -jar target\\scala-2.13\\nbonaccitest-assembly-0.1.0-SNAPSHOT.jar -a 5 -n 30<br \/>\n0<br \/>\n0<br \/>\n0<br \/>\n0<br \/>\n1<br \/>\n1<br \/>\n2<br \/>\n4<br \/>\n8<br \/>\n16<br \/>\n31<br \/>\n61<br \/>\n120<br \/>\n236<br \/>\n464<br \/>\n912<br \/>\n1793<br \/>\n3525<br \/>\n6930<br \/>\n13624<br \/>\n26784<br \/>\n52656<br \/>\n103519<br \/>\n203513<br \/>\n400096<br \/>\n786568<br \/>\n1546352<br \/>\n3040048<br \/>\n5976577<br \/>\n11749641<br \/>\n<\/code><\/p>\n<h3>a = 0, n = 300<\/h3>\n<p>\u203b\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306e\u8868\u793a\u4f8b\u3067\u3059\u3002<br \/>\n<code>C:\\Users\\Pandanote\\scala\\NBonacciTest> java -jar target\\scala-2.13\\nbonaccitest-assembly-0.1.0-SNAPSHOT.jar -a 0 -n 300<br \/>\nError: Value <a> must be a positive integer<br \/>\nTry --help for more information.<br \/>\n<\/code><\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u5b9f\u306f\u3053\u306e\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u3044\u308b\u6700\u4e2d\u306b<a href=\"https:\/\/sidestory.pandanote.info\/nbonacci.html\">\u3053\u306e\u8a18\u4e8b<\/a>\u306e$a \\ge 3$\u306e\u969b\u306e\u6700\u521d\u306e$a-1$\u9805\u306e\u5024\u306f1\u3068\u3057\u3066\u3044\u305f\u306e\u306f\u8aa4\u308a\u3063\u307d\u3044\u3053\u3068\u306b\u6c17\u304c\u4ed8\u3044\u305f\u306e\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3068\u3082\u3069\u3082\u3057\u308c\u3063\u3068\u4fee\u6b63\u3057\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u82f1\u8a9e\u7248\u306eWikipedia\u306b\u306f<a href=\"https:\/\/en.wikipedia.org\/wiki\/Generalizations_of_Fibonacci_numbers\">\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u3092\u3044\u308d\u3044\u308d\u306a\u65b9\u5411\u306b\u62e1\u5f35\u3057\u307e\u304f\u3063\u305f\u6570\u5217\u7fa4\u306b\u3064\u3044\u3066\u306e\u6027\u8cea<\/a>\u7b49\u304c\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u3054\u89a7\u3044\u305f\u3060\u3051\u308b\u3068\u3088\u308d\u3057\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u8a18\u4e8b\u306f\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b \u3053\u306e\u8a18\u4e8b\u3067nbonacci\u6570\u5217\u3092\u8a08\u7b97\u3059\u308bPython3\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u307f\u305f\u306e\u3067\u3001\u305d\u306e\u52e2\u3044\u306b\u4e57\u3063\u3066Scala\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3082\u66f8\u3044\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002 \u3055\u3063\u305d\u304f\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002 \u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002sbt\u3092\u4f7f\u3063\u3066FAT jar\u3092\u4f5c\u3063\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u304c\u307b\u307c\u524d\u63d0\u306e\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u306b\u3001\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u51e6\u7406\u306bscopt\u3092\u4f7f\u3046\u306e\u304c\u524d\u63d0\u306e\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u305f\u308a\u3057\u307e\u3059\u304c\u3001\u305d\u2026 <span class=\"read-more\"><a href=\"https:\/\/pandanote.info\/?p=6259\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":6262,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,17],"tags":[],"class_list":["post-6259","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-emacs","category-scala"],"_links":{"self":[{"href":"https:\/\/pandanote.info\/index.php?rest_route=\/wp\/v2\/posts\/6259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pandanote.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pandanote.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pandanote.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pandanote.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6259"}],"version-history":[{"count":2,"href":"https:\/\/pandanote.info\/index.php?rest_route=\/wp\/v2\/posts\/6259\/revisions"}],"predecessor-version":[{"id":6261,"href":"https:\/\/pandanote.info\/index.php?rest_route=\/wp\/v2\/posts\/6259\/revisions\/6261"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pandanote.info\/index.php?rest_route=\/wp\/v2\/media\/6262"}],"wp:attachment":[{"href":"https:\/\/pandanote.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pandanote.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pandanote.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}