You are probably familiar with the Fibonacci sequence where the first two terms are `0, 1`

(or sometimes `1, 1`

) and every term after that is the sum of the previous two. It starts like this:

`0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...`

Sometimes, the sequence contains numbers that have a particular pattern that I find interesting: the difference between any pair of adjacent digits is the same as any other pair. For instance, in the sequence starting with `0, 1`

, the 18th term is `987`

. `9-8=1`

and `8-7=1`

. I am mildly satisfied.

**Challenge**

Given two initial values `F(0)`

and `F(1)`

, output every number in the sequence generated by `F(n) = F(n-1) + F(n-2)`

that meets the following criteria:

- The difference between any pair of adjacent digits is the same as any other pair
- It is as least three digits long (1 and 2 digit numbers are not interesting for this pattern)

**Input**

- Two non-negative integers less than 10**10 (10 billion)

**Output**

- All integers that are less than 10**10 and meet the criteria in the Challenge section
- It is acceptable to output digits greater than 10**10 but it is not a requirement
- Given that repeated digits meet the pattern (e.g.
`777`

), it is possible that there are infinite numbers that meet the criteria but your program is not required to output forever - If no such integers exist, output whatever you want so long as it's not a number (nothing, null, empty array, error message, sad face, etc.)
- If a number matching the pattern appears more than once in the sequence, you can output it once or as many times as it occurs
- If any input meets the criteria, it should be included in the output

**Rules**

- Input and Output can be in any standard format
- Standard loopholes are forbidden
- This is code-golf so the shortest code in bytes wins

**Examples / Test Cases**

```
Input , Output
[1,10] , []
[0,1] , [987]
[2,1] , [123]
[2,3] , [987]
[61,86] , [147]
[75,90] , [420]
[34,74] , [1234]
[59,81] , [2468]
[84,85] , [7531]
[19,46] , [111]
[60,81] , [222]
[41,42] , [333]
[13,81] , [444]
[31,50] , [555]
[15,42] , [666]
[94,99] , [777]
[72,66] , [888]
[15,3] , [159,258]
[22,51] , [321,1357]
[74,85] , [159,4444]
[27,31] , [147,11111]
[123,0] , [123,123,246,369]
[111,0] , [111,111,222,333,555,888]
[111,222] , [111,222,333,555,888]
[3894621507,5981921703] , [9876543210]
[765432099,111111111] , [111111111,876543210,987654321]
```

Stewie Griffin 05/15/2018.

`@(a,x=0)eval('do++x;t{x}=(a*[1,1;1,0]^x)(1);until t{x}>1e11,for i=1:x,if t{i}>99,if diff(k=+num2str(t{i}))==diff(k(1:2)),disp(t{i}),end,end,end')`

Good night! Explanation tomorrow! :)

Chas Brown 05/15/2018.

Luis Mendo 05/15/2018.

``wy+ttVdd~?tD`

Infinite loop that outputs the numbers as they are found.

**Try it online!** Note that in the online interpreter the results are displayed after the 1-minute time-out.

Let `F(n)`

and `F(n+1)`

denote two generic consecutive terms of the Fibonacci sequence.

```
` % Do...while
w % Swap. Takes the two inputs (implicitly) the first time
% STACK: F(n+1), F(n)
y % Duplicate from below
% STACK: F(n+1), F(n), F(n+1)
+ % Add. Note that F(n)+F(n+1) is F(n+2)
% STACK: F(n+1), F(n+2)
tt % Duplicate twice
% STACK: F(n+1), F(n+2), F(n+2), F(n+2)
V % Convert to string. Let the digits of F(n+2) be '3579' for example
% STACK: F(n+1), F(n+2), F(n+2), '3579'
d % Consecutive differences (of ASCII codes)
% STACK: F(n+1), F(n+2), F(n+2), [2 2 2]
d % Consecutive differences
% STACK: F(n+1), F(n+2), F(n+2), [0 0]
~ % Logical negate, element-wise
% STACK: F(n+1), F(n+2), F(n+2), [1 1]
? % If top of the stack is non-empty and only contains non-zero entries
% (this is the case for digits '3579', but not for '3578' or '33')
t % Duplicate
% STACK: F(n+1), F(n+2), F(n+2), F(n+2)
D % Display immediately. This prints the top-most copy of F(n+2)
% STACK: F(n+1), F(n+2), F(n+2)
% End (implicit)
% End (implicit). The top of the stack is consumed as loop condition.
% Since it is non-zero, and thus truthy, a new iteration will begin,
% with the stack containing F(n+1), F(n+2)
```

Arnauld 05/15/2018.

`f=(p,q,a=[])=>p<1e10?f(q,p+q,p<100|[...p+''].some(x=d=n=>d-(d=x-(x=n)))?a:[...a,p]):a`

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

- Fibonacci function or sequence
- Find the Pisano Period
- Find Patterns in Strings
- Monday Mini-Golf #1: Reverse Fibonacci Solver
- Find the Fibonacci Kernel
- Find the closest Fibonacci Number
- Implement the Fibonacci sequence… Shifted to the right
- The lowest initial numbers in a Fibonacci-like sequence
- Reconstruct an arithmetic sequence
- Find the Missing Numbers in the Fibonacci Sequence Mod K

- Is it better to lie to students or to be pedantic when teaching Intro CS?
- Who am I? - a secure riddle
- Old short story where scientist creates "time viewer" to see founding of Stonehenge, realizes at end he may have inspired its creation
- Orthodiagonal steps
- Should I be open about tasks I do not like in job posting?
- A Tour Around a Triangle
- Should I log that a user changed their password?
- How to define a symbol similar to Yinyang?
- uplink bandwidth requirements to stream HD down?
- How to discuss girlfriend's weight loss plans?
- Slept through final, professor is giving me a zero and failing me – is there anything I can do to change this?
- Is there a standard definition for "assembly polishing"?
- Is the software that uses PGP broken, or is it PGP itself?
- Find the Fibonacci Patterns
- How much control does an Unconscious caster maintain over his familiar?
- Why is the Turing Machine a popular model of computation?
- Permitting Customizable UI for a Spaceship's Systems
- Mass-Manipulate Bezier Curves in Illustrator
- How did Thor get his eye back?
- What's the beef cut with solid, thick bone?
- How can I undo the bad behavior my 2.5 year old daughter learned from 5 year old children?
- "This is Highly Irregular"
- Einstein field equations to the Alcubierre metric
- What distinguishes spells of level 1-5 from those of 6-9?