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.

A243071 Permutation of nonnegative integers: a(1) = 0, a(2) = 1, a(2n) = 2*a(n), a(2n+1) = 1 + 2*a(A064989(2n+1)).

Original entry on oeis.org

0, 1, 3, 2, 7, 6, 15, 4, 5, 14, 31, 12, 63, 30, 13, 8, 127, 10, 255, 28, 29, 62, 511, 24, 11, 126, 9, 60, 1023, 26, 2047, 16, 61, 254, 27, 20, 4095, 510, 125, 56, 8191, 58, 16383, 124, 25, 1022, 32767, 48, 23, 22, 253, 252, 65535, 18, 59, 120, 509, 2046, 131071
Offset: 1

Views

Author

Antti Karttunen, Jun 20 2014

Keywords

Comments

Note the indexing: the domain starts from 1, while the range includes also zero.
See also the comments at A163511, which is the inverse permutation to this one.

Crossrefs

Inverse: A163511.
Cf. A000040, A000225, A007814, A054429, A064989, A064216, A122111, A209229, A245611 (= (a(2n-1)-1)/2, for n > 1), A245612, A292383, A292385, A297171 (Möbius transform).
Cf. A007283 (known positions where a(n)=n), A364256 [= gcd(n,a(n))], A364288 [= n-a(n)], A364289 [where a(n)>=n], A364290 [where a(n)A364291 [where a(n)<=n], A364497 [where n|a(n)].
Cf. A156552 (variant with inverted binary code), A253566, A332215, A332811, A334859 (other variants).

Programs

  • PARI
    A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};
    A243071(n) = if(n<=2, n-1, if(!(n%2), 2*A243071(n/2), 1+(2*A243071(A064989(n))))); \\ Antti Karttunen, Jul 18 2020
    
  • PARI
    A243071(n) = if(n<=2, n-1, my(f=factor(n), p, p2=1, res=0); for(i=1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p*p2*(2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); ((3<<#binary(res\2))-res-1)); \\ (Combining programs given in A156552 and A054429) - Antti Karttunen, Jul 28 2023
    
  • Python
    from functools import reduce
    from sympy import factorint, prevprime
    from operator import mul
    def a064989(n):
        f = factorint(n)
        return 1 if n==1 else reduce(mul, (1 if i==2 else prevprime(i)**f[i] for i in f))
    def a(n): return n - 1 if n<3 else 2*a(n//2) if n%2==0 else 1 + 2*a(a064989(n))
    print([a(n) for n in range(1, 101)]) # Indranil Ghosh, Jun 15 2017
  • Scheme
    ;; With memoizing definec-macro from Antti Karttunen's IntSeq-library.
    (definec (A243071 n) (cond ((<= n 2) (- n 1)) ((even? n) (* 2 (A243071 (/ n 2)))) (else (+ 1 (* 2 (A243071 (A064989 n)))))))
    

Formula

a(1) = 0, a(2) = 1, a(2n) = 2*a(n), a(2n+1) = 1 + 2*a(A064989(2n+1)).
For n >= 1, a(A000040(n)) = A000225(n).
For n >= 1, a(2n+1) = 1 + 2*a(A064216(n+1)).
From Antti Karttunen, Jul 18 2020: (Start)
a(n) = A245611(A048673(n)).
a(n) = A253566(A122111(n)).
a(n) = A334859(A225546(n)).
For n >= 2, a(n) = A054429(A156552(n)).
a(n) = A292383(n) + A292385(n) = A292383(n) OR A292385(n).
For n > 1, A007814(a(n)) = A007814(n) - A209229(n). [This map preserves the 2-adic valuation of n, except when n is a power of two, in which cases it is decremented by one.]
(End)

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)).

A332899 a(1) = 0, and for n > 2, a(n) = a(A332893(n)) + A000035(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 04 2020

Keywords

Comments

a(n) tells how many odd numbers are encountered when map x -> A332893(x) is used to traverse from n to 1, the root of the binary tree A332815. This count includes both the starting n itself if it is odd, but excludes 1 where the iteration ends.
a(n) also gives the index of the largest prime factor (A061395) in A332808(n), which is the inverse permutation of A108548 (see also A108546).

Crossrefs

Cf. A000079 (after its initial term, gives the positions of 1's).

Programs

Formula

a(1) = 0, and for n > 1, a(n) = a(A332893(n)) + A000035(n).
a(n) = A000120(A332811(n)).
a(n) = A061395(A332808(n)).
a(n) = A332897(n) + A332898(n).
a(n) <= A332894(n).
For all n > 1, a(n) = 1 + A080791(A332816(n)).
Showing 1-3 of 3 results.