login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A279214 Number of permutations sigma such that |sigma(i+1)-sigma(i)| >= 3 for 1 <= i <= n - 1 and |sigma(i+2)-sigma(i)| >= 3 for 1 <= i <= n - 2. 4
1, 1, 0, 0, 0, 0, 0, 0, 0, 2, 40, 792, 15374, 281434, 5089060, 93082532, 1743601076, 33694028152 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,10

COMMENTS

2 | a(n) for n > 1.

LINKS

Table of n, a(n) for n=0..17.

EXAMPLE

a(9) = 2: 369258147, 741852963.

PROG

(Ruby)

def check(d, a, i)

  return true if i == 0

  j = 1

  d_max = [i, d - 1].min

  while (a[i] - a[i - j]).abs >= d && j < d_max

    j += 1

  end

  (a[i] - a[i - j]).abs >= d

end

def solve(d, len, a = [])

  b = []

  if a.size == len

    b << a

  else

    (1..len).each{|m|

      s = a.size

      if s == 0 || (s > 0 && !a.include?(m))

        if check(d, a + [m], s)

          b += solve(d, len, a + [m])

        end

      end

    }

  end

  b

end

def A279214(n)

  (0..n).map{|i| solve(3, i).size}

end

p A279214(12)

CROSSREFS

Cf. A002464 (|sigma(i+1)-sigma(i)| >= 2), A127697 (|sigma(i+1)-sigma(i)| >= 3).

Sequence in context: A127186 A139747 A230133 * A264716 A264713 A012637

Adjacent sequences:  A279211 A279212 A279213 * A279215 A279216 A279217

KEYWORD

nonn,more

AUTHOR

Seiichi Manyama, Dec 17 2016

EXTENSIONS

a(0)-a(2), a(15)-a(17) from Alois P. Heinz, Dec 01 2018

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 3 15:00 EDT 2020. Contains 333197 sequences. (Running on oeis4.)