タグ付けされた質問 「fibonacci」

課題には、フィボナッチ数またはその一般化の1つが含まれます。

1
フィボナッチカーネルを見つける
あなたはおそらくフィボナッチ数を聞いたことがあるでしょう。彼らはかなり有名です。フィボナッチ数列の各数は、数列の最後の2つの合計で、最初の数と2番目の数は1です。数列は次のようになります。 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 2971215073 4807526976 7778742049 …


11
この番号は密かにフィボナッチですか?
バックグラウンド あなたのほとんどはフィボナッチ数が何であるか知っています。ツェッケンドルフの定理によれば、正の整数はすべて、1つ以上の異なるフィボナッチ数の合計として表現できることを知っている人もいるかもしれません。整数の最適なツェッケンドルフ表現の項の数n自体がフィボナッチ数である場合、n「密かに」フィボナッチと呼びます。 例えば: 139 = 89 + 34 + 13 + 3 This is a total of 4 integers. Since 4 is not a Fibonacci number, 139 is not secretly Fibonacci 140 = 89 + 34 + 13 + 3 + 1 This is a total of 5 integers. Since …

23
アスキーアートオクタゴン
入力整数を指定するとn > 1、n文字で構成される辺の長さのASCIIアートオクタゴンを出力します。以下の例を参照してください。 n=2 ## # # # # ## n=3 ### # # # # # # # # # # ### n=4 #### # # # # # # # # # # # # # # # # #### n=5 ##### # # # # # # …
22 code-golf  ascii-art  code-golf  geometry  code-golf  balanced-string  code-golf  cops-and-robbers  code-challenge  cops-and-robbers  code-golf  code-golf  random  cryptography  code-golf  array-manipulation  number  code-challenge  integer  code-golf  math  integer  code-golf  math  math  parsing  image-processing  test-battery  math  number  combinatorics  fastest-code  code-golf  code-golf  math  number-theory  rational-numbers  polynomials  code-golf  math  geometry  code-golf  code-golf  number-theory  primes  factoring  code-golf  restricted-source  code-golf  string  decision-problem  counting  code-golf  math  sequence  fibonacci  code-golf  array-manipulation  counting  code-golf  array-manipulation  number-theory  code-golf  array-manipulation  code-golf  random  code-golf  string  hexadecimal  code-golf  string  code-challenge  sorting  code-golf  number  floating-point  code-golf  sorting  code-golf  decision-problem  fibonacci  code-golf  number  combinatorics  code-golf  string  code-golf  math  code-golf  electrical-engineering  code-golf  javascript  code-golf  base-conversion  code-golf  array-manipulation  matrix  binary-matrix  code-golf  kolmogorov-complexity  python  perl  ruby  code-golf  number  code-golf  optimization  integer-partitions  code-golf  string  code-golf  ascii-art 

28
シンプルなワードラッパーを作成する
(注:これは私の初めてのコードゴルフの質問ですが、私が知る限り、誰もこれを正確に行っていないので、私は良いはずです。) あなたの仕事は、文字列sと整数を取り込んで、n複数の行に折り返されたテキストを返すか出力するプログラムまたは関数を作成することです。各単語は完全に1行である必要があります。つまり、途中で単語が分割されません。各行はn文字より長くすることはできません。また、各行にできるだけ多くの単語を収める必要があります。 例: s = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eget erat lectus. Morbi mi mi, fringilla sed suscipit ullamcorper, tristique at mauris. Morbi non commodo nibh. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed at iaculis mauris. Praesent a …
22 code-golf  string  code-golf  string  parsing  apl  math  primes  integer  fastest-code  code-golf  math  primes  integer  code-golf  ascii-art  kolmogorov-complexity  code-golf  string  array-manipulation  code-golf  number  code-golf  sequence  code-golf  math  arithmetic  code-golf  date  conversion  code-golf  geometry  combinatorics  grid  code-golf  string  code-golf  counting  java  code-golf  chess  code-golf  path-finding  conversion  atomic-code-golf  logic-gates  code-golf  fibonacci  code-golf  ascii-art  fractal  code-golf  quine  code-golf  string  code-golf  array-manipulation  decision-problem  code-golf  quine  code-golf  code-challenge  array-manipulation  code-challenge  word-search  code-golf  binary  conversion  code-golf  code-golf  restricted-source  code-golf  kolmogorov-complexity  restricted-source  code-golf  kolmogorov-complexity  random  animation 

10
フィボナッチのようなシーケンスの最小の初期数
正の整数入力Nが与えられると、2つの非負の数aとbを出力します。ここでa <bであり、数Nが繰り返し関係シーケンスの一部となる可能な最小の平均値を持ちます。 f(0) = a f(1) = b f(n) = f(n-2)+f(n-1) 場合には、平均以上の解決策があるとbが、その後、最小限であるあなたが出力すべき最低で1 B。 Nは、言語/システムの整数の代表的な範囲内にあると仮定できます。 テストケース N = 1 a = 0, b = 1 N = 15 a = 0, b = 3 N = 21 a = 0, b = 1 N = 27 a = 0, b = …

