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-6 of 6 results.

A026236 a(n) = (s(n) + 1)/2, where s(n) is the n-th odd number in A026234.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 5, 9, 10, 12, 15, 16, 19, 21, 22, 8, 24, 27, 30, 31, 34, 36, 37, 40, 42, 45, 49, 51, 52, 54, 11, 55, 57, 64, 66, 69, 70, 75, 76, 79, 13, 82, 84, 87, 90, 91, 96, 14, 97, 99, 100, 106, 112, 114, 115, 117, 120, 121, 126, 129
Offset: 1

Views

Author

Keywords

Extensions

Title corrected by Sean A. Irvine, Sep 22 2019

A026235 a(n) = |s(n) - n|, where s = A026234.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 5, 3, 5, 8, 13, 5, 13, 5, 17, 20, 21, 8, 23, 28, 33, 34, 39, 13, 41, 13, 41, 46, 49, 54, 61, 17, 63, 64, 67, 20, 67, 21, 69, 82, 85, 23, 89, 90, 99, 100, 105, 28, 109, 112, 117, 122, 123, 33, 131, 34, 131, 134
Offset: 1

Views

Author

Keywords

A097457 If n is prime replace with the n-th nonprime otherwise replace with the n-th prime.

Original entry on oeis.org

2, 4, 6, 7, 9, 13, 12, 19, 23, 29, 18, 37, 21, 43, 47, 53, 26, 61, 28, 71, 73, 79, 34, 89, 97, 101, 103, 107, 42, 113, 45, 131, 137, 139, 149, 151, 52, 163, 167, 173, 57, 181, 60, 193, 197, 199, 65, 223, 227, 229, 233, 239, 74, 251, 257, 263, 269, 271, 81, 281, 84, 293
Offset: 1

Views

Author

Cino Hilliard, Aug 23 2004

Keywords

Examples

			4 is composite so replace it with prime(4) = 7, the 4th entry in the table.
		

Crossrefs

Cf. A026234.

Programs

  • PARI
    flipcomppr(n) = { for(x=1,n, if(isprime(x),y=composite(x),y=prime(x)); print1(y",") ) } /* the n-th composite */ composite(n) = { local(c,x); c=1; x=0; while(c <= n, x++; if(!isprime(x),c++); ); return(x) } /* Note: for more efficient code, see A018252 */
    
  • PARI
    A097457 = n->if(isprime(n),A018252(n),prime(n)) \\ M. F. Hasler, Jan 29 2014

Extensions

Definition and offset corrected by M. F. Hasler, Jan 29 2014

A236675 If n is prime, then a(n) is the least composite number not occurring earlier, else a(n) is the least prime not occurring earlier.

Original entry on oeis.org

2, 4, 6, 3, 8, 5, 9, 7, 11, 13, 10, 17, 12, 19, 23, 29, 14, 31, 15, 37, 41, 43, 16, 47, 53, 59, 61, 67, 18, 71, 20, 73, 79, 83, 89, 97, 21, 101, 103, 107, 22, 109, 24, 113, 127, 131, 25, 137, 139, 149, 151, 157, 26, 163, 167, 173, 179, 181, 27, 191, 28, 193
Offset: 1

Views

Author

M. F. Hasler, Jan 29 2014

Keywords

Comments

If "composite" is replaced by "nonprime", one gets A026234, a permutation of the integers.

Crossrefs

Programs

  • PARI
    A236675=n->if(isprime(n),A002808(primepi(n)),prime(n-primepi(n)))
    
  • PARI
    c=p=1;vector(99,n,if(isprime(n),while(isprime(c++),);c,p=nextprime(p+1)))

Formula

a(n) = A002808(A000720(n)) if n is prime, a(n) = A000040(n-A000720(n)) else.

A236676 The n-th term is the n-th composite if n is prime, and the n-th prime if n is not prime.

Original entry on oeis.org

2, 6, 8, 7, 10, 13, 14, 19, 23, 29, 20, 37, 22, 43, 47, 53, 27, 61, 30, 71, 73, 79, 35, 89, 97, 101, 103, 107, 44, 113, 46, 131, 137, 139, 149, 151, 54, 163, 167, 173, 58, 181, 62, 193, 197, 199, 66, 223, 227, 229, 233, 239, 75, 251, 257, 263, 269, 271, 82
Offset: 1

Views

Author

M. F. Hasler, Jan 29 2014

Keywords

Comments

See A097457 for the (maybe more natural) variant where "n-th composite"(=A002808(n)) is replaced by "n-th nonprime" (=A018252(n)).
Essentially the same as A088608. - R. J. Mathar, Feb 03 2014

Crossrefs

Programs

  • Mathematica
    Module[{nn=100,prs,cmps,len},cmps=Select[Range[nn],CompositeQ];len= Length[ cmps];prs=Prime[Range[len]];Table[If[PrimeQ[n],cmps[[n]],prs[[n]]],{n,len}]] (* Harvey P. Dale, Dec 27 2022 *)
  • PARI
    A236676 = n->if(isprime(n),A002808(n),prime(n))

Formula

a(n) = A002808(n) if n is prime, a(n) = A000040(n) else.

A206798 Beginning with the natural numbers, swap the k-th composite number (A002808) and k-th noncomposite number (A008578), for k = 1,2,3,...

Original entry on oeis.org

4, 6, 8, 1, 9, 2, 10, 3, 5, 7, 12, 11, 14, 13, 17, 19, 15, 23, 16, 29, 31, 37, 18, 41, 43, 47, 53, 59, 20, 61, 21, 67, 71, 73, 79, 83, 22, 89, 97, 101, 24, 103, 25, 107, 109, 113, 26, 127, 131, 137, 139, 149, 27, 151, 157, 163, 167, 173, 28, 179, 30, 181, 191
Offset: 1

Views

Author

Jaroslav Krizek, Feb 12 2012

Keywords

Comments

Sequence is self-inverse permutation of natural numbers. Also swap sequence of pair of complements A002808 and A008578.

Examples

			a(7) = 10 becauce number 7 is 5th term of sequence A008578 and 5th term of sequence A002808 is number 10.
		

Crossrefs

Cf. A026234 (swap the k-th prime and k-th nonprime, for k = 1,2,3,...).

Programs

  • Mathematica
    nn = 191; t1 = Select[Range[nn], # == 1 || PrimeQ[#] &]; t2 = Complement[Range[nn], t1]; t = Range[nn]; Do[temp = t[[t1[[i]]]]; t[[t1[[i]]]] = t[[t2[[i]]]]; t[[t2[[i]]]] = temp, {i, Length[t1]}]; Take[t, Position[t, t1[[-1]]][[1, 1]]] (* T. D. Noe, Feb 13 2012 *)

Formula

a(n) = A181097(n) for first 14 terms.
Showing 1-6 of 6 results.