Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

57%
+2 −1
Challenges Give the fool's fibonacci sequence

Recently I asked for tips on improving some code-golf of mine. The code was supposed to output every third value of the Fibonacci sequence starting with 2: 2,8,34,144,610,2584,10946,46368,196418,...

0 answers  ·  posted 1y ago by WheatWizard‭  ·  edited 1y ago by WheatWizard‭

#3: Post edited by user avatar WheatWizard‭ · 2023-08-19T22:54:46Z (over 1 year ago)
Stipulated that the intermediate values must be integers.
  • Recently [I asked](https://codegolf.stackexchange.com/q/264316/56656) for tips on improving some code-golf of mine. The code was *supposed* to output every third value of the Fibonacci sequence starting with 2:
  • ```
  • 2,8,34,144,610,2584,10946,46368,196418,832040
  • ```
  • However, I made a mistake in deriving my formula, and my code output a different sequence which is accurate for the first couple terms and then begins to diverge:
  • ```
  • 2,8,34,140,578,2384,9834,40564,167322,690184
  • ```
  • My sequence is defined by:
  • \begin{array}{rcl}
  • f(0) &=& 0 \\
  • f(1) &=& 2 \\
  • f(n) &=&\displaystyle 2 + 3f(n-1) + 4f(n-2) + 2\sum_{0}^{n-3}f\\
  • \end{array}
  • or in terms of my original Haskell code:
  • ```haskell
  • z=zipWith(+)
  • g=z((*2)<$>0:0:g)$z(0:g)$(*2)<$>scanl(+)1g
  • ```
  • Your task is to implement a sequence, which has my incorrect sequence as every third value. The other values can be whatever you want them to be, it simply must have the above sequence as every third value. The sequence can begin at the 0th, 1st, or 2nd index, whichever you please.
  • This is code-golf so the goal is to minimize the size of your program as measured in bytes.
  • Recently [I asked](https://codegolf.stackexchange.com/q/264316/56656) for tips on improving some code-golf of mine. The code was *supposed* to output every third value of the Fibonacci sequence starting with 2:
  • ```
  • 2,8,34,144,610,2584,10946,46368,196418,832040
  • ```
  • However, I made a mistake in deriving my formula, and my code output a different sequence which is accurate for the first couple terms and then begins to diverge:
  • ```
  • 2,8,34,140,578,2384,9834,40564,167322,690184
  • ```
  • My sequence is defined by:
  • \begin{array}{rcl}
  • f(0) &=& 0 \\
  • f(1) &=& 2 \\
  • f(n) &=&\displaystyle 2 + 3f(n-1) + 4f(n-2) + 2\sum_{0}^{n-3}f\\
  • \end{array}
  • or in terms of my original Haskell code:
  • ```haskell
  • z=zipWith(+)
  • g=z((*2)<$>0:0:g)$z(0:g)$(*2)<$>scanl(+)1g
  • ```
  • Your task is to implement a sequence of integers, which has my incorrect sequence as every third value. The other values can be whatever you want them to be, it simply must have the above sequence as every third value. The sequence can begin at the 0th, 1st, or 2nd index, whichever you please.
  • This is code-golf so the goal is to minimize the size of your program as measured in bytes.
#2: Post edited by user avatar WheatWizard‭ · 2023-08-19T14:44:17Z (over 1 year ago)
  • Give the fools fibonacci sequence
  • Give the fool's fibonacci sequence
#1: Initial revision by user avatar WheatWizard‭ · 2023-08-19T13:42:17Z (over 1 year ago)
Give the fools fibonacci sequence
Recently [I asked](https://codegolf.stackexchange.com/q/264316/56656) for tips on improving some code-golf of mine.  The code was *supposed* to output every third value of the Fibonacci sequence starting with 2:

```
2,8,34,144,610,2584,10946,46368,196418,832040
```

However, I made a mistake in deriving my formula, and my code output a different sequence which is accurate for the first couple terms and then begins to diverge:

```
2,8,34,140,578,2384,9834,40564,167322,690184
```

My sequence is defined by: 

\begin{array}{rcl}
f(0) &=& 0 \\
f(1) &=& 2 \\
f(n) &=&\displaystyle 2 + 3f(n-1) + 4f(n-2) + 2\sum_{0}^{n-3}f\\
\end{array}

or in terms of my original Haskell code:

```haskell
z=zipWith(+)
g=z((*2)<$>0:0:g)$z(0:g)$(*2)<$>scanl(+)1g
```

Your task is to implement a sequence, which has my incorrect sequence as every third value.  The other values can be whatever you want them to be, it simply must have the above sequence as every third value. The sequence can begin at the 0th, 1st, or 2nd index, whichever you please.

This is code-golf so the goal is to minimize the size of your program as measured in bytes.