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.

A135141 a(1)=1, a(p_n)=2*a(n), a(c_n)=2*a(n)+1, where p_n = n-th prime, c_n = n-th composite number.

Original entry on oeis.org

1, 2, 4, 3, 8, 5, 6, 9, 7, 17, 16, 11, 10, 13, 19, 15, 12, 35, 18, 33, 23, 21, 14, 27, 39, 31, 25, 71, 34, 37, 32, 67, 47, 43, 29, 55, 22, 79, 63, 51, 20, 143, 26, 69, 75, 65, 38, 135, 95, 87, 59, 111, 30, 45, 159, 127, 103, 41, 24, 287, 70, 53, 139, 151, 131, 77, 36, 271, 191
Offset: 1

Views

Author

Katarzyna Matylla, Feb 13 2008

Keywords

Comments

A permutation of the positive integers, related to A078442.
a(p) is even when p is prime and is divisible by 2^(prime order of p).
From Robert G. Wilson v, Feb 16 2008: (Start)
What is the length of the cycle containing 10? Is it infinite? The cycle begins 10, 17, 12, 11, 16, 15, 19, 18, 35, 29, 34, 43, 26, 31, 32, 67, 36, 55, 159, 1055, 441, 563, 100, 447, 7935, 274726911, 1013992070762272391167, ... Implementation in Mmca: NestList[a(AT)# &, 10, 26] Furthermore, it appears that any non-single-digit number has an infinite cycle.
Records: 1, 2, 4, 8, 9, 17, 19, 35, 39, 71, 79, 143, 159, 287, 319, 575, 639, 1151, 1279, 2303, 2559, 4607, 5119, 9215, 10239, 18431, 20479, 36863, 40959, 73727, 81919, 147455, 163839, 294911, 327679, 589823, 655359, ..., . (End)

Examples

			a(20) = 33 = 2*16 + 1 because 20 is 11th composite and a(11)=16. Or, a(20)=33=100001(bin). In other words it is a composite number, its index is a prime number, whose index is a prime....
		

Crossrefs

Cf. A246346, A246347 (record positions and values).
Cf. A227413 (inverse).
Cf. A071574, A245701, A245702, A245703, A245704, A246377, A236854, A237427 for related and similar permutations.

Programs

  • Haskell
    import Data.List (genericIndex)
    a135141 n = genericIndex a135141_list (n-1)
    a135141_list = 1 : map f [2..] where
       f x | iprime == 0 = 2 * (a135141 $ a066246 x) + 1
           | otherwise   = 2 * (a135141 iprime)
           where iprime = a049084 x
    -- Reinhard Zumkeller, Jan 29 2014
    
  • Mathematica
    a[1] = 1; a[n_] := If[PrimeQ@n, 2*a[PrimePi[n]], 2*a[n - 1 - PrimePi@n] + 1]; Array[a, 69] (* Robert G. Wilson v, Feb 16 2008 *)
  • Maxima
    /* Let pc = prime count (which prime it is), cc = composite count: */
    pc[1]:0;
    cc[1]:0;
    pc[2]:1;
    cc[4]:1;
    pc[n]:=if primep(n) then 1+pc[prev_prime(n)] else 0;
    cc[n]:=if primep(n) then 0 else if primep(n-1) then 1+cc[n-2] else 1+cc[n-1];
    a[1]:1;
    a[n]:=if primep(n) then 2*a[pc[n]] else 1+2*a[cc[n]];
    
  • PARI
    A135141(n) = if(1==n, 1, if(isprime(n), 2*A135141(primepi(n)), 1+(2*A135141(n-primepi(n)-1)))); \\ Antti Karttunen, Dec 09 2019
  • Python
    from sympy import isprime, primepi
    def a(n): return 1 if n==1 else 2*a(primepi(n)) if isprime(n) else 2*a(n - 1 - primepi(n)) + 1 # Indranil Ghosh, Jun 11 2017, after Mathematica code
    

Formula

a(n) = 2*A135141((A049084(n))*chip + A066246(n)*(1-chip)) + 1 - chip, where chip = A010051(n). - Reinhard Zumkeller, Jan 29 2014
From Antti Karttunen, Dec 09 2019: (Start)
A007814(a(n)) = A078442(n).
A070939(a(n)) = A246348(n).
A080791(a(n)) = A246370(n).
A054429(a(n)) = A246377(n).
A245702(a(n)) = A245703(n).
a(A245704(n)) = A245701(n). (End)

A246360 a(1) = 1, then A007051 ((3^n)+1)/2 interleaved with A057198 (5*3^(n-1)+1)/2.

Original entry on oeis.org

1, 2, 3, 5, 8, 14, 23, 41, 68, 122, 203, 365, 608, 1094, 1823, 3281, 5468, 9842, 16403, 29525, 49208, 88574, 147623, 265721, 442868, 797162, 1328603, 2391485, 3985808, 7174454, 11957423, 21523361, 35872268, 64570082, 107616803, 193710245, 322850408, 581130734
Offset: 1

Views

Author

Antti Karttunen, Aug 24 2014

Keywords

Comments

Also record values in A048673.

Crossrefs

Even bisection: A007051 from A007051(1) onward: [2, 5, 14, 41, ...]
Odd bisection: 1 followed by A057198.
A029744 gives the corresponding record positions in A048673.
A247284 gives the maximum values of A048673 between these records and A247283 gives the positions where they occur.
Subsequence of A246361.

Programs

  • Mathematica
    LinearRecurrence[{1, 3, -3}, {1, 2, 3, 5}, 40] (* Hugo Pfoertner, Sep 27 2022 *)
  • Python
    def A246360(n): return 1 if n==1 else (3+((n&1)<<1))*3**((n>>1)-1)+1>>1 # Chai Wah Wu, Sep 02 2025
  • Scheme
    (define (A246360 n) (cond ((<= n 1) n) ((even? n) (/ (+ 1 (A000244 (/ n 2))) 2)) (else (/ (+ 1 (* 5 (A000244 (/ (- n 3) 2)))) 2))))
    

Formula

a(1) = 1, a(2n) = (3^n+1)/2, a(2n+1) = (5 * 3^(n-1)+1)/2.
a(n) = A048673(A029744(n)).
a(n) = A087503(n-3) + 2 for n >= 3. - Peter Kagey, Nov 30 2019
G.f.: x -x^2*(-2-x+4*x^2) / ( (x-1)*(3*x^2-1) ). - R. J. Mathar, Sep 23 2014

A246348 a(1)=1, a(p_n) = 1 + a(n), a(c_n) = 1 + a(n), where p_n = n-th prime = A000040(n), c_n = n-th composite number = A002808(n); Also binary width of terms of A135141.

Original entry on oeis.org

1, 2, 3, 2, 4, 3, 3, 4, 3, 5, 5, 4, 4, 4, 5, 4, 4, 6, 5, 6, 5, 5, 4, 5, 6, 5, 5, 7, 6, 6, 6, 7, 6, 6, 5, 6, 5, 7, 6, 6, 5, 8, 5, 7, 7, 7, 6, 8, 7, 7, 6, 7, 5, 6, 8, 7, 7, 6, 5, 9, 7, 6, 8, 8, 8, 7, 6, 9, 8, 8, 7, 7, 6, 8, 6, 7, 9, 8, 6, 8, 7, 6, 5, 10, 8, 7, 9, 9, 6, 9, 8, 7, 10
Offset: 1

Views

Author

Antti Karttunen, Aug 27 2014

Keywords

Comments

If n = 1, the result is 1, otherwise, if n is prime, compute the result for that prime's index (A000720 or A049084) and add one, and if n is composite, compute the result for that composite's index (A065855) and add one.
a(n) tells how many calls (including the toplevel call) are required to compute A135141(n) or A246377(n) with a simple (nonmemoized) recursive algorithm as employed for example by Robert G. Wilson v's Mathematica-program of Feb 16 2008 in A135141 or Antti Karttunen's Scheme-proram in A246377.

Crossrefs

Programs

Formula

a(1) = 1, and for n >= 1, if A010051(n)=1 [that is, when n is prime], a(n) = 1 + a(A000720(n)), otherwise a(n) = 1 + a(A065855(n)). [A000720(n) and A065855(n) tell the number of primes, and respectively, composites <= n].
a(n) = A246369(n) + A246370(n).
a(n) = A070939(A135141(n)) = 1 + floor(log_2(A135141(n))). [Sequence gives also the binary width of terms of A135141].
a(n) = A070939(A246377(n)). [Also for 0/1-swapped version of that sequence].

A246346 Positions of records in A135141.

Original entry on oeis.org

1, 2, 3, 5, 8, 10, 15, 18, 25, 28, 38, 42, 55, 60, 77, 84, 105, 115, 140, 152, 183, 198, 235, 253, 298, 320, 372, 399, 462, 494, 566, 605, 692, 736, 838, 891, 1007, 1072, 1205, 1280, 1432, 1521, 1698, 1800, 2002, 2120, 2352, 2488, 2755, 2910, 3210, 3387, 3731, 3934, 4322, 4552, 4990, 5250
Offset: 1

Views

Author

Antti Karttunen, Aug 27 2014

Keywords

Comments

Bisection 2, 5, 10, 18, 28, 42, ... seems to give the positions of records in A246348 after the initial positions: 1, 2, 3, 5, 10, 18, 28, 42, ...
This easily follows from the pattern present in A246347, as from its fourth term onward, each two successive new records appear to have the same binary width.

Crossrefs

A246347 gives the corresponding values.

Programs

Formula

a(n) = A227413(A246347(n)).
Showing 1-4 of 4 results.