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

A073846 a(1) = 1; thereafter, every even-indexed term is prime and every odd-indexed term is composite.

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 8, 7, 9, 11, 10, 13, 12, 17, 14, 19, 15, 23, 16, 29, 18, 31, 20, 37, 21, 41, 22, 43, 24, 47, 25, 53, 26, 59, 27, 61, 28, 67, 30, 71, 32, 73, 33, 79, 34, 83, 35, 89, 36, 97, 38, 101, 39, 103, 40, 107, 42, 109, 44, 113, 45, 127, 46, 131, 48, 137, 49, 139, 50
Offset: 1

Views

Author

Amarnath Murthy, Aug 14 2002

Keywords

Comments

Equals A067747 shifted by one position. a(n) = A067747(n-1) [for n>1]. - R. J. Mathar, Apr 01 2007
From Chayim Lowen, Aug 12 2015: (Start)
Consider f(n,k) = a(f(n,k-1)) with f(n,0) = n. Let us also define f(n,k) for negative values of k as well using: f(n,k-1) = A073898(f(n,k)) where A073898(a(n)) = a(A073898(n)) = n. Let us denote the sequence {f(n,i)} for integers i by R#(n). It is clear that if a is a value in R#(b), R#(a) is just R#(b) with a different offset. Therefore, unless there is a need to do otherwise, let us denote each sequence by its lowest value. These sequences can only behave in one of two ways. They can either be periodic with f(n,m) = f(n,0) for some m, or they can include infinitely many distinct values. Here is the behavior of R#(n) for n<=100:
* R#(1), R#(2) and R#(9) are 1-cycles.
* R#(3), R#(5), R#(7), R#(10) and R#(12) are 2-cycles.
* R#(14), R#(62) and R#(84) are 3-cycles.
* R#(92) is a 6-cycle.
* R#(18) is a 22-cycle.
* R#(34) (A261314) has been checked up to f(34,86) = 1091595086717, R#(42) up to f(42,108) = 106838266736, R#(50) up to f(50,98) = 1078406742163, R#(60) up to f(60,80) = 765456394363, R#(74) up to f(74,78) = 687059343029, R#(82) up to f(82,75) = 682580868743 R#(86) up to f(86,74) = 182831963148, R#(88) up to f(88,66) = 719074799059, and R#(98) up to f(98,88) = 641383978721 without repeated values. Hence, their periods are either extremely large or nonexistent (infinite). I conjecture that the latter is the case. Note that these sequences are not necessarily all distinct as any two may simply be the same sequence with a large offset.
For all other n<=100, a(n) is included in one of the above sequences. (End)
Conjecturally, the integers that belong to one of these cycles are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 37, 39, 41, 43, 47, 53, 62, 84, 87, 92, 121, 127, 132, 135, 181, 199, 205, 317. - Michel Marcus, Mar 07 2021

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a073846 n = a073846_list !! (n-1)
    a073846_list = concat $ transpose [a018252_list, a000040_list]
    -- Reinhard Zumkeller, Jan 29 2014
    
  • Maple
    N:= 100: # to get a(1) to a(2*N).
    p:= ithprime(N):
    P,NP:= selectremove(isprime,[$1..p]):
    seq(op([NP[i],P[i]]),i=1..N); # Robert Israel, Dec 22 2014
  • Mathematica
    Composite[n_Integer] := FixedPoint[n + PrimePi[ # ] + 1 &, n]; Join[{1}, Flatten[ Transpose[{Table[Prime[n], {n, 1, 35}], Table[Composite[n], {n, 1, 35}]}]]]
    f[upto_]:=Module[{prs=Prime[Range[PrimePi[upto]]],comps},comps= Complement[ Range[upto],prs];Riffle[Take[comps,Length[prs]],prs]]; f[150] (* Harvey P. Dale, Dec 03 2011 *)
  • PARI
    c(n) = for(k=0, primepi(n), isprime(n++)&&k--); n; \\ A002808
    a(n) = if (n==1, 1, if (n%2, c(n\2), prime(n/2))); \\ Michel Marcus, Mar 06 2021
    
  • Python
    from sympy import prime, composite
    def A073846(n): return 1 if n == 1 else (composite(n//2) if n % 2 else prime(n//2)) # Chai Wah Wu, Mar 09 2021

Formula

a(2*n-1) = A018252(n); a(2*n) = A000040(n). - Reinhard Zumkeller, Jan 29 2014
a(n) = A018252(ceiling(n/2))*A000035(n) + A000040(ceiling(n/2))*A059841(n), equivalent to Reinhard Zumkeller's formula. - Chayim Lowen, Jul 29 2015
a(2n)/a(2n-1) ~ log(n). - Thomas Ordowski, Sep 10 2015

Extensions

Edited by Robert G. Wilson v and Benoit Cloitre, Aug 16 2002

A308598 The smaller term of the pair (a(n), a(n+1)) is always prime and in each pair there is a composite number; a(1) = 2 and the sequence is always extended with the smallest integer not yet present and not leading to a contradiction.

Original entry on oeis.org

2, 4, 3, 6, 5, 8, 7, 12, 11, 14, 13, 18, 17, 20, 19, 24, 23, 30, 29, 32, 31, 38, 37, 42, 41, 44, 43, 48, 47, 54, 53, 60, 59, 62, 61, 68, 67, 72, 71, 74, 73, 80, 79, 84, 83, 90, 89, 98, 97, 102, 101, 104, 103, 108, 107, 110, 109, 114, 113, 128, 127, 132, 131, 138, 137, 140, 139, 150, 149
Offset: 1

Views

Author

Bernard Schott, Jun 09 2019

Keywords

Comments

The idea of this sequence comes from A282649 where "larger" replaces "smaller".
The sequence is not a permutation of the positive integers.
The 1st bisection is A000040 (the primes) and the 2nd bisection is A008864 \ {3} (prime(n) + 1).
Consecutive primes p < q separated by composites c = q + 1. - Michael De Vlieger, Jun 09 2019

Examples

			In the 1st pair of integers (2,4) the smaller term is (2), which is prime;
In the 2nd pair of integers (4,3) the smaller term is (3), which is prime;
In the 3rd pair of integers (3,6) the smaller term is (3), which is prime;
In the 4th pair of integers (6,5) the smaller term is (5), which is prime;
In the 5th pair of integers (5,8) the smaller term is (5), which is prime; etc.
		

Crossrefs

Cf. A000040 (prime numbers), A002808 (composite numbers), A008864 (prime(n) + 1).
Cf. A282649 (similar, with larger term).
Cf. A067747, A073846, A073898 (sequences with same start).

Programs

  • Mathematica
    Fold[Join[#1, {#2, NextPrime@ #2 + 1}] &, {#, NextPrime@ # + 1} &@ 2, Prime@ Range[2, 35]] (* Michael De Vlieger, Jun 09 2019 *)

Formula

n odd: a(n) = prime((n+1)/2) = A000040((n+1)/2).
n even: a(n) = a(n+1) + 1 = prime(n/2 + 1) + 1 = A008864(n/2 + 1).
Alternatively, if a(n-1) is prime, a(n) = 1 + min prime > a(n-1) else a(n) = a(n-1) - 1. - Bill McEachen, May 16 2024
Showing 1-2 of 2 results.