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

A322990 a(n) = A289272(floor(A289271(n)/2)).

Original entry on oeis.org

1, 1, 2, 3, 4, 2, 5, 7, 8, 3, 9, 6, 11, 4, 10, 13, 16, 5, 17, 12, 14, 7, 19, 18, 23, 8, 25, 15, 27, 6, 29, 31, 22, 9, 20, 21, 32, 11, 26, 28, 37, 10, 41, 24, 36, 13, 43, 34, 47, 16, 38, 33, 49, 17, 44, 35, 46, 19, 53, 30, 59, 23, 40, 61, 52, 14, 64, 39, 50, 12, 67, 56, 71, 25, 54, 48, 45, 18, 73, 68, 79, 27, 81, 42, 76, 29, 58, 63, 83, 15, 55, 51, 62, 31, 92
Offset: 1

Views

Author

Antti Karttunen, Jan 01 2019

Keywords

Comments

For all n > 1, in the binary tree illustrated in A289272, the node which contains (has value) n, its parent node has value a(n).
Each n occurs exactly twice in this sequence.

Crossrefs

Programs

  • PARI
    A289271(n) = { my(v=0,i=0,x=1); for(d=2,oo,if(n==1, return(v)); if(1==gcd(x,d)&&1==omega(d), if(!(n%d)&&1==gcd(d,n/d), v += 2^i; n /= d; x *= d); i++)); }; \\ After Rémy Sigrist's program for A289271.
    A289272(n) = { my(m=1, pp=1); while(n>0, pp++; while(!isprimepower(pp)||(gcd(pp,m)>1), pp++); if(n%2, m *= pp); n >>=1); (m); };
    A322990(n) = A289272(A289271(n)>>1);

Formula

a(n) = A289272(floor(A289271(n)/2)).

A322991 a(n) = A289272(2*A289271(n)).

Original entry on oeis.org

1, 3, 4, 5, 7, 12, 8, 9, 11, 15, 13, 20, 16, 21, 28, 17, 19, 24, 23, 35, 36, 33, 25, 44, 27, 39, 29, 40, 31, 60, 32, 37, 52, 48, 56, 45, 41, 51, 68, 63, 43, 84, 47, 55, 77, 57, 49, 76, 53, 69, 92, 65, 59, 75, 91, 72, 100, 87, 61, 140, 64, 93, 88, 67, 112, 132, 71, 80, 108, 105, 73, 99, 79, 96, 116, 85, 104, 156, 81, 119, 83, 111, 89
Offset: 1

Views

Author

Antti Karttunen, Jan 01 2019

Keywords

Crossrefs

Permutation of A042965 (apart from zero).
Cf. also A003963, A300841.

Programs

  • PARI
    A289271(n) = { my(v=0,i=0,x=1); for(d=2,oo,if(n==1, return(v)); if(1==gcd(x,d)&&1==omega(d), if(!(n%d)&&1==gcd(d,n/d), v += 2^i; n /= d; x *= d); i++)); }; \\ After Rémy Sigrist's program for A289271.
    A289272(n) = { my(m=1, pp=1); while(n>0, pp++; while(!isprimepower(pp)||(gcd(pp,m)>1), pp++); if(n%2, m *= pp); n >>=1); (m); };
    A322991(n) = A289272(2*A289271(n));

Formula

a(n) = A289272(2*A289271(n)).

A322992 a(n) = A289272(1+(2*A289271(n))).

Original entry on oeis.org

2, 6, 10, 14, 18, 30, 22, 26, 34, 42, 38, 70, 46, 66, 90, 50, 54, 78, 58, 126, 110, 102, 62, 130, 74, 114, 82, 154, 86, 210, 94, 98, 170, 138, 198, 182, 106, 150, 190, 234, 118, 330, 122, 238, 306, 174, 134, 230, 142, 186, 270, 266, 146, 222, 342, 286, 290, 246, 158, 630, 162, 258, 374, 166, 414, 390, 178, 322, 310, 462, 194, 442, 202
Offset: 1

Views

Author

Antti Karttunen, Jan 01 2019

Keywords

Crossrefs

Permutation of A016825.

Programs

  • PARI
    A322992(n) = A289272(1+(2*A289271(n)));
    A289271(n) = { my(v=0,i=0,x=1); for(d=2,oo,if(n==1, return(v)); if(1==gcd(x,d)&&1==omega(d), if(!(n%d)&&1==gcd(d,n/d), v += 2^i; n /= d; x *= d); i++)); }; \\ After Rémy Sigrist's program for A289271.
    A289272(n) = { my(m=1, pp=1); while(n>0, pp++; while(!isprimepower(pp)||(gcd(pp,m)>1), pp++); if(n%2, m *= pp); n >>=1); (m); };

