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

A269857 Permutation of natural numbers: a(1) = 1; if n is an odd prime, a(n) = A250469(a(A026233(n))), else a(n) = 2*(a(A026233(n))).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 9, 8, 10, 12, 7, 18, 15, 16, 20, 24, 25, 14, 21, 36, 30, 32, 27, 40, 48, 50, 28, 42, 33, 72, 11, 60, 64, 54, 80, 96, 51, 100, 56, 84, 35, 66, 45, 144, 22, 120, 57, 128, 108, 160, 192, 102, 69, 200, 112, 168, 70, 132, 49, 90, 39, 288, 44, 240, 114, 256, 55, 216, 320, 384, 105, 204, 87, 138, 400
Offset: 1

Views

Author

Antti Karttunen, Mar 06 2016

Keywords

Crossrefs

Inverse: A269858.
Related or similar permutations: A071574, A252755, A269847.
Differs from A269847 for the first time at n=19, where a(19)=21, while A269847(19)=27.

Formula

a(1) = 1; if n is an odd prime, a(n) = A250469(a(A026233(n))), else a(n) = 2*(a(A026233(n))).
As a composition of other permutations:
a(n) = A252755(A071574(n)).

A066246 a(n) = 0 unless n is a composite number A002808(k) then a(n) = k.

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 0, 3, 4, 5, 0, 6, 0, 7, 8, 9, 0, 10, 0, 11, 12, 13, 0, 14, 15, 16, 17, 18, 0, 19, 0, 20, 21, 22, 23, 24, 0, 25, 26, 27, 0, 28, 0, 29, 30, 31, 0, 32, 33, 34, 35, 36, 0, 37, 38, 39, 40, 41, 0, 42, 0, 43, 44, 45, 46, 47, 0, 48, 49, 50, 0, 51, 0, 52, 53, 54, 55, 56, 0, 57
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 09 2001

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr, genericIndex)
    a066246 n = genericIndex a066246_list (n - 1)
    a066246_list = unfoldr x (1, 1, a002808_list) where
       x (i, z, cs'@(c:cs)) | i == c = Just (z, (i + 1, z + 1, cs))
                            | i /= c = Just (0, (i + 1, z, cs'))
    -- Reinhard Zumkeller, Jan 29 2014
  • Mathematica
    Module[{k=1},Table[If[CompositeQ[n],k;k++,0],{n,100}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 03 2019 *)
  • PARI
    a(n)=if(isprime(n),0,max(0,n-primepi(n)-1)) \\ Charles R Greathouse IV, Aug 21 2011
    

Formula

a(n) = A239968(n) + A010051(n) - 1. - Reinhard Zumkeller, Mar 30 2014
a(n) = A065855(n)*A005171(n). - Ridouane Oudra, Jul 29 2025

A239968 a(n) = 0 unless n is a nonprime A018252(k) then a(n) = k.

Original entry on oeis.org

1, 0, 0, 2, 0, 3, 0, 4, 5, 6, 0, 7, 0, 8, 9, 10, 0, 11, 0, 12, 13, 14, 0, 15, 16, 17, 18, 19, 0, 20, 0, 21, 22, 23, 24, 25, 0, 26, 27, 28, 0, 29, 0, 30, 31, 32, 0, 33, 34, 35, 36, 37, 0, 38, 39, 40, 41, 42, 0, 43, 0, 44, 45, 46, 47, 48, 0, 49, 50, 51, 0, 52
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 30 2014

Keywords

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr, genericIndex)
    a239968 n = genericIndex a239968_list (n - 1)
    a239968_list = unfoldr c (1, 1, a018252_list) where
       c (i, z, xs'@(x:xs)) | i == x = Just (z, (i + 1, z + 1, xs))
                            | i /= x = Just (0, (i + 1, z, xs'))
  • Mathematica
    Module[{k = 0}, Array[If[!PrimeQ[#], ++k, 0] &, 100]] (* Paolo Xausa, Jul 31 2025 *)

Formula

a(n) = A066246(n) - A010051(n) + 1.
a(n) = A026233(n) - A049084(n);
A057427(a(n)) = A005171(n).
a(n) = A062298(n)*A005171(n). - Ridouane Oudra, Jul 29 2025

A026238 a(n) = j if n is the j-th prime, else a(n) = k if n is the k-th composite.

Original entry on oeis.org

1, 2, 1, 3, 2, 4, 3, 4, 5, 5, 6, 6, 7, 8, 9, 7, 10, 8, 11, 12, 13, 9, 14, 15, 16, 17, 18, 10, 19, 11, 20, 21, 22, 23, 24, 12, 25, 26, 27, 13, 28, 14, 29, 30, 31, 15, 32, 33, 34, 35, 36, 16, 37, 38, 39, 40, 41, 17, 42, 18, 43, 44, 45, 46, 47, 19
Offset: 2

Views

Author

Keywords

Crossrefs

Programs

  • Haskell
    a026238 n = a049084 n + a066246 n  -- Reinhard Zumkeller, Jan 29 2014
    
  • Mathematica
    Table[If[PrimeQ[n],PrimePi[n],n-1-PrimePi[n]],{n,2,70}] (* Harvey P. Dale, Jun 06 2017 *)
  • PARI
    first(n)=my(c,p); vector(n-1,k, if(isprime(k+1),p++,c++)) \\ Charles R Greathouse IV, Sep 02 2015

Formula

a(n) = A049084(n) + A066246(n) for n >= 2.

A014237 a(n) = (n-th prime) - (n-th nonprime).

Original entry on oeis.org

1, -1, -1, -1, 2, 3, 5, 5, 8, 13, 13, 17, 20, 21, 23, 28, 33, 34, 39, 41, 41, 46, 49, 54, 61, 63, 64, 67, 67, 69, 82, 85, 89, 90, 99, 100, 105, 109, 112, 117, 122, 123, 131, 131, 134, 135, 146, 157, 159, 160, 163, 167, 167, 176, 181, 186, 191, 191, 196
Offset: 1

Views

Author

Keywords

Comments

a(n) = A000040(n) - A018252(n). - Reinhard Zumkeller, Apr 30 2014

Crossrefs

Programs

  • Haskell
    a014237 n = a000040 n - a018252 n  -- Reinhard Zumkeller, Apr 30 2014
    
  • Mathematica
    nonPrime[n_Integer] := FixedPoint[n + PrimePi@# &, n+PrimePi@n];
    Table[Prime[n] - nonPrime[n], {n, 1, 70}] (* G. C. Greubel, Jun 22 2019 *)
  • Python
    from sympy import prime, composite
    def A014237(n):
        return 1 if n == 1 else prime(n)-composite(n-1) # Chai Wah Wu, Dec 27 2018

A269847 Permutation of natural numbers: a(1) = 1, for n > 1, if n is an odd prime, a(n) = A003961(a(A000720(n))), otherwise a(n) = 2*a(n-A000720(n)).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 9, 8, 10, 12, 7, 18, 15, 16, 20, 24, 25, 14, 27, 36, 30, 32, 21, 40, 48, 50, 28, 54, 45, 72, 11, 60, 64, 42, 80, 96, 75, 100, 56, 108, 35, 90, 81, 144, 22, 120, 63, 128, 84, 160, 192, 150, 135, 200, 112, 216, 70, 180, 49, 162, 33, 288, 44, 240, 126, 256, 125, 168, 320, 384, 225, 300, 105, 270, 400
Offset: 1

Views

Author

Antti Karttunen, Mar 06 2016

Keywords

Crossrefs

Inverse: A269848.
Related or similar permutations: A071574, A163511, A246681, A257730, A269857.

Formula

a(1) = 1, and for n > 1, if n is an odd prime, a(n) = A003961(a(A000720(n))), otherwise [when n is 2 or composite] a(n) = 2*a(n-A000720(n)).
a(1) = 1; if n is an odd prime, a(n) = A003961(a(A026233(n))), else a(n) = A005843(a(A026233(n))).
Declarative definition:
a(1)=1, a(A065091(n)) = A003961(a(n+1)), a(A065090(n+1)) = 2*a(n).
As a composition of other permutations:
a(n) = A163511(A071574(n)).
Other identities. For all n >= 1:
a(A007097(n)) = A000040(n). [Maps the terms of primeth recurrence to primes.]

A244724 Lexicographically earliest permutation of the natural numbers such that primes and composites alternate in the sums of adjacent terms.

Original entry on oeis.org

1, 2, 4, 3, 5, 6, 8, 9, 7, 10, 11, 12, 13, 16, 14, 15, 17, 20, 18, 19, 21, 22, 23, 24, 25, 28, 26, 27, 29, 30, 32, 35, 31, 36, 33, 34, 38, 41, 37, 42, 39, 40, 44, 45, 43, 46, 47, 50, 48, 49, 51, 52, 53, 54, 56, 57, 55, 58, 59, 68, 60, 67, 61, 66, 62, 65, 63
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 05 2014

Keywords

Comments

For k > 0: a(2*k-1) + a(2*k) is prime, a(2*k) + a(2*k+1) is composite.

Examples

			.             n | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
.          a(n) | 1 2 4 3 5 6 8 9 7 10 11 12 13 16 14 15 17 20 18 19
. A026233(a(n)) | 1 1 2 2 3 3 4 5 4  6  5  7  6 10  8  9  7 12 11  8 .
		

Crossrefs

Cf. A244732 (inverse), A244731 (fixed points), A073846, A113321, A115316.

Programs

  • Haskell
    import Data.List (delete)
    a244724 n = a244724_list !! (n-1)
    a244724_list = 1 : f 1 [2..] where
       f x xs = f' xs where
         f' (u:us) | a010051' (x + u) == 1 = g u (delete u xs)
                   | otherwise             = f' us where
            g y ys = g' ys where
              g' (v:vs) | a010051' (y + v) == 0 = u : v : f v (delete v ys)
                        | otherwise        = g' vs

Formula

A010051(a(n)+a(n+1)) = n mod 2.

A249594 Positions of primes in A249054.

Original entry on oeis.org

2, 4, 7, 11, 12, 14, 17, 18, 19, 22, 23, 27, 30, 32, 34, 37, 38, 41, 42, 45, 47, 50, 51, 53, 54, 55, 58, 61, 64, 65, 68, 71, 72, 74, 75, 78, 80, 81, 84, 87, 89, 90, 94, 97, 100, 102, 105, 108, 109, 111, 113, 116, 117, 119, 120, 123, 125, 129, 133, 134, 135
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 03 2014

Keywords

Comments

A249054(a(n)) = A000040(n); sequence is strictly increasing, i.e. all primes occur in A249054 in natural order, see also A249595.

Crossrefs

Cf. A000040, A026233, A049084, A239968, A249054, A249595 (complement).

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a249594 = (+ 1) . fromJust . (`elemIndex` a249054_list) . a000040

A249595 Positions of nonprimes in A249054.

Original entry on oeis.org

1, 3, 5, 6, 8, 9, 10, 13, 15, 16, 20, 21, 24, 25, 26, 28, 29, 31, 33, 35, 36, 39, 40, 43, 44, 46, 48, 49, 52, 56, 57, 59, 60, 62, 63, 66, 67, 69, 70, 73, 76, 77, 79, 82, 83, 85, 86, 88, 91, 92, 93, 95, 96, 98, 99, 101, 103, 104, 106, 107, 110, 112, 114, 115
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 03 2014

Keywords

Comments

A249054(a(n)) = A018252(n); sequence is strictly increasing, i.e. all nonprimes occur in A249054 in natural order, see also A249594.

Crossrefs

Cf. A018252, A026233, A049084, A239968, A249054, A249594 (complement).

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a249595 = (+ 1) . fromJust . (`elemIndex` a249054_list) . a018252

A102885 Index of n in the primes A000040 or nonprimes A141468.

Original entry on oeis.org

1, 2, 1, 2, 3, 3, 4, 4, 5, 6, 7, 5, 8, 6, 9, 10, 11, 7, 12, 8, 13, 14, 15, 9, 16, 17, 18, 19, 20, 10, 21, 11, 22, 23, 24, 25, 26, 12, 27, 28, 29, 13, 30, 14, 31, 32, 33, 15, 34, 35, 36, 37, 38, 16, 39, 40, 41, 42, 43, 17, 44, 18, 45, 46, 47, 48, 49, 19, 50, 51, 52, 20, 53, 21, 54
Offset: 0

Views

Author

Juri-Stepan Gerasimov, Aug 17 2008

Keywords

Comments

The nonnegative numbers n occur exactly once in either A000040 or A141468. The sequence lists the corresponding index. It is a permutation of A008619.

Crossrefs

Programs

  • Mathematica
    Module[{nn=80,pr,np},pr=Prime[Range[PrimePi[nn]]];np=Complement[ Range[ 0,nn],pr];Table[If[PrimeQ[n],Position[pr,n],Position[np,n]],{n,0,nn}]]//Flatten (* Harvey P. Dale, Sep 10 2022 *)

Formula

A141468(a(n))=n or A000040(a(n))=n.

Extensions

Edited by R. J. Mathar, Aug 19 2008
Showing 1-10 of 10 results.