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.

Showing 1-4 of 4 results.

A240024 Nonprime EKG sequence, cf. A064413: a(1) = 1, a(2) = 4 and for n > 2, a(n) = smallest composite number not already used which shares a factor with a(n-1).

Original entry on oeis.org

1, 4, 6, 8, 10, 12, 9, 15, 18, 14, 16, 20, 22, 24, 21, 27, 30, 25, 35, 28, 26, 32, 34, 36, 33, 39, 42, 38, 40, 44, 46, 48, 45, 50, 52, 54, 51, 57, 60, 55, 65, 70, 49, 56, 58, 62, 64, 66, 63, 69, 72, 68, 74, 76, 78, 75, 80, 82, 84, 77, 88, 86, 90, 81, 87, 93
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 30 2014

Keywords

Comments

A239965 gives the position of the n-th nonprime; a(A239965(n))=A018252(n).

Crossrefs

Cf. A064413, A064664 (EKG sequence).

Programs

  • Haskell
    import Data.List (delete, genericIndex)
    a240024 n = genericIndex a240024_list (n - 1)
    a240024_list = 1 : ekg 4 a002808_list where
       ekg x zs = f zs where
           f (y:ys) = if gcd x y > 1 then y : ekg y (delete y zs) else f ys
  • Mathematica
    a = {1, 4}; Do[k = 6; While[Or[PrimeQ@ k, MemberQ[a, k], CoprimeQ[a[[i - 1]], k]], k++]; AppendTo[a, k], {i, 3, 66}]; a (* Michael De Vlieger, Sep 01 2016 *)

A085084 Smallest number not yet used which is not a prime but is relatively prime to the previous term.

Original entry on oeis.org

1, 4, 9, 8, 15, 14, 25, 6, 35, 12, 49, 10, 21, 16, 27, 20, 33, 26, 45, 22, 39, 28, 51, 32, 55, 18, 65, 24, 77, 30, 91, 34, 57, 40, 63, 38, 69, 44, 75, 46, 81, 50, 87, 52, 85, 36, 95, 42, 115, 48, 119, 54, 121, 56, 93, 58, 99, 62, 105, 64, 111, 68, 117, 70, 123, 74, 125, 66
Offset: 1

Views

Author

Amarnath Murthy, Jul 02 2003

Keywords

Comments

Every composite number appears in this sequence. Eventually, every p^2 (p prime) will appear; if the smallest unused composite does not follow, it will appear no later than following the next p^2.

Crossrefs

Sequences with related definitions: A051884, A064413, A075570, A163642, A240024.
Cf. A000027.

Programs

  • Haskell
    import Data.List (find, delete)
    import Data.Maybe (fromJust)
    a085084 n = a085084_list !! (n-1)
    a085084_list = 1 : f 1 a002808_list where
       f x cs = y : f y (delete y cs) where
                y = fromJust $ find ((== 1) . (gcd x)) cs
    -- Reinhard Zumkeller, Dec 01 2012
  • Maple
    # Corrected Maple program from Chen Zekai, Mar 23 2015, added by N. J. A. Sloane, Mar 23 2015
    A085084 := proc (q) local a, b, i, n;if q = 1 then print(1); return;elif q = 2 then print(1); print(4); return;fi;a := {1, 4}; b := 4; i := 2; print(1); print(4);while i < q do for n from 6 to q^2 doif not isprime(n) and gcd(b, n) = 1 and {} = a intersect {n} thenb := n; a := a union {n}; i := i+1; print(n);break;fi; od; od; end:A085084(10000):
  • Mathematica
    A085084 = {a[1]=1, a[2]=4}; a[n_] := a[n] = Catch[For[k = 6, True, k++, If[!PrimeQ[k] && !MemberQ[A085084, k] && CoprimeQ[a[n-1], k], AppendTo[A085084, k]; Throw[k]]]]; Table[ a[n], {n, 1, 68}] (* Jean-François Alcover, Jul 17 2012 *)

Extensions

Corrected and extended by Vladeta Jovovic, Jul 05 2003
Additional comments from Franklin T. Adams-Watters, Sep 19 2006
Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar

A072525 a(0) = 1; a(n+1) is smallest composite number > a(n) such that a(n) + a(n+1) is prime.

Original entry on oeis.org

1, 4, 9, 10, 21, 22, 25, 28, 33, 34, 39, 40, 49, 52, 55, 58, 69, 70, 81, 82, 85, 88, 91, 100, 111, 112, 115, 118, 121, 130, 133, 136, 141, 142, 165, 166, 171, 176, 177, 182, 185, 188, 195, 202, 207, 212, 219, 220, 237, 242, 245, 246, 253, 256, 265, 276, 287, 290
Offset: 0

Views

Author

Amarnath Murthy, Jul 31 2002

Keywords

Comments

The value of a(0) is of minor importance; starting with a(0) = 2, 3, 4, 5, ... results in sequences that differ from this sequence only in a few initial terms.
22, 25, 28 are three and 49,52,55,58 are four consecutive terms in arithmetic progression. Are there k consecutive terms in arithmetic progression for every k?

Examples

			34 is the next term after 33 since 34 is composite and 33 + 34 = 67 is prime.
		

Crossrefs

Programs

  • Mathematica
    a=4;lst={a};Do[b=a+1;While[ !PrimeQ[a+b]&&PrimeQ[b],b++ ];AppendTo[lst,b];a=b,{n,5!}];lst (* Vladimir Joseph Stephan Orlovsky, Feb 07 2010 *)
  • PARI
    {print1(a=1,","); while(a<290,b=a+1; while(isprime(b)||!isprime(a+b),b++); print1(b,","); a=b)}

Extensions

Edited and extended by Klaus Brockhaus, Aug 01 2002

A308289 Lexicographically earliest sequence of distinct nonprimes such that a(n) + a(n+1) is prime.

Original entry on oeis.org

1, 4, 9, 8, 15, 14, 27, 10, 21, 16, 25, 6, 35, 12, 49, 18, 55, 24, 65, 32, 39, 20, 33, 26, 45, 22, 51, 28, 69, 34, 63, 38, 75, 52, 57, 40, 87, 44, 93, 46, 81, 50, 77, 30, 119, 48, 91, 36, 95, 42, 85, 54, 125, 56, 111, 62, 105, 58, 99, 64, 115, 66, 133, 60, 121, 70, 123, 68, 129, 82, 117, 74, 153, 76, 135, 88, 141, 86, 143, 80, 147, 92
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, May 18 2019

Keywords

Examples

			The sequence starts with 1, 4, 9, 8, 15, 14, 27, 10, 21, 16, 25, ... and we see that:
a(1) + a(2) = 1 + 4 = 5 (a prime);
a(2) + a(3) = 4 + 9 = 13 (a prime);
a(3) + a(4) = 9 + 8 = 17 (a prime);
a(4) + a(5) = 8 + 15 = 23 (a prime); etc.
		

Crossrefs

Essentially the same as A075570.
Showing 1-4 of 4 results.