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 11-20 of 23 results. Next

A296073 Filter combining A296071(n) and A296072(n), related to the deficiencies of proper divisors of n.

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 2, 5, 6, 7, 2, 8, 2, 9, 10, 11, 2, 12, 2, 13, 14, 15, 2, 16, 17, 18, 19, 20, 2, 21, 2, 22, 23, 24, 25, 26, 2, 27, 28, 29, 2, 30, 2, 31, 32, 33, 2, 34, 35, 36, 37, 38, 2, 39, 40, 41, 42, 43, 2, 44, 2, 45, 46, 47, 48, 49, 2, 50, 51, 52, 2, 53, 2, 54, 55, 56, 57, 58, 2, 59, 60, 61, 2, 62, 63, 64, 65, 66, 2, 67, 68, 69, 70, 71, 72, 73, 2, 74, 75, 76, 2, 77, 2, 78, 79, 80, 2, 81, 2, 82, 83, 84, 2, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 33
Offset: 1

Views

Author

Antti Karttunen, Dec 04 2017

Keywords

Comments

Construction: Pack the values of A296071(n) and A296072(n) to a single value with any injective N x N -> N packing function, like for example as f(n) = (1/2)*(2 + ((A296071(n)+A296072(n))^2) - A296071(n) - 3*A296072(n)) (the packing function here is the two-argument form of A000027). Then apply the restricted growth sequence transform to the sequence f(1), f(2), f(3), ... The transform assigns a unique increasing number for each newly encountered term of the sequence, and for any subsequent occurrences of the same term it gives the same number that term obtained for the first time.
For all i, j: a(i) = a(j) => A296074(i) = A296074(j).
Note that this is NOT restricted growth transform of A239968, which is A305800. Apart from 2's that occur at every prime, there are other duplicates also, first at a(125) = a(46) = 33.

Examples

			To see that a(46) and a(125) have the same value (33), consider the proper divisors of 46 = 1, 2, 23 and of 125 = 1, 5, 25. Their deficiencies are 1, 1, 22 and 1, 4, 19 respectively. When we look at their balanced ternary representations [as here all elements are positive, it can be obtained as A007089(A117967(n)) with 2's standing for -1's]:
   1 =    1
   1 =    1
  22 = 1211 (as 22 = 1*(3^3) + -1*(3^2) + 1*(3^1) + 1*(3^0))
and
   1 =    1
   4 =   11
  19 = 1201 (as 19 = 1*(3^3) + -1*(3^2) + 0*(3^1) + 1*(3^0)).
we see that in each column there is an equal number of 1's and an equal number of 2's. Moreover, this then implies also that the sums of those two sequences of deficiencies {1, 1, 22} and {1, 4, 19} are equal, as A296074(n) is a function of (can be computed from) a(n).
		

Crossrefs

Cf. also A293226.
Differs from A305800 for the first time at n=125.

Programs

  • PARI
    up_to = 65536;
    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; };
    write_to_bfile(start_offset,vec,bfilename) = { for(n=1, length(vec), write(bfilename, (n+start_offset)-1, " ", vec[n])); }
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from M. F. Hasler
    A117967(n) = if(n<=1,n,if(!(n%3),3*A117967(n/3),if(1==(n%3),1+3*A117967((n-1)/3),2+3*A117967((n+1)/3))));
    A117968(n) = if(1==n,2,if(!(n%3),3*A117968(n/3),if(1==(n%3),2+3*A117968((n-1)/3),1+3*A117968((n+1)/3))));
    A289813(n) = { my (d=digits(n, 3)); from digits(vector(#d, i, if (d[i]==1, 1, 0)), 2); } \\ From Rémy Sigrist
    A289814(n) = { my (d=digits(n, 3)); from digits(vector(#d, i, if (d[i]==2, 1, 0)), 2); } \\ From Rémy Sigrist
    A295882(n) = { my(x = (2*n)-sigma(n)); if(x >= 0,A117967(x),A117968(-x)); };
    A296071(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289813(A295882(d))))); m; };
    A296072(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289814(A295882(d))))); m; };
    Anotsubmitted3(n) = (1/2)*(2 + ((A296071(n)+A296072(n))^2) - A296071(n) - 3*A296072(n));
    write_to_bfile(1,rgs_transform(vector(up_to,n,Anotsubmitted3(n))),"b296073.txt");

