cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Leroy Quet, Nov 14 2005

Keywords

Comments

Sequence is a permutation of the positive integers.

Examples

			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.)
		

Crossrefs

Cf. A002808.

Programs

  • 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 *)
  • 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

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)

Extensions

More terms from Robert G. Wilson v, Nov 17 2005