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.

Previous Showing 21-28 of 28 results.

A163234 Inverse permutation to A163233.

Original entry on oeis.org

0, 1, 2, 4, 6, 3, 11, 7, 9, 13, 5, 8, 24, 18, 17, 12, 28, 21, 37, 29, 10, 15, 16, 22, 58, 48, 47, 38, 31, 39, 23, 30, 35, 43, 27, 34, 62, 52, 51, 42, 14, 19, 20, 26, 32, 25, 41, 33, 112, 98, 97, 84, 73, 85, 61, 72, 70, 59, 83, 71, 40, 49, 50, 60, 120, 105, 137, 121, 78
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163233. a(n) = A163236(A057300(n)). Cf. A163236.

Programs

  • Python
    def A(x, y): return (((x + y)**2) + x + 3*y)//2
    def a006068(n):
        s=1
        while True:
            ns=n>>s
            if ns==0: break
            n=n^ns
            s<<=1
        return n
    def a059905(n): return sum([(n>>2*i&1)<Indranil Ghosh, Jun 25 2017
  • Scheme
    (define (A163234 n) (A001477bi (A006068 (A059905 n)) (A006068 (A059906 n))))
    (define (A001477bi x y) (/ (+ (expt (+ x y) 2) x (* 3 y)) 2))
    

Formula

a(n) = A001477bi(A006068(A059905(n)),A006068(A059906(n))), where A001477bi(x,y) = (((x+y)^2)+x+(3y))/2.

A163236 Inverse permutation to A163235.

Original entry on oeis.org

0, 2, 1, 4, 9, 5, 13, 8, 6, 11, 3, 7, 24, 17, 18, 12, 35, 27, 43, 34, 14, 20, 19, 26, 62, 51, 52, 42, 32, 41, 25, 33, 28, 37, 21, 29, 58, 47, 48, 38, 10, 16, 15, 22, 31, 23, 39, 30, 112, 97, 98, 84, 70, 83, 59, 71, 73, 61, 85, 72, 40, 50, 49, 60, 135, 119, 151, 134, 90
Offset: 0

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163235. a(n) = A163234(A057300(n)). Cf. A163234.

Programs

  • Python
    def A(x, y): return (((x + y)**2) + x + 3*y)//2
    def a006068(n):
        s=1
        while True:
            ns=n>>s
            if ns==0: break
            n=n^ns
            s<<=1
        return n
    def a059905(n): return sum([(n>>2*i&1)<Indranil Ghosh, Jun 25 2017
  • Scheme
    (define (A163236 n) (A001477bi (A006068 (A059906 n)) (A006068 (A059905 n))))
    (define (A001477bi x y) (/ (+ (expt (+ x y) 2) x (* 3 y)) 2))
    

Formula

a(n) = A001477bi(A006068(A059906(n)),A006068(A059905(n))), where A001477bi(x,y) = (((x+y)^2)+x+(3y))/2.

A371442 For any positive integer n with binary digits (b_1, ..., b_w) (where b_1 = 1), the binary digits of a(n) are (b_1, b_3, ..., b_{2*ceiling(w/2)-1}); a(0) = 0.

Original entry on oeis.org

0, 1, 1, 1, 2, 3, 2, 3, 2, 2, 3, 3, 2, 2, 3, 3, 4, 5, 4, 5, 6, 7, 6, 7, 4, 5, 4, 5, 6, 7, 6, 7, 4, 4, 5, 5, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, 4, 4, 5, 5, 4, 4, 5, 5, 6, 6, 7, 7, 6, 6, 7, 7, 8, 9, 8, 9, 10, 11, 10, 11, 8, 9, 8, 9, 10, 11, 10, 11, 12, 13, 12
Offset: 0

Author

Rémy Sigrist, Mar 24 2024

Keywords

Comments

In other words, we keep odd-indexed bits.
For any v > 0, the value v appears A003945(A070939(v)) times in the sequence.

Examples

			The first terms, in decimal and in binary, are:
  n   a(n)  bin(n)  bin(a(n))
  --  ----  ------  ---------
   0     0       0          0
   1     1       1          1
   2     1      10          1
   3     1      11          1
   4     2     100         10
   5     3     101         11
   6     2     110         10
   7     3     111         11
   8     2    1000         10
   9     2    1001         10
  10     3    1010         11
  11     3    1011         11
  12     2    1100         10
  13     2    1101         10
  14     3    1110         11
  15     3    1111         11
		

Crossrefs

See A371459 for the sequence related to even-indexed bits.
See A059905 and A063694 for similar sequences.

Programs

  • Mathematica
    A371442[n_] := FromDigits[IntegerDigits[n, 2][[1;;-1;;2]], 2];
    Array[A371442, 100, 0] (* Paolo Xausa, Mar 28 2024 *)
  • PARI
    a(n) = { my (b = binary(n)); fromdigits(vector(ceil(#b/2), k, b[2*k-1]), 2); }
    
  • Python
    def a(n): return int(bin(n)[::2], 2)

Formula

a(A000695(n)) = n.
a(A001196(n)) = n.
a(A165199(n)) = a(n).

A318702 For any n >= 0 with binary expansion Sum_{k=0..w} b_k * 2^k, let f(n) = Sum_{k=0..w} b_k * i^k * 2^floor(k/2) (where i denotes the imaginary unit); a(n) is the real part of f(n).

Original entry on oeis.org

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

Author

Rémy Sigrist, Sep 01 2018

Keywords

Comments

See A318703 for the imaginary part of f.
See A318704 for the square of the modulus of f.
The function f defines a bijection from the nonnegative integers to the Gaussian integers.
This sequence has similarities with A316657.

Crossrefs

Programs

  • Mathematica
    Array[Re[Total@ MapIndexed[#1*I^(First@ #2 - 1)*2^Floor[(First@ #2 - 1)/2] &, Reverse@ IntegerDigits[#, 2]]] &, 76, 0] (* Michael De Vlieger, Sep 02 2018 *)
  • PARI
    a(n) = my (b=Vecrev(binary(n))); real(sum(k=1, #b, b[k] * I^(k-1) * 2^floor((k-1)/2)))

Formula

a(n) = A053985(A059905(n)).
a(4 * k) = -2 * a(k) for any k >= 0.

A319521 Completely multiplicative with a(prime(2*k-1)) = prime(k) and a(prime(2*k)) = 1 for any k > 0 (where prime(k) denotes the k-th prime number).

Original entry on oeis.org

1, 2, 1, 4, 3, 2, 1, 8, 1, 6, 5, 4, 1, 2, 3, 16, 7, 2, 1, 12, 1, 10, 11, 8, 9, 2, 1, 4, 1, 6, 13, 32, 5, 14, 3, 4, 1, 2, 1, 24, 17, 2, 1, 20, 3, 22, 19, 16, 1, 18, 7, 4, 1, 2, 15, 8, 1, 2, 23, 12, 1, 26, 1, 64, 3, 10, 29, 28, 11, 6, 1, 8, 31, 2, 9, 4, 5, 2, 1
Offset: 1

Author

Rémy Sigrist, Sep 22 2018

Keywords

Comments

See A319522 for a similar sequence.
The function n -> (a(n), A319522(n)) establishes a bijection from N to N x N (where N = A000027); see A319523 for the corresponding inverse function.
This sequence has similarities with A059905: here we keep one p-adic valuation out of two, there we keep one binary digit out of two.

Examples

			a(42) = a(prime(1)) * a(prime(2)) * a(prime(4)) = prime(1) * 1 * 1 = 2.
		

Programs

  • PARI
    a(n) = my (f=factor(n)); prod(i=1, #f~, my (pi=primepi(f[i,1])); if (pi%2==1, prime(1+pi\2)^f[i,2], 1))

Formula

a(n) = 1 iff n = 1 or n belongs to A066207.
a(n) <= n with equality iff n is a power of 2 (A000079).
A007814(a(n)) = A007814(n).

A152819 "Upper primes" (see A152754).

Original entry on oeis.org

2, 11, 37, 41, 43, 47, 59, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 227, 229, 233, 239, 251, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727
Offset: 1

Author

Vladimir Shevelev, Dec 13 2008

Keywords

Crossrefs

Cf. A152754.

Programs

  • Mathematica
    fh[n_,h_] := If[h==1, Mod[n,2], If[Mod[n,4]>=2,1,0]]; half[n_, h_ ] := Module[{t=1, s=0, m=n}, While[m>0, s += fh[m,h]*t; m=Quotient[m,4]; t *= 2]; s]; mb[n_] := FromDigits[Riffle[IntegerDigits[n, 2], 0], 2]; aQ[n_] := PrimeQ[n] && mb[half[ n,1]] < mb[half[n, 2]]; Select[Range[730], aQ] (* Amiram Eldar, Dec 16 2018 from the PARI code *)
  • PARI
    a000695(n) = fromdigits(binary(n), 4);
    half1(n) = { my(t=1, s=0); while(n>0, s += (n%2)*t; n \= 4; t *= 2); (s); }; \\ A059905
    half2(n) = { my(t=1, s=0); while(n>0, s += ((n%4)>=2)*t; n \= 4; t *= 2); (s); }; \\ A059906
    isok(n) = isprime(n) && a000695(half1(n)) < a000695(half2(n)); \\ Michel Marcus, Dec 15 2018

Extensions

More terms from Michel Marcus, Dec 15 2018

A296689 Let phi be the one-to-one mapping between binary trees and natural numbers described in the Tychonievich link. Let a(n) = min({phi^{-1}(t)| size(t)=n}); i.e., a(n) is the rank -- starting from 0 -- of the first tree the size of which is n.

Original entry on oeis.org

0, 1, 2, 4, 7, 13, 24, 30, 54, 64, 124, 244, 383, 503, 981, 1021, 1981, 3901, 6137, 8057, 13649, 16369, 32689, 65329, 98230, 130870, 229312, 261952, 491516, 524156, 1046388, 1048564, 2093044, 4182004, 8359924, 16715764, 25141220, 33497060, 58703812, 67059652, 125828996, 134184836, 259487492, 268435204, 536866564, 1073729284
Offset: 0

Author

Philippe Esperet, Dec 18 2017

Keywords

Comments

Let v(n) = max({phi^{-1}(t)| size(t)=n}); v(n) is already known as A072639.
The interleaving process used by Tychonievich is not specific to base 2, each base b>=3 giving birth to a new a(n)-like sequence and a new v(n)-like sequence.
a(n) is the position of the first occurrence of n in A072644. - Andrey Zabolotskiy, Dec 20 2017
The tree-enumeration scheme of Tychonievich is similar, but not the same as "Recursive binary interleaving of binary trees" mentioned at my OEIS Wiki notes about Alternative Catalan Orderings. On the other hand, it seems to be the same (possibly up to the reflection of binary trees) as the ranking/unranking scheme mentioned in the section "Binary tree encoding with bijection" and in sequences A072634 - A072637 that are permutations of nonnegative integers induced by cross-ranking binary trees between such a "dense" binary interleaving ranking system and the standard lexicographic ordering of them (A014486). - Antti Karttunen, Dec 20 2017

Programs

  • OCaml
    let rec evenOdd=function(*Luther Tychonievich decomposition*)
    | n when n<=1 -> n,0
    | n -> let ev,od=evenOdd(n/2) in
            2*od+n mod 2,ev
    let rec cardImage=function
    | n when n<=1 -> n
    | n -> let ev,od=evenOdd(n-1) in 1+cardImage(ev)+cardImage(od)
    let checkCatalanBis n=(*why 2*n+1 ? empirical...*)
      let (first,last)=(Array.make (2*n+1) 0,Array.make (2*n+1) 0) in
        for i=0 to 1 lsl n do
        let cai=cardImage i in
          last.(cai)<-1+last.(cai);
          if first.(cai)=0 then first.(cai)<-i done;
      (first,last)
    
  • Python
    def dei(n):
        n1 = n2 = 0
        bit = 1
        while n:
            if n&1:
                n1 += bit
            n >>= 1
            if n&1:
                n2 += bit
            n >>= 1
            bit <<= 1
        return (n1, n2)
    r = [0]
    for n in range(1, 100):
        r.append(1 + sum(r[x] for x in dei(n-1)))
    print([r.index(x) for x in range(max(r)+1)])
    # Andrey Zabolotskiy, Dec 20 2017

A147795 If n=A000695(k_n)+2*A000695(l_n), then a(n) is the number of nonnegative integers m

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 3, 3, 6, 6, 7, 7, 8, 8, 9, 9, 12, 12, 13, 13, 14, 14, 15, 15, 18, 18, 19, 19, 20, 20, 21, 21, 28, 28, 29, 29, 30, 30, 31, 31, 34, 34, 35, 35, 36, 36, 37, 37, 40, 40, 41, 41, 42, 42, 43, 43, 46, 46, 47, 47, 48, 48, 49, 49
Offset: 0

Author

Vladimir Shevelev, Nov 13 2008

Keywords

Comments

Let us call integers m and n collinear one to another if either A059905(m)=A059905(n) or A059906(m)=A059906(n). Then a(n) is the number of noncollinear to n nonnegative integers not exceeding n.

Crossrefs

Formula

Theorem: a(2n)=a(2n+1).

Extensions

More terms from Philippe Deléham, Oct 18 2011
Previous Showing 21-28 of 28 results.