14
n番目のフィボナッチ数を含むn番目のフィボナッチ数を出力します!
チャレンジ n入力として正の整数を取り、サブトリングとしてth Fib#nを含むthフィボナッチ数(全体を通してFib#として短縮)を出力するプログラムを作成する必要がありますn。この課題のために、フィボナッチ数列はで始まります1。 テストケースとして、または課題を明確にするための例として使用できる例をいくつか示します(後者については、不明な点を説明するコメントを下に残してください)。 n=1 Fib#s: 1 ^1 1st Fib# that contains a 1 (1st Fib#) Output: 1 n=2 Fib#s: 1, 1 ^1 ^2 2nd Fib# that contains a 1 (2nd Fib#) Output: 1 n=3 Fib#s: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 ^1 …

18
Iccanobifシーケンスを出力する
nOEISにA014258として文書化されている、Iccanobifシーケンスのth番目までのシーケンスを出力または返すプログラムまたは名前付き関数を作成します。がゼロの0場合、シーケンスのゼロ番目の要素()のみが出力されることに注意してくださいn。 シーケンスは、標準のフィボナッチシーケンスと同様に開始することで生成されますが、前の2つの数値を追加した後、結果を反転し、先行ゼロを削除します。少なくとも私にとって興味深い事実は、このシーケンスが厳密に増加していないことです(以下のリストを参照)。また、厳密にフィボナッチ数列以上であるようです(おそらくそうです)。 プログラムの入力は整数でなければなりません。 シーケンスの最初の20の数字は、視聴の楽しみのためにここに提供されています。 0, 1, 1, 2, 3, 5, 8, 31, 93, 421, 415, 638, 3501, 9314, 51821, 53116, 739401, 715297, 8964541, 8389769 標準的な抜け穴は禁止されています。 最短のプログラムが勝ちます。 編集:シーケンスがゼロ番目の要素で始まり、ゼロの場合に含める必要があることを明確にするためのメモを追加しましたn。 IOの例: 0 -> 0 1 -> 0 1 6 -> 0 1 1 2 3 5 8 17 -> [0, 1, 1, 2, …

12
拡張フィボナッチ数のインデックス付け
あなたはおそらくフィボナッチ数を聞いたことがあるでしょう。や、知っている、その整数シーケンスはで始まり1, 1、新しい番号はそれぞれ最後の2つの合計ですか? 1 1 2 3 5 8 13... 等々。フィボナッチ数に関する課題は、ここでかなり人気があります。しかし、誰がフィボナッチ数列を始めなければならないと言うの1, 1でしょうか?なぜ始められなかったの0, 1ですか?それでは、0から開始するように再定義しましょう。 0 1 1 2 3 5 8 13... しかし...私たちもそこでやめる必要はありません!最後の2つの数値を追加して次の数値を取得できる場合、2番目の数値から最初の数値を減算して新しい数値を追加することもできます。したがって、次のように開始でき1, 0ます。 1 0 1 1 2 3 5 8 13... ネガティブになることさえあります: -1 1 0 1 1 2 3 5 8 13... そして、このシリーズも永遠に続きます。他のすべての数字が負になっているだけで、通常のフィボナッチ数列をミラーリングするのは面白いと思います: 13 -8 5 -3 2 -1 1 …

3
人生がレモンを与えたら、レモネードを作りなさい
チャレンジ あなたはどこにでも単語が、入力文字列が与えられます"Lemon"、それはに変換する必要が発見され"Lemonade" たがa、d、およびe文のどこかから借りなければなりません。 例 入力例: 子供の頃にレモンを見つけました 出力例: 私は子供の頃レモネードを作りました レモネードは、元から次の上付き文字を盗んで作成されました 私はフン日間レモネードWH 電子を nは私がいた子供 これは、「e」、「d」、および「a」という可能な出力例の1つにすぎません。これはどこからでも取得できます(もちろん、単語以外はlemon) コメント •、、またはsが十分eでない場合は、指定された文字で実行可能なことを出力する必要があります。たとえば、入力は出力されますadbdblemonbblemond • lemonテキストは常にスタンドアロン(各側のスペース)であるとは限りません。たとえばlemons、入力のどこかに単語があり、出力は次のようになります。lemonades •入力にはlemon、0であっても任意の数のsを含めることができますlemon(この場合、出力は入力と同一になります)。 •レモネードを大文字と小文字で作成できます。たとえば、にleMonなる可能性がleMonadeあり、ade借りたものはどのような場合でも可能です(したがって、になる可能性もありますleMonADe)。あなたが借りた手紙のケースは、あなたがそれを借りたときの状態のままでなければなりません。(入力例->出力、he hAD lemOn-> h h lemOnADe) •完全なプログラムである必要はありません。機能だけで十分です。 •入力はCP437文字セットのみであると仮定できます。 コードゴルフ これはcode-golfであるため、バイト数が最も少なくなります! 擬似テストケース *注意:特定の入力に対して複数の出力が存在する可能性があるため、プログラムはこれらのテストケースのように正確に出力されない場合があります。これは、人々がロジックを理解できるようにするためです。 入力:EpaD leMons 出力:p LeMonaDEs 入力:hello world 出力:hello world 入力:レモンレモン 出力:レモンレモン *( 、、 文字は別の「レモン」から取られてはいけません)ead 入力:HE HADレモネード 出力:HH lemonADEade 入力:あなたはレモンが好きですか?あなたはレモンで私を苦しめました! 出力:o lemonADesが好きですか?あなたはレモネードを盛り上げました! …
21 code-golf  string  code-golf  parsing  internet  stack-exchange-api  code-challenge  kolmogorov-complexity  restricted-source  brain-flak  python  logic  pyth  code-golf  string  search  optimized-output  code-golf  tips  language-design  golfing-language  code-golf  tips  language-design  code-golf  number  sorting  pi  code-golf  math  number  code-golf  string  balanced-string  classification  brain-flak  code-golf  math  number-theory  decision-problem  code-golf  tips  code-golf  number  sequence  code-golf  balanced-string  brain-flak  code-golf  math  sequence  arithmetic  fibonacci  code-golf  math  parsing  code-golf  string  keyboard  code-golf  code-golf  string  source-layout  whitespace  code-golf  math  rational-numbers  code-golf  string  code-golf  string  code-golf  math  sequence  code-golf  number  floating-point  code-golf  string  decision-problem  subsequence  code-golf  string  kolmogorov-complexity  code-golf  string  permutations  balanced-string  brain-flak  code-golf  string  math  number  code-golf  string  primes  cipher  code-golf  string  ascii-art  chemistry  code-golf  ascii-art  grid  counting  code-golf  math  arithmetic  integer  code-golf  number  kolmogorov-complexity  code-golf  ascii-art  kolmogorov-complexity  sequence  metagolf  brain-flak  code-golf  ascii-art  kolmogorov-complexity  code-golf  string  whitespace 

3
原子プロポーションのゲーム
あなたのタスクはAtomasをプレイするボットを作成し、最高スコアを獲得します。 ゲームの仕組み: ゲームボードは、6つの「原子」のリングから始まります。 1します3。原子自体に応じて、2つの原子間または別の原子上で原子を「再生」できます。 通常のアトムまたは特別なアトムを使用できます。 通常の原子: ボード上の任意の2つの利用可能な原子の間で通常の原子を再生できます。 範囲内の原子から始めます1 to 3が、範囲は40移動ごとに1ずつ増加します(したがって、40移動後に範囲は2 to 4)。 ボード上に範囲よりも低い原子がある場合1 / no. of atoms of that number on the board、スポーンする可能性があります。 2プレイする必要があるとしましょう。ボードは次のようになります。 1 1 2 1 2の右側に配置しましょう1。 ボードは次のようになります。 1 1 2 1 2 注:ボードは折り返されているので、1左端は実際には2右端のます。これは後で重要になります。 「特別な」アトムには4つのタイプがあり、それらは次のとおりです。 の +アトム: このアトムは、2つのアトム間で再生されます。産卵の確率は5分の1です。 原子の両側の+原子が同じ場合、融合が発生します。仕組みは次のとおりです。 The two atoms fuse together to create an atom …
21 code-challenge  game  code-golf  combinatorics  permutations  code-golf  image-processing  brainfuck  encode  steganography  code-golf  ascii-art  code-golf  ascii-art  kolmogorov-complexity  code-golf  ascii-art  fibonacci  code-golf  string  code-golf  sorting  popularity-contest  statistics  code-golf  ascii-art  kolmogorov-complexity  code-golf  code-golf  ascii-art  tic-tac-toe  code-golf  string  code-challenge  classification  test-battery  binary-matrix  code-golf  math  arithmetic  code-golf  ascii-art  random  code-golf  string  code-golf  number  binary  bitwise  code-golf  number  arithmetic  code-golf  math  ascii-art  code-golf  string  ascii-art  code-golf  string  ascii-art  code-golf  string  code-golf  counting  code-golf  number  binary  bitwise  decision-problem  code-golf  array-manipulation  code-golf  tips  brain-flak  code-challenge  quine  source-layout  code-generation  code-golf  linear-algebra  matrix  abstract-algebra  binary-matrix  code-golf  string  palindrome  code-golf  puzzle-solver  sudoku  code-golf  ascii-art  code-golf  graphical-output  internet  code-golf  ascii-art  kolmogorov-complexity  code-golf  math  code-golf  clock 

30
指定された幅で#の中空の正方形を描画します
私はCodingameからこの課題を受け取り、私のものよりも優れたソリューションに興味があります。 標準入力を使用して幅を指定すると、指定された幅と長さで「#」の中空の四角形が描画されます。 例: 5の結果 ##### # # # # # # ##### 私はこれを解決するためにPythonを使用したので、他のPythonコードに特に興味があります。ただし、必要な言語でソリューションを投稿してください。
21 code-golf  string  ascii-art  number  code-golf  grid  code-golf  string  ascii-art  code-golf  alphabet  cipher  code-golf  math  number  code-golf  quine  code-golf  palindrome  polyglot  code-golf  number  array-manipulation  counting  logic  code-golf  string  primes  binary  decision-problem  code-golf  ascii-art  kolmogorov-complexity  popularity-contest  code-golf  probability-theory  code-golf  string  code-golf  python  polyglot  programming-puzzle  c++  code-golf  math  code-golf  binary  integer  bitwise  code-golf  rational-numbers  code-golf  string  palindrome  code-golf  ascii-art  code-golf  code-golf  string  fibonacci  code-golf  math  sequence  code-golf  code-golf  string  palindrome  code-golf  string  code-golf  math  primes  source-layout  code-golf  sequence  binary  integer  code-golf  math  arithmetic  game  code-golf  restricted-source  palindrome  code-golf  restricted-source  palindrome  code-golf  combinatorics  binary  code-golf  string  math  code-golf  ascii-art  number  code-golf  cipher  code-golf  base-conversion  counting  code-golf  sequence  random  classification  code-golf  string  subsequence  code-golf  permutations  code-golf  string  code-golf  string  cipher  code-golf  kolmogorov-complexity  arithmetic  integer  code-golf  quine  markov-chain  code-golf  string  code-golf  code-golf  ascii-art  maze 

10
フィボナッチ分解
フィボナッチ数 フィボナッチ数で始まるf(1) = 1とf(2) = 1(いくつかは、f(0) = 0これは、この挑戦とは無関係である。その後、のためにn > 2、f(n) = f(n-1) + f(n-2)。 チャレンジ あなたの仕事はn、フィボナッチ数の積として表現できる正の正の数を見つけて出力することです。インデックスを0にするか、インデックスを1にするか、どちらか適切な方を選択できますが、回答でこれを指定する必要があります。 また、あなたの答えは、妥当な時間で100番目の用語を計算する必要があります。 テストケース n result corresponding product (for reference) 1 1 1 2 2 2 3 3 3 4 4 2*2 5 5 5 6 6 2*3 7 8 2*2*2 or 8 8 9 3*3 …

21
こんにちは世界!!!フィボナッチ分布
プログラムは正確に出力する必要があります:Hello world!!!改行ありまたは改行なし。 プログラムには何も入力しないでください。 ソースコードの文字分布は、次の条件に従って正しくなければなりません。 数字の数(0-9)は、正確に1つのフィボナッチ数列でなければなりません。 ソースコード内のその他の数字以外の文字!(0-9)の数は、上記のフィボナッチシーケンス番号の前のフィボナッチシーケンス番号でなければなりません。 ソースコード内の有効な文字分布の4つの例: 13桁の数字、8桁の非数字。 34桁の数字、21桁の非数字。 数字55文字、数字以外の文字34文字。 89桁の数字、55桁の非数字。 これはコードゴルフで、バイト単位の最短コードが勝ちです!がんばろう! 編集:この質問は、コードゴルフであることに加えてソースコードのサイズに制約があるため、受け入れられる回答(複数のシェアが同じ勝利キャラクターの長さである場合)は、投票数が多く(文字数が最小)回答になります。 03-01。

20
フィボナッチ数列Mod Kで不足している数値を見つける
このMath.SEの質問に触発されました。 バックグラウンド フィボナッチ数列(と呼ばれるF)を開始シーケンスである0, 1各番号(ようにF(n)(最初の二つの後))がその前2つ(の和であるがF(n) = F(n-1) + F(n-2))。 フィボナッチ数列mod K(と呼ばれるM)は、フィボナッチ数列mod K(M(n) = F(n) % K)です。 各値は前のペアによって決定されるため、フィボナッチ数列mod KはすべてのKに対して循環的であり、非負整数の可能なペアはK 2のみであり、両方ともKより小さいことが示されます。は、最初に繰り返される項のペアの後に循環します。最初に繰り返される項のペアが表示される前にフィボナッチ数列mod Kに表示されない数値。 K = 4の場合 0 1 1 2 3 1 0 1 ... K = 8の場合 0 1 1 2 3 5 0 5 5 2 7 1 0 1 ... K …

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.