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!)
A322281 Number of permutations sigma such that |sigma(i+j)-sigma(i)| >= 4 for 1 <= i <= n - j, 1 <= j <= 3. 3
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 74, 2424, 93424, 4394386, 201355480 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,17

COMMENTS

2 | a(n) for n > 1.

LINKS

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

EXAMPLE

a(16) = 2: [4,8,12,16,3,7,11,15,2,6,10,14,1,5,9,13] and its reverse.

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 A322281(n)

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

end

p A322281(18)

CROSSREFS

Cf. A179957, A279214.

Sequence in context: A083018 A240174 A295172 * A282878 A062552 A116172

Adjacent sequences:  A322278 A322279 A322280 * A322282 A322283 A322284

KEYWORD

nonn,more

AUTHOR

Seiichi Manyama, Dec 01 2018

EXTENSIONS

a(21) from Alois P. Heinz, Dec 02 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 September 20 21:32 EDT 2021. Contains 347591 sequences. (Running on oeis4.)