Extensions

Data section extended up to a(125) by Antti Karttunen, Jun 14 2018

A246208 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 2*a(-(A117966(n))), otherwise a(n) = 1 + 2*a(A117966(n)-1).

Original entry on oeis.org

0, 1, 2, 5, 11, 3, 10, 4, 22, 45, 91, 9, 19, 39, 183, 7, 21, 23, 90, 44, 182, 20, 6, 8, 38, 18, 78, 157, 315, 37, 75, 151, 631, 17, 77, 13, 27, 55, 155, 311, 623, 111, 1263, 35, 303, 47, 181, 43, 365, 41, 89, 367, 15, 79, 314, 156, 630, 76, 16, 36, 150, 74, 302, 180, 46, 88, 14, 366, 42, 40, 364, 12, 54, 26, 110, 34
Offset: 0

Views

Author

Antti Karttunen, Aug 19 2014

Keywords

Comments

This is an instance of entanglement permutation, where complementary pair A117968/A117967 (negative and positive part of inverse of balanced ternary enumeration of integers, respectively) is entangled with complementary pair A005843/A005408 (even and odd numbers respectively), with a(0) set to 0 and a(1) set to 1.
Thus this shares with A140264 the property that apart from a(0) = 0, even numbers occur only in positions given by A117968, and odd numbers only in positions given by A117967.

Crossrefs

Inverse: A246207.
Related permutations: A140264, A054429, A246210, A246211.

