Computing Integer Sequences: Filtering vs Generation (Functional Pearl)

07/31/2018
by   Ivano Salvo, et al.
0

As a report of a teaching experience, we analyse Haskell programs computing two integer sequences: the Hamming sequence and the Ulam sequence. For both of them, we investigate two strategies of computation: the first is based on filtering out those natural numbers that do not belong to the sequence, whereas the second is based on the direct generation of num- bers that belong to the sequence. Advocating cross-fertilisation among ideas emerging when programming in different programming paradigms, in the background, we sketch out some considerations about corresponding C programs solving the same two problems.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
03/19/2021

Frobenius Numbers and Automatic Sequences

The Frobenius number g(S) of a set S of non-negative integers with 1 is ...
research
05/11/2023

Integer points in the degree-sequence polytope

An integer vector b ∈ℤ^d is a degree sequence if there exists a hypergra...
research
12/31/2019

Efficiently Realizing Interval Sequences

We consider the problem of realizable interval-sequences. An interval se...
research
02/24/2022

Learning Program Synthesis for Integer Sequences from Scratch

We present a self-learning approach for synthesizing programs from integ...
research
02/09/2023

On Discovering Interesting Combinatorial Integer Sequences

We study the problem of generating interesting integer sequences with a ...
research
04/06/2023

A Mathematical Benchmark for Inductive Theorem Provers

We present a benchmark of 29687 problems derived from the On-Line Encycl...
research
06/14/2022

Expressiveness within Sequence Datalog

Motivated by old and new applications, we investigate Datalog as a langu...

Please sign up or login with your details

Forgot password? Click here to reset