Formula

a(n) = A289272(1+(2*A289271(n))).

A289271 A bijective binary representation of the prime factorization of a number, shown in decimal (see Comments for precise definition).

Original entry on oeis.org

0, 1, 2, 4, 8, 3, 16, 32, 64, 5, 128, 6, 256, 9, 10, 512, 1024, 17, 2048, 12, 18, 33, 4096, 34, 8192, 65, 16384, 20, 32768, 7, 65536, 131072, 66, 129, 24, 36, 262144, 257, 130, 40, 524288, 11, 1048576, 68, 72, 513, 2097152, 258, 4194304, 1025, 514, 132
Offset: 1

Views

Author

Rémy Sigrist, Jun 30 2017

Keywords

Comments

For n > 0, with prime factorization Product_{i=1..k} p_i ^ e_i (all p_i distinct and all e_i > 0):
- let S_n = A000961 \ { p_i ^ (e_i + j) with i=1..k and j > 0 },
- a(n) = Sum_{i=1..k} 2^#{ s in S_n with 1 < s < p_i ^ e_i }.
In an informal way, we encode the prime powers > 1 that are unitary divisors of n as 1's in binary, while discarding the 0's corresponding to their "proper" multiples.
a(A002110(n)) = 2^n-1 for any n >= 0.
a(A000961(n+1)) = 2^(n-1) for any n > 0.
A000120(a(n)) = A001221(n) for any n > 0 (each prime divisor p of n (alongside the p-adic valuation of n) is encoded as a single 1 bit in the base-2 representation of a(n)).
A000961(2+A007814(a(n))) = A034684(n) for any n > 1 (the least significant bit of a(n) encodes the smallest unitary divisor of n that is larger than 1).
This sequence establishes a bijection between the positive numbers and the nonnegative numbers; see A289272 for the inverse of this sequence.
The numbers 4, 36, 40 and 532 equal their image; are there other such numbers?
This sequence has connections with A034729 (which encodes the divisors of a number, and is not surjective) and A087207 (which encodes the prime divisors of a number, and is not injective).

Examples

			For n = 204 = 2^2 * 3 * 17:
- S_204 = A000961 \ { 2^3, 2^4, ..., 3^2, ... }
        = { 1, 2, 3, 4, 5, 7, 11, 13, 17, ... },
- a(204) = 2^#{ 2, 3 } + 2^#{ 2 } + 2^#{ 2, 3, 4, 5, 7, 11, 13 }
         = 2^2 + 2^1 + 2^7
         = 134.
See also the illustration of the first terms in Links section.
		

Crossrefs

Cf. also A156552, A052331 for similar constructions.

