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 201 results. Next

A245612 Permutation of natural numbers: a(0) = 1, a(1) = 2, a(2n) = 3*a(n)-1, a(2n+1) = A254049(a(n)); composition of A048673 and A163511.

Original entry on oeis.org

1, 2, 5, 3, 14, 13, 8, 4, 41, 63, 38, 25, 23, 18, 11, 6, 122, 313, 188, 172, 113, 123, 74, 61, 68, 88, 53, 39, 32, 28, 17, 7, 365, 1563, 938, 1201, 563, 858, 515, 666, 338, 613, 368, 424, 221, 303, 182, 85, 203, 438, 263, 270, 158, 193, 116, 72, 95, 138, 83, 46, 50, 33, 20, 9
Offset: 0

Views

Author

Antti Karttunen, Jul 28 2014

Keywords

Comments

Note the indexing: the domain starts from 0, while the range excludes zero.
From Antti Karttunen, Jul 25 2016: (Start)
This sequence can be represented as a binary tree. Each left hand child is obtained by applying A016789(n-1) when the parent contains n (i.e., multiply by 3, subtract one), and each right hand child is obtained by applying A254049 to the parent's contents:
1
|
...................2...................
5 3
14......../ \........13 8......../ \........4
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
41 63 38 25 23 18 11 6
122 313 188 172 113 123 74 61 68 88 53 39 32 28 17 7
etc.
(End)

Crossrefs