Programs

  • Python
    def a117966(n):
        if n==0: return 0
        if n%3==0: return 3*a117966(n//3)
        elif n%3==1: return 3*a117966((n - 1)//3) + 1
        else: return 3*a117966((n - 2)//3) - 1
    def a(n):
        if n<2: return n
        x=a117966(n)
        if x<1: return 2*a(-x)
        else: return 1 + 2*a(x - 1)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017

Formula

a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 2*a(-(A117966(n))), otherwise a(n) = 1 + 2*a(A117966(n)-1).
As a composition of related permutations:
a(n) = A054429(A246210(n)).
a(n) = A246210(A246211(n)).

A323909 Balanced ternary representation of A004718, Per Nørgård's "infinity sequence".

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Feb 10 2019

Keywords

Comments

The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.

Crossrefs

Cf. A004718, A083866 (positions of zeros), A117966, A117967, A117968, A323907 (rgs-transform), A323908.

Programs

Formula

If A004718(n) >= 0, then a(n) = A117967(A004718(n)), otherwise a(n) = A117968(-A004718(n)).
For all n >= 1, A117966(a(n)) = A004718(n).

A246210 Permutation of nonnegative integers: a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 1 + 2*a(-(A117966(n))), otherwise a(n) = 2*a(A117966(n)-1).

Original entry on oeis.org

0, 1, 3, 6, 12, 2, 13, 7, 25, 50, 100, 14, 28, 56, 200, 4, 26, 24, 101, 51, 201, 27, 5, 15, 57, 29, 113, 226, 452, 58, 116, 232, 904, 30, 114, 10, 20, 40, 228, 456, 912, 80, 1808, 60, 464, 48, 202, 52, 402, 54, 102, 400, 8, 112, 453, 227, 905, 115, 31, 59, 233, 117, 465, 203, 49, 103, 9, 401, 53, 55, 403, 11, 41, 21, 81, 61
Offset: 0

Views

Author

Antti Karttunen, Aug 19 2014

Keywords

Comments

This is an instance of entanglement permutation, where complementary pair A117967/A117968 (positive and negative part of inverse of balanced ternary enumeration of integers, respectively) is entangled with complementary pair A005843/A005408 (even and odd numbers respectively), with a(0) set to 0 and a(1) set to 1.
This implies that apart from a(1) = 1, even numbers occur only in positions given by A117967, and odd numbers only in positions given by A117968.

Crossrefs

Inverse: A246209.
Similar or related permutations: A054429, A246208, A246211.

Programs

  • Python
    def a117966(n):
        if n==0: return 0
        if n%3==0: return 3*a117966(n//3)
        elif n%3==1: return 3*a117966((n - 1)//3) + 1
        else: return 3*a117966((n - 2)//3) - 1
    def a(n):
        if n<2: return n
        x=a117966(n)
        if x<1: return 1 + 2*a(-x)
        else: return 2*a(x - 1)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017

Formula

a(0) = 0, a(1) = 1, and for n > 1, if A117966(n) < 1, a(n) = 1 + 2*a(-(A117966(n))), otherwise a(n) = 2*a(A117966(n)-1).
As a composition of related permutations:
a(n) = A054429(A246208(n)).
a(n) = A246208(A246211(n)).

A257869 Nonnegative integers with an equal number of occurrences of all trits in balanced ternary representation.

Original entry on oeis.org

6, 8, 136, 138, 144, 154, 156, 160, 164, 168, 170, 180, 186, 188, 208, 210, 214, 218, 222, 224, 232, 236, 248, 258, 260, 266, 288, 294, 296, 312, 314, 320, 3406, 3412, 3414, 3430, 3432, 3438, 3484, 3486, 3492, 3510, 3568, 3574, 3576, 3592, 3594, 3600, 3622
Offset: 1

Views

Author

Alois P. Heinz, May 11 2015

Keywords

Examples

			6 = 1L0_bal3, 8 = 10L_bal3, 136 = 1LL001_bal3, 138 = 1LL010_bal3, 144 = 1LL100_bal3, where L represents (-1).
		

Crossrefs

Subsequence of A174658.

Programs

  • Maple
    p:= proc(n) local d, m, r; m:=n; r:=0;
          while m>0 do
            d:= irem(m, 3, 'm');
            if d=2 then m:=m+1 fi;
            r:= r+x^d
          od;
          simplify(r/(1+x+x^2))::integer
        end:
    a:= proc(n) option remember; local k;
          for k from 1+`if`(n=1, 0, a(n-1)) by 1
          while not p(k) do od; k
        end:
    seq(a(n), n=1..70);
  • Python
    def a(n):
        s=[]
        x=0
        while n>0:
            x=n%3
            n//=3
            if x==2:
                x=-1
                n+=1
            s.append(x)
        return s
    print([n for n in range(1, 5001) if a(n).count(1)==a(n).count(-1) and a(n).count(-1)==a(n).count(0)]) # Indranil Ghosh, Jun 07 2017

A140265 Permutation of natural numbers: a(n) = A140263(n-1)+1.

Original entry on oeis.org

1, 2, 3, 6, 8, 4, 7, 5, 9, 18, 23, 16, 22, 17, 24, 12, 20, 10, 19, 11, 21, 15, 26, 13, 25, 14, 27, 54, 68, 52, 67, 53, 69, 48, 65, 46, 64, 47, 66, 51, 71, 49, 70, 50, 72, 36, 59, 34, 58, 35, 60, 30, 56, 28, 55, 29, 57, 33, 62, 31, 61, 32, 63, 45, 77, 43, 76, 44, 78, 39, 74, 37
Offset: 1

Views

Author

Antti Karttunen, May 19 2008

Keywords

Crossrefs

Inverse: A140266.

Programs

  • Python
    from sympy import ceiling
    from sympy.ntheory.factor_ import digits
    def a004488(n): return int("".join([str((3 - i)%3) for i in digits(n, 3)[1:]]), 3)
    def a117968(n):
        if n==1: return 2
        if n%3==0: return 3*a117968(n/3)
        elif n%3==1: return 3*a117968((n - 1)/3) + 2
        else: return 3*a117968((n + 1)/3) + 1
    def a117967(n): return 0 if n==0 else a117968(-n) if n<0 else a004488(a117968(n))
    def a001057(n): return -(-1)**n*ceiling(n/2)
    def a(n): return a117967(a001057(n - 1)) + 1 # Indranil Ghosh, Jun 07 2017
  • Scheme
    (define (A140265 n) (+ 1 (A140263 (- n 1))))
    

A257867 Nonnegative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared.

Original entry on oeis.org

314, 942, 2824, 2826, 2854, 3074, 3130, 3212, 8066, 8090, 8096, 8170, 8224, 8324, 8426, 8450, 8472, 8478, 8480, 8512, 8534, 8562, 8578, 8588, 8656, 9222, 9224, 9390, 9404, 9636, 9638, 24198, 24206, 24270, 24288, 24510, 24670, 24672, 24674, 24676, 24802, 24972
Offset: 1

Views

Author

Alois P. Heinz, May 11 2015

Keywords

Examples

			942 is in the sequence because 942 = 110L0L0_bal3 and 942^2 = 887364 = 1LL0001L1L0100_bal3, where L represents (-1).
		

Crossrefs

Programs

  • Maple
    p:= proc(n) local d, m, r; m:=n; r:=0;
          while m>0 do
            d:= irem(m,3,'m');
            if d=2 then m:=m+1 fi;
            r:=r+x^d
          od; r
        end:
    a:= proc(n) option remember; local k;
          for k from 1+`if`(n=1, 0, a(n-1))
          while p(k)*2<>p(k^2) do od; k
        end:
    seq(a(n), n=1..50);
  • Python
    def a(n):
        s=[]
        x=0
        while n>0:
            x=n%3
            n//=3
            if x==2:
                x=-1
                n+=1
            s.append(x)
        return s
    print([n for n in range(1, 25001) if a(n**2).count(-1)==2*a(n).count(-1) and a(n**2).count(1)==2*a(n).count(1) and a(n**2).count(0)==2*a(n).count(0)]) # Indranil Ghosh, Jun 07 2017

A296071 a(n) = Product_{d|n, dA019565(A289813(A295882(d))); a product obtained from the 1's present in balanced ternary representation of the deficiencies of the proper divisors of n.

Original entry on oeis.org

1, 2, 2, 4, 2, 12, 2, 8, 6, 24, 2, 24, 2, 20, 36, 16, 2, 60, 2, 144, 30, 40, 2, 48, 12, 60, 30, 240, 2, 1080, 2, 32, 60, 56, 60, 120, 2, 28, 90, 576, 2, 3600, 2, 400, 900, 168, 2, 96, 10, 1008, 84, 1200, 2, 420, 120, 480, 42, 56, 2, 4320, 2, 84, 1500, 64, 180, 4200, 2, 784, 252, 90720, 2, 1200, 2, 140, 2520, 784, 100, 75600, 2, 1152, 210, 840, 2
Offset: 1

Views

Author

Antti Karttunen, Dec 04 2017

Keywords

Comments

Used as a part of filter A296073.

Crossrefs

Programs

  • PARI
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from M. F. Hasler
    A117967(n) = if(n<=1,n,if(!(n%3),3*A117967(n/3),if(1==(n%3),1+3*A117967((n-1)/3),2+3*A117967((n+1)/3))));
    A117968(n) = if(1==n,2,if(!(n%3),3*A117968(n/3),if(1==(n%3),2+3*A117968((n-1)/3),1+3*A117968((n+1)/3))));
    A289813(n) = { my (d=digits(n, 3)); from digits(vector(#d, i, if (d[i]==1, 1, 0)), 2); } \\ From Rémy Sigrist
    A295882(n) = { my(x = (2*n)-sigma(n)); if(x >= 0,A117967(x),A117968(-x)); };
    A296071(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289813(A295882(d))))); m; };
    
  • Scheme
    (define (A296071 n) (let loop ((m 1) (props (proper-divisors n))) (cond ((null? props) m) (else (loop (* m (A019565 (A289813 (A295882 (car props))))) (cdr props))))))
    (define (proper-divisors n) (reverse (cdr (reverse (divisors n)))))
    (define (divisors n) (let loop ((k n) (divs (list))) (cond ((zero? k) divs) ((zero? (modulo n k)) (loop (- k 1) (cons k divs))) (else (loop (- k 1) divs)))))

Formula

a(n) = Product_{d|n, dA019565(A289813(A295882(d))).

A296072 a(n) = Product_{d|n, dA019565(A289814(A295882(d))); a product obtained from the -1's present in balanced ternary representation of the deficiencies of the proper divisors of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 2, 1, 1, 12, 1, 2, 6, 1, 1, 12, 1, 1, 12, 3, 1, 12, 1, 1, 2, 15, 3, 216, 1, 5, 2, 6, 1, 6, 1, 2, 36, 5, 1, 180, 3, 10, 30, 1, 1, 1080, 1, 3, 10, 1, 1, 3240, 1, 1, 36, 1, 1, 20, 1, 450, 10, 30, 1, 45360, 1, 1, 30, 75, 3, 10, 1, 60, 360, 1, 1, 540, 15, 105, 2, 2, 1, 3240, 3, 50, 2, 35, 5, 2520, 1, 630, 60, 90, 1, 900
Offset: 1

Views

Author

Antti Karttunen, Dec 04 2017

Keywords

Comments

Used as a part of filter A296073.

Crossrefs

Programs

  • PARI
    A019565(n) = {my(j,v); factorback(Mat(vector(if(n, #n=vecextract(binary(n), "-1..1")), j, [prime(j), n[j]])~))}; \\ This function from M. F. Hasler
    A117967(n) = if(n<=1,n,if(!(n%3),3*A117967(n/3),if(1==(n%3),1+3*A117967((n-1)/3),2+3*A117967((n+1)/3))));
    A117968(n) = if(1==n,2,if(!(n%3),3*A117968(n/3),if(1==(n%3),2+3*A117968((n-1)/3),1+3*A117968((n+1)/3))));
    A289814(n) = { my (d=digits(n, 3)); from digits(vector(#d, i, if (d[i]==2, 1, 0)), 2); } \\ From Rémy Sigrist
    A295882(n) = { my(x = (2*n)-sigma(n)); if(x >= 0,A117967(x),A117968(-x)); };
    A296072(n) = { my(m=1); fordiv(n,d,if(d < n,m *= A019565(A289814(A295882(d))))); m; };
    
  • Scheme
    (define (A296072 n) (let loop ((m 1) (props (proper-divisors n))) (cond ((null? props) m) (else (loop (* m (A019565 (A289814 (A295882 (car props))))) (cdr props))))))
    (define (proper-divisors n) (reverse (cdr (reverse (divisors n)))))
    (define (divisors n) (let loop ((k n) (divs (list))) (cond ((zero? k) divs) ((zero? (modulo n k)) (loop (- k 1) (cons k divs))) (else (loop (- k 1) divs)))))

Formula

a(n) = Product_{d|n, dA019565(A289814(A295882(d))).

A257868 Negative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared.

Original entry on oeis.org

-314, -898, -942, -2694, -2824, -2826, -2962, -3014, -3070, -3074, -8066, -8082, -8090, -8096, -8132, -8170, -8224, -8336, -8426, -8434, -8450, -8472, -8478, -8480, -8618, -8656, -8870, -8886, -8918, -9008, -9042, -9210, -9222, -9224, -24198, -24226, -24246
Offset: 1

Views

Author

Alois P. Heinz, May 11 2015

Keywords

Examples

			-898 is in the sequence because -898 = LL10L1L_bal3 and (-898)^2 = 806404 = 1LLLL00L1LLL11_bal3, where L represents (-1).
		

Crossrefs

Programs

  • Maple
    p:= proc(n) local d, m, r; m:=abs(n); r:=0;
          while m>0 do
            d:= irem(m, 3, 'm');
            if d=2 then m:=m+1 fi;
            r:=r+x^`if`(n>0, d, irem(3-d, 3))
          od; r
        end:
    a:= proc(n) option remember; local k;
          for k from -1+`if`(n=1, 0, a(n-1)) by -1
          while p(k)*2<>p(k^2) do od; k
        end:
    seq(a(n), n=1..50);
  • Python
    def a(n):
        s=[]
        l=[]
        x=0
        while n>0:
            x=n%3
            n//=3
            if x==2:
                x=-1
                n+=1
            s.append(x)
            l.append(-x)
        return [s, l]
    print([-n for n in range(1, 25001) if a(n**2)[0].count(-1)==2*a(n)[1].count(-1) and a(n**2)[0].count(1)==2*a(n)[1].count(1) and a(n**2)[0].count(0)==2*a(n)[1].count(0)]) # Indranil Ghosh, Jun 07 2017
Previous Showing 11-20 of 23 results. Next