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-4 of 4 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)

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)

A364288 a(n) = n - A243071(n).

Original entry on oeis.org

1, 1, 0, 2, -2, 0, -8, 4, 4, -4, -20, 0, -50, -16, 2, 8, -110, 8, -236, -8, -8, -40, -488, 0, 14, -100, 18, -32, -994, 4, -2016, 16, -28, -220, 8, 16, -4058, -472, -86, -16, -8150, -16, -16340, -80, 20, -976, -32720, 0, 26, 28, -202, -200, -65482, 36, -4, -64, -452, -1988, -131012, 8, -262082, -4032, 6, 32, -58, -56
Offset: 1

Views

Author

Antti Karttunen, Jul 25 2023

Keywords

Crossrefs

Cf. A243071, A364256 [= gcd(n,a(n))], A364258.
Cf. A007283 (positions of 0's, conjectured), A364289 (positions of terms <= 0), A364290 (of terms > 0), A364291 (of terms >= 0).
Cf. also A364253.

Programs

  • Mathematica
    nn = 60; f[x_] := Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First[#], Last[#] ] &@ Transpose@ FactorInteger@ x; Do[a[n] = Which[n <= 2, n - 1, OddQ[n], 1 + 2 a[f[n]], True, 2 a[n/2] ], {n, nn}]; Array[# - a[#] &, nn] (* Michael De Vlieger, Jul 25 2023 *)
  • PARI
    A064989(n) = { my(f=factor(n>>valuation(n,2))); 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)))));
    A364288(n) = (n-A243071(n));

Formula

a(n) = A364258(A243071(n)).
For n >= 1, a(2*n) = 2*a(n).
For n >= 0, a(A007283(n)) = 0.

A364498 Odd numbers k such that k divides A243071(k).

Original entry on oeis.org

1, 3, 43, 1177, 3503, 49477, 169413, 428015, 4394113, 33228911
Offset: 1

Views

Author

Antti Karttunen, Jul 27 2023

Keywords

Comments

Primes p present are those that occur as factors of (2^A000720(p))-1: 3, 43, 49477, 4394113, 33228911, ...

Examples

			1177 = 11 * 107, with A243071(1177) = 536870895 = 3*5*11*47*107*647, therefore 1177 is present. Note that 536870895 = 11111111111111111111111101111 in binary, with four 1-bits at the least significant end, followed by 0, and then 24 more 1-bits at the most significant end, so A163511(536870895) = A000040(1+4) * A000040(4+24) = 11 * 107.
		

Crossrefs

Odd terms in A364497.

Programs

  • PARI
    A054429(n) = ((3<<#binary(n\2))-n-1); \\ From A054429
    A156552(n) = { 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]); res };
    A243071(n) = if(n<=2, n-1, A054429(A156552(n)));
    isA364498(n) = ((n%2)&&!(A243071(n)%n));

Extensions

a(10) from Chai Wah Wu, Jul 27 2023
Showing 1-4 of 4 results.