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

A203602 Inverse permutation to A092401.

Original entry on oeis.org

1, 3, 2, 5, 7, 4, 9, 11, 13, 15, 17, 6, 19, 21, 8, 23, 25, 27, 29, 31, 10, 33, 35, 12, 37, 39, 14, 41, 43, 16, 45, 47, 18, 49, 51, 53, 55, 57, 20, 59, 61, 22, 63, 65, 67, 69, 71, 24, 73, 75, 26, 77, 79, 28, 81, 83, 30, 85, 87, 32, 89, 91, 93, 95, 97, 34, 99
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 03 2012

Keywords

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (mapMaybe)
    a203602 n = a203602_list !! (n-1)
    a203602_list = map (+ 1) $ mapMaybe (`elemIndex` a092401_list) [1..]
  • Mathematica
    div[n_, m_]=Floor[n/m // Chop]-Ceiling[n/m // Chop](*n not divisible by m=>-1, else 0*); ind[m_]:=Sum[(-1)^(n) div[m, 3^n], {n, 1, Floor[Log[m]/Log[3] // FullSimplify]}] + Mod[Floor[Log[3 m]/Log[3] // FullSimplify], 2];(* returns 0 or 1 depending on if we have an 'n' term (=>1) or a '3n' term (=>0) *) f[m_] := (2* Sum[(-1)^(n) Floor[m/(3^(n)) // FullSimplify], {n, 0, Floor[Log[m]/Log[3] // FullSimplify]}] - 1)* ind[m] + (1 - ind[m]) (2* Sum[(-1)^(n) Floor[m/(3^(n + 1)) // FullSimplify], {n, 0, -1 + Floor[Log[m]/Log[3] // FullSimplify]}]);
    Table[f[k], {k, 1, 50}] (* Daniel Hoying, Aug 06 2020 *)

Formula

a(n) = -2*(Sum_{k=0..-1+floor(log(n)/log(3))} (-1)^k*floor(n/3^(k+1)))*(-1 + (floor(log(3*n)/log(3)) mod 2)+Sum_{k=1..floor(log(n)/log(3))} (-1)^k*(-ceiling(n/3^k) + floor(n/3^k))) + (-1 + 2*Sum_{k=0..floor(log(n)/log(3))} (-1)^k*floor(n/3^k))*((floor(log(3*n)/log(3)) mod 2)+Sum_{k=1..floor(log(n)/log(3))} (-1)^k*(-ceiling(n/3^k) + floor(n/3^k))). - Daniel Hoying, Aug 06 2020

A007417 If k appears, 3k does not.

Original entry on oeis.org

1, 2, 4, 5, 7, 8, 9, 10, 11, 13, 14, 16, 17, 18, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35, 36, 37, 38, 40, 41, 43, 44, 45, 46, 47, 49, 50, 52, 53, 55, 56, 58, 59, 61, 62, 63, 64, 65, 67, 68, 70, 71, 72, 73, 74, 76, 77, 79, 80, 81, 82, 83, 85, 86, 88, 89, 90, 91, 92, 94, 95, 97, 98, 99, 100
Offset: 1

Views

Author

Keywords

Comments

The characteristic function of this sequence is given by A014578. - Philippe Deléham, Mar 21 2004
Numbers whose ternary representation ends in even number of zeros. - Philippe Deléham, Mar 25 2004
Numbers for which 3 is not an infinitary divisor. - Vladimir Shevelev, Mar 18 2013
Where odd terms occur in A051064. - Reinhard Zumkeller, May 23 2013

Examples

			From _Gary W. Adamson_, Mar 02 2010: (Start)
Given the following multiplication table: top row = "not multiples of 3", left column = powers of 3; we get:
   1   2   4   5   7   8   10   11   13
   3   6  12  15  21  24   30   33   39
   9  18  36  45  63  72   90   99  114
  27  54 108
  81
If rows are labeled (1, 2, 3, ...) then odd-indexed rows are in the set; but evens not. Examples: 9 is in the set since 3 is not, but 27 in row 4 can't be. (End)
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Complement of A145204. - Reinhard Zumkeller, Oct 04 2008
Cf. A007949, A014578 (characteristic function), A042948, A051064, A052330, A092400, A092401.

Programs

  • Haskell
    import Data.List (delete)
    a007417 n = a007417_list !! (n-1)
    a007417_list = s [1..] where
       s (x:xs) = x : s (delete (3*x) xs)
    
  • Mathematica
    Select[ Range[100], (# // IntegerDigits[#, 3]& // Split // Last // Count[#, 0]& // EvenQ)&] (* Jean-François Alcover, Mar 01 2013, after Philippe Deléham *)
    Select[Range[100], EvenQ@ IntegerExponent[#, 3] &] (* Michael De Vlieger, Sep 01 2020 *)
  • PARI
    is(n) = { my(i = 0); while(n%3==0, n/=3; i++); i%2==0; } \\ Iain Fox, Nov 17 2017
    
  • PARI
    is(n)=valuation(n,3)%2==0; \\ Joerg Arndt, Aug 08 2020
    
  • Python
    from sympy import integer_log
    def A007417(n):
        def f(x): return n+x-sum(((m:=x//9**i)-2)//3+(m-1)//3+2 for i in range(integer_log(x,9)[0]+1))
        m, k = n, f(n)
        while m != k: m, k = k, f(k)
        return m # Chai Wah Wu, Feb 15 2025

Formula

Limit_{n->infinity} a(n)/n = 4/3. - Philippe Deléham, Mar 21 2004
Partial sums of A092400. Indices of even numbers in A007949. Indices of odd numbers in A051064. a(n) = A092401(2n-1). - Philippe Deléham, Mar 29 2004
{a(n)} = A052330({A042948(n)}), where {a(n)} denotes the set of integers in the sequence. - Peter Munn, Aug 31 2019

Extensions

More terms from Philippe Deléham, Mar 29 2004
Typo corrected by Philippe Deléham, Apr 15 2010

A133640 List of pairs n,4n, where n is the least unused number so far.

Original entry on oeis.org

1, 4, 2, 8, 3, 12, 5, 20, 6, 24, 7, 28, 9, 36, 10, 40, 11, 44, 13, 52, 14, 56, 15, 60, 16, 64, 17, 68, 18, 72, 19, 76, 21, 84, 22, 88, 23, 92, 25, 100, 26, 104, 27, 108, 29, 116, 30, 120, 31, 124, 32, 128, 33, 132, 34, 136, 35, 140, 37, 148, 38, 152, 39, 156
Offset: 1

Views

Author

Jonathan Vos Post, Dec 28 2007

Keywords

Comments

A permutation of the natural numbers. This is to 4 as A036552 is to 2 and as A092401.

Examples

			Equivalently, this is row 4 of the array A[k,n] = n-th value of the sequence: list of pairs n,k*n, where n is the least unused number so far. That array begins:
===========================================================================
n...|.1..2..3..4..5..6..7..8..9..10..11..12..13..14..15..16..17..18..19..20
===========================================================================
k=2.|.1..2..3..6..4..8..5.10..7..14...9..18..11..22..12..24..13..26..15..30
k=3.|.1..3..2..6..4.12..5.15..7..21...8..24...9..27..10..30..11..33..13..39
k=4.|.1..4..2..8..3.12..5.20..6..24...7..28...9..36..10..40..11..44..13..52
k=5.|.1..5..2.10..3.15..4.20..6..30...7..35...8..40...9..45..11..55..12..60
k=6.|.1..6..2.12..3.18..4.24..5..30...7..42...8..48...9..54..10..60..11..66
k=7.|.1..7..2.14..3.21..4.28..5..35...6..42...8..56...9..63..10..70..11..77
k=8.|.1..8..2.16..3.24..4.32..5..40...6..48...7..56...9..72..10..80..11..88
k=9.|.1..9..2.18..3.27..4.36..5..45...6..54...7..63...8..72..10..90..11..99
k=10|.1.10..2.20..3.30..4.40..5..50...6..60...7..70...8..80...9..90..11.110
===========================================================================
		

Crossrefs

Programs

  • Mathematica
    L = {1, 4}; Do[x=First[Complement[Range[Max[L] + 1], L]]; L = Join[L, {x, 4*x}], {38}]; L (* Giovanni Resta, Jun 19 2016 *)

Extensions

Data corrected by Giovanni Resta, Jun 19 2016
Showing 1-3 of 3 results.