#
# Sequence puzzles with recursions
#
# Here we try to find recursive sequences, e.g. the Fibonacci sequence.
#
# The input is a list of numbers and is used as a time series
# (make_time_series: true).
# 
# 
# Things to change:
#  - num_input_variables: the number of variables involved.
#    For Fibonacci sequence it's 2
#
# To get the next value in the sequence, repeast the <n> last
# numbers in the sequence and then "?", e.g. for Fibonacci
#   1 1 2 3 5 8 13 21 34 55
#   34 55 ?
# 
presentation: Sequence puzzle with recursion
# make_sequence_with_index: true
make_time_series: true
# Change the sequence length here (e.g. for Fibonacci it's: 2)
num_input_variables: 2
# num_input_variables: 3
# num_input_variables: 4
# variable_names: a b c d e f g h i j
# functions: Multiply,Divide,Add,Subtract,Pow,Modulo
functions: Multiply,Divide,Add,Subtract,Pow
terminal_range: -100 100
terminal_wholenumbers: true
max_init_depth: 8
population_size: 100
max_crossover_depth: 8
num_evolutions: 1000
max_nodes: 21
mutation_prob: 0.15
# mutation_prob: 0.05
crossover_prob: 0.9
# crossover_prob: 0.5
show_similiar: true
similiar_sort_method: length
show_population: false
# stop_criteria_fitness: 0
# show_progression: true
data
# From http://www.hakank.org/seq_guess.cgi
# It should be
#  (seq[-1] - 5) +seq[-2] - (seq[-3] - 7) + (seq[-4] * 10)
# Next : 4166
# 0 0 1 1 4 6 21 35 92 168 437 865 2056
# 168 437 865 2056 ?

# http://www.hakank.org/seq_guess.cgi
#   seq[-1] - (seq[-2] - 4)
#   Next: 1
# 0 1 5 8 7 3 0 1 5 8 7 3 0
# 3 0 ?

# Fibonacci:
1 1 2 3 5 8 13 21 34 55
34 55 ?

# Some other puzzles

# From https://www.purplemath.com/modules/nextnumb3.htm
# Next: 34
# 1 4 8 13 19 26
# 19 26 ?

# 3 2 5 7 12
# 7 12 ?

# https://math.stackexchange.com/questions/1569860/how-to-find-formula-for-recursive-sequence-sum
# 1 3 6 10 15 21
# 15 21 ?