fareyleni

fareyleni — returns the length of a Farey Sequence.

Description

This opcode can be used in conjunction with GENfarey. It calculates the length of Farey Sequence Fn. Its length is given by: |Fn| = 1 + SUM over n phi(m) where phi(m) is Euler's totient function, which gives the number of integers ≤ m that are coprime to m.

Some values for the length of Fn given n:

  • n |Fn|
  • 1 2
  • 2 3
  • 3 5
  • 4 7
  • 5 11
  • 6 13
  • 7 19
  • 8 23
  • 9 29
  • 10 33
  • 11 43
  • 12 47
  • 13 59
  • 14 65
  • 15 73
  • 16 81
  • 17 97
  • 18 103
  • 19 121

Syntax

ifl fareyleni ifn

Initialisation

The length of the identified Farey sequence is returned.

ifn -- Integer identifying the sequence.

Credits

Author: Georg Boenn
University of Glamorgan, UK

New in Csound version 5.13