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
8-7=1. I am mildly satisfied.
Given two initial values
F(1), output every number in the sequence generated by
F(n) = F(n-1) + F(n-2) that meets the following criteria:
777), it is possible that there are infinite numbers that meet the criteria but your program is not required to output forever
Examples / Test Cases
Input , Output [1,10] ,  [0,1] ,  [2,1] ,  [2,3] ,  [61,86] ,  [75,90] ,  [34,74] ,  [59,81] ,  [84,85] ,  [19,46] ,  [60,81] ,  [41,42] ,  [13,81] ,  [31,50] ,  [15,42] ,  [94,99] ,  [72,66] ,  [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] ,  [765432099,111111111] , [111111111,876543210,987654321]
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.
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)