OFFSET
1,2
COMMENTS
Sequence is a permutation of the positive integers.
LINKS
John Tyler Rascoe, Table of n, a(n) for n = 1..10000
FORMULA
From Robert G. Wilson v, Nov 17 2005: (Start)
a(n) = n for n==1 (mod 11), a(n) = n+3 for n==2 (mod 11), a(n) = n+6 for n==3 (mod 11)
a(n) = n-1 for n==4 (mod 11), a(n) = n+2 for n==5 (mod 11), a(n) = n+5 for n==6 (mod 11)
a(n) = n-5 for n==7 (mod 11), a(n) = n-2 for n==8 (mod 11), a(n) = n+1 for n==9 (mod 11)
a(n) = n-6 for n==10 (mod 11) a(n) = n-3 for n==0 (mod 11). (End)
From John Tyler Rascoe, Nov 14 2024 :(Start)
a(n) = a(n-11) + 11.
G.f.: x*(1 - x)*(3*x^11 + 4*x^10 - 6*x^9 + 4*x^8 + 4*x^7 - 9*x^6 + 4*x^5 + 4*x^4 - 6*x^3 + 4*x^2 + 4*x + 1)/((1 - x^11)*(x - 1)^2). (End)
EXAMPLE
Among those positive integers not among the first 8 terms of the sequence (4,8,10,12,...), a(9) = 10 is the lowest such that |a(9)-a(8)| = |10-6| = 4 is a composite. (|8-6|=2 and |4-6|=2 are both primes. So a(9) is not 4 or 8.)
MATHEMATICA
f[n_] := Switch[Mod[n, 11], 0, n - 3, 1, n, 2, n + 3, 3, n + 6, 4, n - 1, 5, n + 2, 6, n + 5, 7, n - 5, 8, n - 2, 9, n + 1, 10, n - 6]; Array[a, 72] (* or *)
a[1] = 1; a[n_] := a[n] = Block[{k = 1, t = Table[a[i], {i, n - 1}]}, While[Position[t, k] != {} || PrimeQ[k - a[n - 1]] || Abs[k - a[n - 1]] == 1, k++ ]; k]; Array[a, 72] (* Robert G. Wilson v *)
PROG
(PARI)
A_x(N) = {Vec(x*(1-x)*(3*x^11+4*x^10-6*x^9+4*x^8+4*x^7-9*x^6+4*x^5+4*x^4-6*x^3+4*x^2+4*x+1)/((1-x^11)*(x-1)^2)+O('x^(N+1)))}
A_x(80) \\ John Tyler Rascoe, Nov 14 2024
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Leroy Quet, Nov 14 2005
EXTENSIONS
More terms from Robert G. Wilson v, Nov 17 2005
STATUS
approved