login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A111453
a(1)=1; for n>1, a(n) is smallest positive integer not occurring earlier in the sequence such that |a(n)-a(n-1)| is composite.
2
1, 5, 9, 3, 7, 11, 2, 6, 10, 4, 8, 12, 16, 20, 14, 18, 22, 13, 17, 21, 15, 19, 23, 27, 31, 25, 29, 33, 24, 28, 32, 26, 30, 34, 38, 42, 36, 40, 44, 35, 39, 43, 37, 41, 45, 49, 53, 47, 51, 55, 46, 50, 54, 48, 52, 56, 60, 64, 58, 62, 66, 57, 61, 65, 59, 63, 67, 71, 75, 69, 73, 77
OFFSET
1,2
COMMENTS
Sequence is a permutation of the positive integers.
LINKS
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
Cf. A002808.
Sequence in context: A228402 A154265 A198133 * A222074 A245735 A303497
KEYWORD
nonn
AUTHOR
Leroy Quet, Nov 14 2005
EXTENSIONS
More terms from Robert G. Wilson v, Nov 17 2005
STATUS
approved