Programs

  • PARI
    See Links section.
    
  • PARI
    A289271(n) = { my(f = factor(n), pps = vecsort(vector(#f~, i, f[i, 1]^f[i, 2])), s=0, x=1, pp=1, k=-1); for(i=1,#f~, while(pp < pps[i], pp++; while(!isprimepower(pp)||(gcd(pp,x)>1), pp++); k++); s += 2^k; x *= pp); (s); }; \\ Antti Karttunen, Jan 01 2019

A289815 The first of a pair of coprime numbers whose factorizations depend on the ternary representation of n (see Comments for precise definition).

Original entry on oeis.org

1, 2, 1, 3, 6, 3, 1, 2, 1, 4, 10, 5, 12, 30, 15, 4, 10, 5, 1, 2, 1, 3, 6, 3, 1, 2, 1, 5, 14, 7, 15, 42, 21, 5, 14, 7, 20, 70, 35, 60, 210, 105, 20, 70, 35, 5, 14, 7, 15, 42, 21, 5, 14, 7, 1, 2, 1, 3, 6, 3, 1, 2, 1, 4, 10, 5, 12, 30, 15, 4, 10, 5, 1, 2, 1, 3, 6
Offset: 0

Views

Author

Rémy Sigrist, Jul 12 2017

Keywords

Comments

For n >= 0, with ternary representation Sum_{i=1..k} t_i * 3^e_i (all t_i in {1, 2} and all e_i distinct and in increasing order):
- let S(0) = A000961 \ { 1 },
- and S(i) = S(i-1) \ { p^(f + j), with p^f = the (e_i+1)-th term of S(i-1) and j > 0 } for any i=1..k,
- then a(n) = Product_{i=1..k such that t_i=1} "the (e_i+1)-th term of S(k)".
See A289816 for the second coprime number.
See A289838 for the product of this sequence with A289816.
By design, gcd(a(n), A289816(n)) = 1.
Also, the number of distinct prime factors of a(n) equals the number of ones in the ternary representation of n.
We also have a(n) = A289816(A004488(n)) for any n >= 0.
For each pair of coprime numbers, say x and y, there is a unique index, say n, such that a(n) = x and A289816(n) = y; in fact, n = A289905(x,y).
This sequence combines features of A289813 and A289272.
The scatterplot of the first terms of this sequence vs A289816 (both with logarithmic scaling) looks like a triangular cristal.
For any t > 0: we can adapt the algorithm used here and in A289816 in order to uniquely enumerate every tuple of t mutually coprime numbers (see Links section for corresponding program).

Examples

			For n=42:
- 42 = 2*3^1 + 1*3^2 + 1*3^3,
- S(0) = { 2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, ... },
- S(1) = S(0) \ { 3^(1+j) with j > 0 }
       = { 2, 3, 4, 5, 7, 8,    11, 13, 16, 17, 19, 23, 25,     29, ... },
- S(2) = S(1) \ { 2^(2+j) with j > 0 }
       = { 2, 3, 4, 5, 7,       11, 13,     17, 19, 23, 25,     29, ... },
- S(3) = S(2) \ { 5^(1+j) with j > 0 }
       = { 2, 3, 4, 5, 7,       11, 13,     17, 19, 23,         29, ... },
- a(42) = 4 * 5 = 20.
		

Crossrefs

Programs

  • PARI
    a(n) =
    {
        my (v=1, x=1);
        for (o=2, oo,
            if (n==0, return (v));
            if (gcd(x,o)==1 && omega(o)==1,
                if (n % 3,    x *= o);
                if (n % 3==1, v *= o);
                n \= 3;
            );
        );
    }
    
  • Python
    from sympy import gcd, primefactors
    def omega(n): return 0 if n==1 else len(primefactors(n))
    def a(n):
        v, x, o = 1, 1, 2
        while True:
            if n==0: return v
            if gcd(x, o)==1 and omega(o)==1:
                if n%3: x*=o
                if n%3==1:v*=o
                n //= 3
            o+=1
    print([a(n) for n in range(101)]) # Indranil Ghosh, Aug 02 2017

Formula

a(A005836(n)) = A289272(n-1) for any n > 0.
a(2 * A005836(n)) = 1 for any n > 0.

A289816 The second of a pair of coprime numbers whose factorizations depend on the ternary representation of n (See Comments for precise definition).

Original entry on oeis.org

1, 1, 2, 1, 1, 2, 3, 3, 6, 1, 1, 2, 1, 1, 2, 3, 3, 6, 4, 5, 10, 4, 5, 10, 12, 15, 30, 1, 1, 2, 1, 1, 2, 3, 3, 6, 1, 1, 2, 1, 1, 2, 3, 3, 6, 4, 5, 10, 4, 5, 10, 12, 15, 30, 5, 7, 14, 5, 7, 14, 15, 21, 42, 5, 7, 14, 5, 7, 14, 15, 21, 42, 20, 35, 70, 20, 35, 70
Offset: 0

Views

Author

Rémy Sigrist, Jul 12 2017

Keywords

Comments

For n >= 0, with ternary representation Sum_{i=1..k} t_i * 3^e_i (all t_i in {1, 2} and all e_i distinct and in increasing order):
- let S(0) = A000961 \ { 1 },
- and S(i) = S(i-1) \ { p^(f + j), with p^f = the (e_i+1)-th term of S(i-1) and j > 0 } for any i=1..k,
- then a(n) = Product_{i=1..k such that t_i=2} "the (e_i+1)-th term of S(k)".
See A289815 for the first coprime number and additional comments.
The number of distinct prime factors of a(n) equals the number of twos in the ternary representation of n.

Examples

			For n=42:
- 42 = 2*3^1 + 1*3^2 + 1*3^3,
- S(0) = { 2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19, 23, 25, 27, 29, ... },
- S(1) = S(0) \ { 3^(1+j) with j > 0 }
       = { 2, 3, 4, 5, 7, 8,    11, 13, 16, 17, 19, 23, 25,     29, ... },
- S(2) = S(1) \ { 2^(2+j) with j > 0 }
       = { 2, 3, 4, 5, 7,       11, 13,     17, 19, 23, 25,     29, ... },
- S(3) = S(2) \ { 5^(1+j) with j > 0 }
       = { 2, 3, 4, 5, 7,       11, 13,     17, 19, 23,         29, ... },
- a(42) = 3.
		

Crossrefs

Programs

  • PARI
    a(n) = my (v=1, x=1);                   \
           for (o=2, oo,                           \
               if (n==0, return (v));              \
               if (gcd(x,o)==1 && omega(o)==1,     \
                   if (n % 3,    x *= o);          \
                   if (n % 3==2, v *= o);          \
                   n \= 3;                         \
               );                                  \
           );
    
  • Python
    from sympy import gcd, primefactors
    def omega(n): return 0 if n==1 else len(primefactors(n))
    def a(n):
        v, x, o = 1, 1, 2
        while True:
            if n==0: return v
            if gcd(x, o)==1 and omega(o)==1:
                if n%3: x*=o
                if n%3==2:v*=o
                n //= 3
            o+=1
    print([a(n) for n in range(101)]) # Indranil Ghosh, Aug 02 2017

Formula

a(n) = A289815(A004488(n)) for any n >= 0.
a(A005836(n)) = 1 for any n > 0.
a(2 * A005836(n)) = A289272(n-1) for any n > 0.

A322988 Lexicographically earliest such sequence a that a(i) = a(j) => f(i) = f(j) for all i, j, where f(1) = 0 if n is a prime power > 2, f(2) = -1, and f(n) = A322990(n) for all other numbers.

Original entry on oeis.org

1, 2, 3, 3, 3, 4, 3, 3, 3, 5, 3, 6, 3, 7, 8, 3, 3, 9, 3, 10, 11, 12, 3, 13, 3, 14, 3, 15, 3, 6, 3, 3, 16, 17, 18, 19, 3, 20, 21, 22, 3, 8, 3, 23, 24, 25, 3, 26, 3, 27, 28, 29, 3, 30, 31, 32, 33, 34, 3, 35, 3, 36, 37, 3, 38, 11, 3, 39, 40, 10, 3, 41, 3, 42, 43, 44, 45, 13, 3, 46, 3, 47, 3, 48, 49, 50, 51, 52, 3, 15, 53, 54, 55, 56, 57, 58, 3, 59, 60, 61, 3, 16, 3
Offset: 1

Views

Author

Antti Karttunen, Jan 02 2019

Keywords

Comments

For all i, j: a(i) = a(j) => A322989(i) = A322989(j).
For all i, j > 2: A305976(i) = A305976(j) => a(i) = a(j).

Crossrefs

Cf. A322805, A322822 for analogous constructions for filter sequences.

Programs

  • PARI
    up_to = 8192;
    rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
    A289271(n) = { my(v=0,i=0,x=1); for(d=2,oo,if(n==1, return(v)); if(1==gcd(x,d)&&1==omega(d), if(!(n%d)&&1==gcd(d,n/d), v += 2^i; n /= d; x *= d); i++)); }; \\ After Rémy Sigrist's program for A289271.
    A289272(n) = { my(m=1, pp=1); while(n>0, pp++; while(!isprimepower(pp)||(gcd(pp,m)>1), pp++); if(n%2, m *= pp); n >>=1); (m); }; \\ Antti Karttunen, Jan 02 2019
    A322990(n) = A289272(A289271(n)>>1);
    A322988aux(n) = if(2==n,-1,if(isprimepower(n),0,A322990(n)));
    v322988 = rgs_transform(vector(up_to,n,A322988aux(n)));
    A322988(n) = v322988[n];

A322989 If n is a power of a prime, then a(n) = 0, otherwise a(n) = 1 + a(A322990(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 01 2019

Keywords

Comments

For n > 1, a(n) gives the number of edges needed from n to the leftmost branch (where the terms of A000961 are located) in the binary tree illustrated in A289272.

Crossrefs

Programs

  • PARI
    A289271(n) = { my(v=0,i=0,x=1); for(d=2,oo,if(n==1, return(v)); if(1==gcd(x,d)&&1==omega(d), if(!(n%d)&&1==gcd(d,n/d), v += 2^i; n /= d; x *= d); i++)); }; \\ After Rémy Sigrist's program for A289271.
    A289272(n) = { my(m=1, pp=1); while(n>0, pp++; while(!isprimepower(pp)||(gcd(pp,m)>1), pp++); if(n%2, m *= pp); n >>=1); (m); };
    A322989(n) = if((1==n)||isprimepower(n),0,1+A322989(A322990(n)));
    A322990(n) = A289272(A289271(n)>>1);

Formula

If A001221(n) <= 1 [when n is in A000961], then a(n) = 0, otherwise a(n) = 1 + a(A322990(n)).
Showing 1-8 of 8 results.