Programs

  • Mathematica
    Table[(Times @@ Power[If[# == 1, 1, NextPrime@ #] & /@ First@ #, Last@ #] + 1)/2 &@ Transpose@ FactorInteger@ If[n == 0, 1, Prime[#] Product[Prime[m]^(Map[Ceiling[(Length@ # - 1)/2] &, DeleteCases[Split@ Join[Riffle[IntegerDigits[n, 2], 0], {0}], {k__} /; k == 1]][[-m]]), {m, #}] &[DigitCount[n, 2, 1]]], {n, 0, 63}] (* Michael De Vlieger, Jul 25 2016 *)
  • Scheme
    (define (A245612 n) (A048673 (A163511 n))) ;; offset 0, a(0) = 1.

Formula

a(n) = A048673(A163511(n)).
a(0) = 1, a(1) = 2, a(2n) = 3*a(n)-1, a(2n+1) = A254049(a(n)). - Antti Karttunen, Jul 25 2016

A366275 The Cat's tongue permutation: a(n) = A163511(A057889(n)).

Original entry on oeis.org

1, 2, 4, 3, 8, 9, 6, 5, 16, 27, 18, 15, 12, 25, 10, 7, 32, 81, 54, 45, 36, 75, 30, 21, 24, 125, 50, 35, 20, 49, 14, 11, 64, 243, 162, 135, 108, 225, 90, 63, 72, 375, 150, 105, 60, 147, 42, 33, 48, 625, 250, 175, 100, 245, 70, 55, 40, 343, 98, 77, 28, 121, 22, 13, 128, 729, 486, 405, 324, 675, 270, 189, 216, 1125
Offset: 0

Views

Author

Antti Karttunen, Oct 06 2023

Keywords

Comments

"Cat's tongue" refers to the look of the scatter plot of this sequence.

Crossrefs

Cf. A000040, A000225, A007814, A057889, A163511, A209229, A290251, A366276 (inverse map), A366277 (fixed points of map n -> a(n)), A366278, A366279, A366280, A366281 [= A052409(a(n))], A366282 [= a(n)-n], A366283 [= gcd(n,a(n))].
Cf. also A163511, A253563, A366263 (compare the scatter plots).

Programs

  • PARI
    A030101(n) = if(n<1,0,subst(Polrev(binary(n)),x,2));
    A057889(n) = if(!n,n,A030101(n/(2^valuation(n,2))) * (2^valuation(n, 2)));
    A163511(n) = if(!n, 1, my(p=2, t=1); while(n>1, if(!(n%2), (t*=p), p=nextprime(1+p)); n >>= 1); (t*p));
    A366275(n) = A163511(A057889(n));
    
  • Python
    from sympy import prime
    def A366275(n):
        if n:
            k, c, m = int(bin(n>>(r:=(~n & n-1).bit_length()))[:1:-1],2)<>= s+1
            return m*prime(c)
        return 1 # Chai Wah Wu, Oct 08 2023

Formula

For n >= 0, A001222(a(n)) = A290251(n).
For n >= 1, A007814(a(n)) = A135523(n) = A007814(n) + A209229(n). [Like A163511, also this permutation preserves the 2-adic valuation of n, except when n is a power of two, in which cases that value is incremented by one.]
For n >= 1, a(2*n) = 2*a(n).
For n >= 1, a(A000225(n)) = A000040(n).

A364255 a(n) = gcd(n, A163511(n)).

Original entry on oeis.org

1, 1, 2, 3, 4, 1, 6, 1, 8, 9, 2, 1, 12, 1, 2, 1, 16, 1, 18, 1, 4, 3, 2, 1, 24, 5, 2, 1, 4, 1, 2, 1, 32, 3, 2, 5, 36, 1, 2, 1, 8, 1, 6, 1, 4, 3, 2, 1, 48, 1, 10, 1, 4, 1, 2, 11, 8, 3, 2, 1, 4, 1, 2, 1, 64, 1, 6, 1, 4, 3, 10, 1, 72, 1, 2, 5, 4, 7, 2, 1, 16, 27, 2, 1, 12, 5, 2, 1, 8, 1, 6, 1, 4, 3, 2, 1, 96, 1, 2, 1, 20, 1, 2, 1, 8, 105
Offset: 0

Views

Author

Antti Karttunen, Jul 16 2023

Keywords

Crossrefs

Cf. A163511, A364257 (Dirichlet inverse), A364258, A364491, A364492, A364493.

Programs

  • PARI
    A163511(n) = if(!n,1,my(p=2, t=1); while(n>1, if(!(n%2), (t*=p), p=nextprime(1+p)); n >>= 1); (t*p));
    A364255(n) = gcd(n, A163511(n)); \\ Antti Karttunen, Sep 01 2023
  • Python
    from math import gcd
    from sympy import nextprime
    def A364255(n):
        c, p, k = 1, 1, n
        while k:
            c *= (p:=nextprime(p))**(s:=(~k&k-1).bit_length())
            k >>= s+1
        return gcd(c*p,n) # Chai Wah Wu, Jul 25 2023
    

Formula

From Antti Karttunen, Sep 01 2023: (Start)
a(n) = gcd(n, A364258(n)) = gcd(A163511(n), A364258(n)).
a(n) = n / A364491(n) = A163511(n)/ A364492(n).
(End)

A332214 Mersenne-prime fixing variant of permutation A163511: a(n) = A332212(A163511(n)).

Original entry on oeis.org

1, 2, 4, 3, 8, 9, 6, 7, 16, 27, 18, 49, 12, 21, 14, 5, 32, 81, 54, 343, 36, 147, 98, 25, 24, 63, 42, 35, 28, 15, 10, 31, 64, 243, 162, 2401, 108, 1029, 686, 125, 72, 441, 294, 175, 196, 75, 50, 961, 48, 189, 126, 245, 84, 105, 70, 155, 56, 45, 30, 217, 20, 93, 62, 11, 128, 729, 486, 16807, 324, 7203, 4802, 625, 216, 3087, 2058, 875
Offset: 0

Views

Author

Antti Karttunen, Feb 09 2020

Keywords

Comments

Any Mersenne prime (A000668) times any power of 2, i.e., sequence A335431, is fixed by this map (note the indexing), including also all even perfect numbers. It is not currently known whether there are any additional fixed points.
Because a(n) has the same prime signature as A163511(n), it implies that applying A046523 and A052409 to this sequence gives the same results as with A163511, namely, sequences A278531 and A365805. - Antti Karttunen, Oct 09 2023

Crossrefs

Cf. A163511, A332211, A332212, A332215 (inverse permutation).
Cf. A278531 [= A046523(a(n))], A290251 [= A001222(a(n))], A365805 [= A052409(a(n))], A366372 [= a(n)-n], A366373 [= gcd(n,a(n))], A366374 (numerator of n/a(n)), A366375 (denominator of n/a(n)), A366376.
Cf. A000043, A000668, A000396, A324200, A335431 (conjectured to give all the fixed points).

Programs

  • PARI
    A332214(n) = A332212(A163511(n));
    
  • PARI
    \\ Needs precomputed data for A332211:
    v332211 = readvec("b332211_to.txt"); \\ Prepared with gawk ' { print $2 } ' < b332211.txt > b332211_to.txt
    A332211(n) = v332211[n];
    A332214(n) = if(!n, 1, my(i=1, p=A332211(i), t=1); while(n>1, if(!(n%2), (t*=p), i++; p=A332211(i)); n >>= 1); (t*p)); \\ Antti Karttunen, Oct 09 2023

Formula

a(n) = A332212(A163511(n)).

A252738 Row products of irregular table A005940: a(0) = 1; a(1) = 2; for n > 1: 2^(2^(n-2)) * a(n-1) * A003961(a(n-1)); also row products of A163511, A253563, A253565, and A332977.

Original entry on oeis.org

1, 2, 12, 2160, 2449440000, 8488905214204800000000000, 3025568387202006082882734693673523654400000000000000000000000000
Offset: 0

Views

Author

Antti Karttunen, Dec 21 2014

Keywords

Examples

			From _Michael De Vlieger_, Jul 21 2023: (Start)
a(0) = 1 = product of {1},
a(1) = 2^1 = product of {2},
a(2) = 2^2 * 3^1 = product of {3, 2^2},
a(3) = 2^4 * 3^3 * 5^1 = product of {5, 2^1*3^1, 3^2, 2^3},
a(4) = 2^8 * 3^7 * 5^4 * 7^1 = product of
  {7, 2^1*5^1, 3^1*5^1, 2^2*3^1, 5^2, 2^1*3^2, 3^3, 2^4},
...
Table of e(n,k) where a(n) = Product_{k=1..n+1} prime(k)^e(n,k):
prime(k)|    2    3    5   7  11  13  17  19 23 29 31 ...
   n\k  |    1    2    3   4   5   6   7   8  9 10 11 ...
   ----------------------------------------------------
    0   |    1
    1   |    2    1
    2   |    4    3    1
    3   |    8    7    4   1
    4   |   16   15   11   5   1
    5   |   32   31   26  16   6   1
    6   |   64   63   57  42  22   7   1
    7   |  128  127  120  99  64  29   8   1
    8   |  256  255  247 219 163  93  37   9  1
    9   |  512  511  502 466 382 256 130  46 10  1
   10   | 1024 1023 1013 968 848 638 386 176 56 11  1
  ... (End)
		

Crossrefs

These are row products of irregular tables A005940, A163511, A253563 and A253565, which all are shaped like a binary tree.
Partial products of A252740.
Cf. A252737 (row sums), A252739 (divided by n), A252741 (divided by n!).

Programs

  • Mathematica
    Table[Times @@ Array[Prime[# + 1]^Sum[Binomial[n, # + j], {j, 0, n}] &, n + 1, 0], {n, 0, 5}] (* Michael De Vlieger, Jul 21 2023 *)
  • PARI
    allocatemem(234567890);
    A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
    A252738print(up_to_n) = { my(s, i=0, n=0); for(n=0, up_to_n, if(0 == n, s = 1, if(1 == n, s = 2; lev = vector(1); lev[1] = 2, oldlev = lev; lev = vector(2*length(oldlev)); s = 1; for(i = 0, (2^(n-1))-1, lev[i+1] = if((i%2),A003961(oldlev[(i\2)+1]),2*oldlev[(i\2)+1]); s *= lev[i+1]))); write("b252738.txt", n, " ", s)); }; \\ Counts them empirically.
    A252738print(7);
    
  • Scheme
    (definec (A252738rec n) (if (<= n 1) (+ 1 n) (* (A000079 (A000079 (- n 2))) (A252738rec (- n 1)) (A003961 (A252738rec (- n 1)))))) ;; Implements the given recurrence; uses the memoizing definec-macro.
    (define (A252738 n) (if (zero? n) 1 (mul A163511 (A000079 (- n 1)) (A000225 n))))
    (define (mul intfun lowlim uplim) (let multloop ((i lowlim) (res 1)) (cond ((> i uplim) res) (else (multloop (+ 1 i) (* res (intfun i)))))))
    ;; Another alternative, implementing the new recurrence:
    (definec (A252738 n) (if (<= n 1) (+ 1 n) (* (A267096 (- n 2)) (A000290 (A252738 (- n 1)))))) ;; Antti Karttunen, Feb 06 2016

Formula

a(0) = 1; a(1) = 2; for n > 1: a(n) = 2^(2^(n-2)) * a(n-1) * A003961(a(n-1)).
a(0) = 1; for n>=1: a(n) = Product_{k=A000079(n-1) .. A000225(n)} A163511(k) = Product_{k=2^(n-1) .. (2^n)-1} A163511(k).
a(0) = 1; a(1) = 2; for n > 1: a(n) = A267096(n-2) * a(n-1)^2. [Compare to the formulas of A191555] - Antti Karttunen, Feb 06 2016
From Michael De Vlieger, Jul 21 2023: (Start)
a(n) = Product_{k=1..n+1} prime(k)^e(n,k), where e(n,k) = k-th term in row n of A055248.
A067255(a(n)) = row n of A055248. (End)

Extensions

Typos in the second formula corrected by Antti Karttunen, Feb 06 2016

A278531 a(n) = A046523(A163511(n)).

Original entry on oeis.org

1, 2, 4, 2, 8, 4, 6, 2, 16, 8, 12, 4, 12, 6, 6, 2, 32, 16, 24, 8, 36, 12, 12, 4, 24, 12, 30, 6, 12, 6, 6, 2, 64, 32, 48, 16, 72, 24, 24, 8, 72, 36, 60, 12, 36, 12, 12, 4, 48, 24, 60, 12, 60, 30, 30, 6, 24, 12, 30, 6, 12, 6, 6, 2, 128, 64, 96, 32, 144, 48, 48, 16, 216, 72, 120, 24, 72, 24, 24, 8, 144, 72, 180, 36, 180, 60, 60, 12, 72, 36, 60, 12, 36, 12, 12, 4
Offset: 0

Views

Author

Antti Karttunen, Nov 30 2016

Keywords

Crossrefs

Programs

Formula

a(n) = A046523(A163511(n)).
a(n) = A278222(A054429(n)).

A292271 a(n) = A292385(A163511(n)).

Original entry on oeis.org

0, 1, 2, 2, 4, 5, 4, 5, 8, 8, 10, 11, 8, 8, 10, 10, 16, 17, 16, 17, 20, 20, 22, 23, 16, 17, 16, 16, 20, 21, 20, 20, 32, 32, 34, 35, 32, 32, 34, 34, 40, 41, 40, 41, 44, 44, 46, 47, 32, 32, 34, 34, 32, 33, 32, 33, 40, 40, 42, 42, 40, 41, 40, 41, 64, 65, 64, 65, 68, 68, 70, 71, 64, 65, 64, 64, 68, 69, 68, 68, 80, 80, 82, 83, 80, 80, 82, 82, 88, 89, 88, 89, 92, 92
Offset: 0

Views

Author

Antti Karttunen, Sep 16 2017

Keywords

Crossrefs

Formula

a(n) = A292385(A163511(n)).
a(n) + A292274(n) = n.

A292274 a(n) = A292383(A163511(n)).

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 2, 2, 0, 1, 0, 0, 4, 5, 4, 5, 0, 0, 2, 2, 0, 1, 0, 0, 8, 8, 10, 11, 8, 8, 10, 11, 0, 1, 0, 0, 4, 5, 4, 5, 0, 0, 2, 2, 0, 1, 0, 0, 16, 17, 16, 17, 20, 20, 22, 22, 16, 17, 16, 17, 20, 20, 22, 22, 0, 0, 2, 2, 0, 1, 0, 0, 8, 8, 10, 11, 8, 8, 10, 11, 0, 1, 0, 0, 4, 5, 4, 5, 0, 0, 2, 2, 0, 1, 0, 0, 32, 32, 34, 35, 32, 32, 34, 35, 40, 41, 40, 40, 44
Offset: 0

Views

Author

Antti Karttunen, Sep 16 2017

Keywords

Comments

Because A292383(n) = a(A243071(n)), the sequence works as a "masking function" where the 1-bits in a(n) (always a subset of the 1-bits in binary expansion of n) indicate which numbers are of the form 4k+3 in binary tree A005940 on that trajectory which leads from the root of the tree to the node containing A163511(n). This works because A243071(n) = A054429(A156552(n)), a bit-flipped variant of Leonid Broukhis's unary-binary encoded compressed factorization of natural numbers, A156552(n) being an inverse of Doudna map f(n) = A005940(1+n).

Examples

			A163511(18) = 54, that is, at "node address" 18 in binary tree A163511 (which is the mirror image of A005940) sits number 54. 18 in binary is "10010", which when read from left to right (after the most significant bit which is always 1) gives the directions to follow in either tree when starting from the root, so that we land in number 54. (E.g. in A005940-tree, turn right from 2, turn right from 4, turn left from 8 and then turn right from 27 and one lands in 54, this corresponds with the four lowermost bits of the code, "0010". In A163511 the sense of direction is just reversed). When one selects the numbers of the form 4k+3 from this path 1 -> 2 -> 4 -> 8 -> 27 -> 54, one sees that only one is 27, which corresponds with the second rightmost bit (which also is the only 1-bit) in the code, which can be masked with 2 (binary "10"), thus a(18) = 2.
A163511(15) = 7, that is, at "node address" 15 in binary tree A163511 sits number 7. 15 in binary is "1111", which tells that 7 can be located in mirror-image tree A005940 by going (after the initial root 1 and 2) three steps towards left from 2: 1 -> 2 -> 3 -> 5 -> 7. Of these numbers, only 3 and 7 are of the form 4k+3, thus the mask with which to obtain the corresponding bits from "1111" is "00101" (5 in binary), thus a(15) = 5.
A163511(31) = 11, that is, at "node address" 31 in binary tree A163511 sits number 11. 31 in binary is "11111", which tells that 11 can be located in mirror-image tree A005940 by going (after the initial root 1 and 2) four steps towards left from 2: 1 -> 2 -> 3 -> 5 -> 7 -> 11. Of these numbers, only 3, 7 and 11 are of the form 4k+3, thus the mask with which to obtain the corresponding bits from "11111" is "001011" (11 in binary), thus a(31) = 11.
		

Crossrefs

Differs from related A292592 for the first time at n=31, where a(31) = 11, while A292592(31) = 10. Compare also the scatter plots.

Programs

  • Mathematica
    f[n_] := Reverse@ Map[Ceiling[(Length@ # - 1)/2] &, DeleteCases[Split@ Join[Riffle[IntegerDigits[n, 2], 0], {0}], {k__} /; k == 1]]; Map[FromDigits[Reverse@ NestWhileList[Function[k, Which[k == 1, 1, EvenQ@ k, k/2, True, Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ k]], #, # > 1 &] /. k_ /; IntegerQ@ k :> If[Mod[k, 4] == 3, 1, 0], 2] &, {1}~Join~Table[Function[t, Prime[t] Product[Prime[m]^(f[n][[m]]), {m, t}]][DigitCount[n, 2, 1]], {n, 120}]] (* Michael De Vlieger, Sep 22 2017 *)

Formula

a(n) = A292383(A163511(n)).
a(n) + A292271(n) = n, a(n) AND A292271(n) = 0.
a(n) AND n = a(n), where AND is bitwise-AND (A004198).

Extensions

Comments and examples from Antti Karttunen, Sep 22 2017

A332817 a(n) = A108548(A163511(n)).

Original entry on oeis.org

1, 2, 4, 3, 8, 9, 6, 5, 16, 27, 18, 25, 12, 15, 10, 7, 32, 81, 54, 125, 36, 75, 50, 49, 24, 45, 30, 35, 20, 21, 14, 13, 64, 243, 162, 625, 108, 375, 250, 343, 72, 225, 150, 245, 100, 147, 98, 169, 48, 135, 90, 175, 60, 105, 70, 91, 40, 63, 42, 65, 28, 39, 26, 11, 128, 729, 486, 3125, 324, 1875, 1250, 2401, 216, 1125, 750, 1715, 500
Offset: 0

Views

Author

Antti Karttunen, Mar 05 2020

Keywords

Comments

This irregular table can be represented as a binary tree. Each child to the left is obtained by doubling the parent, and each child to the right is obtained by applying A332818 to the parent:
1
|
...................2...................
4 3
8......../ \........9 6......../ \........5
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
16 27 18 25 12 15 10 7
32 81 54 125 36 75 50 49 24 45 30 35 20 21 14 13
etc.
This is the mirror image of the tree in A332815.

Crossrefs

Cf. A332811 (inverse permutation).
Cf. A054429, A108548, A163511, A332815 (mirror image).
Cf. A108546 (the right edge of the tree from 2 downward).
Cf. also A332214.

Programs

  • PARI
    up_to = 26927;
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ From A005940
    A054429(n) = ((3<<#binary(n\2))-n-1); \\ From A054429
    A163511(n) = if(!n,1,A005940(1+A054429(n)));
    A108546list(up_to) = { my(v=vector(up_to), p,q); v[1] = 2; v[2] = 3; v[3] = 5; for(n=4,up_to, p = v[n-2]; q = nextprime(1+p); while(q%4 != p%4, q=nextprime(1+q)); v[n] = q); (v); };
    v108546 = A108546list(up_to);
    A108546(n) = v108546[n]; \\ Antti Karttunen, Mar 05 2020
    A108548(n) = { my(f=factor(n)); f[,1] = apply(A108546,apply(primepi,f[,1])); factorback(f); };
    A332817(n) = A108548(A163511(n));

Formula

a(n) = A108548(A163511(n)).
For n >= 1, a(n) = A332815(A054429(n)).

A334204 a(n) = A329697(A163511(n)).

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 1, 1, 0, 3, 2, 2, 1, 2, 1, 2, 0, 4, 3, 3, 2, 3, 2, 4, 1, 3, 2, 3, 1, 3, 2, 2, 0, 5, 4, 4, 3, 4, 3, 6, 2, 4, 3, 5, 2, 5, 4, 4, 1, 4, 3, 4, 2, 4, 3, 4, 1, 4, 3, 3, 2, 3, 2, 2, 0, 6, 5, 5, 4, 5, 4, 8, 3, 5, 4, 7, 3, 7, 6, 6, 2, 5, 4, 6, 3, 6, 5, 6, 2, 6, 5, 5, 4, 5, 4, 4, 1, 5, 4, 5, 3, 5, 4, 6, 2, 5
Offset: 0

Views

Author

Antti Karttunen, Jun 09 2020

Keywords

Comments

As the underlying sequence A163511 can be represented as a binary tree, so can be this:
0
|
...................0...................
0 1
0......../ \........2 1......../ \........1
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
0 3 2 2 1 2 1 2
0 4 3 3 2 3 2 4 1 3 2 3 1 3 2 2
etc.
The nodes at the left edge are all zeros, and their right-hand children give positive integers, A000027.
Each left-hand leaning branch stays constant, because A329697(2n) = A329697(n).
The right-hand leaning branches are not necessarily monotonic. For example, a((2^6)-1) = 2 > 1 = a((2^7)-1), because A000040(7) = 17 is a Fermat prime (but A000040(6) = 13 is not), and therefore the latter is only one step away from a power of 2.

Crossrefs

Programs

Formula

a(n) = A329697(A163511(n)).
a(n) = A334109(A334860(n)).
a(n) = a(2n) = a(A000265(n)).
For all n >= 0, a(2^n) = 0, a(2^n + 1) = n.
Showing 1-10 of 201 results. Next