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

A038712 Let k be the exponent of highest power of 2 dividing n (A007814); a(n) = 2^(k+1)-1.

Original entry on oeis.org

1, 3, 1, 7, 1, 3, 1, 15, 1, 3, 1, 7, 1, 3, 1, 31, 1, 3, 1, 7, 1, 3, 1, 15, 1, 3, 1, 7, 1, 3, 1, 63, 1, 3, 1, 7, 1, 3, 1, 15, 1, 3, 1, 7, 1, 3, 1, 31, 1, 3, 1, 7, 1, 3, 1, 15, 1, 3, 1, 7, 1, 3, 1, 127, 1, 3, 1, 7, 1, 3, 1, 15, 1, 3, 1, 7, 1, 3, 1, 31, 1, 3, 1, 7, 1, 3, 1, 15, 1, 3, 1, 7, 1, 3, 1, 63, 1, 3
Offset: 1

Views

Author

Henry Bottomley, May 02 2000

Keywords

Comments

n XOR n-1, i.e., nim-sum of a pair of consecutive numbers.
Denominator of quotient sigma(2*n)/sigma(n). - Labos Elemer, Nov 04 2003
a(n) = the Towers of Hanoi disc moved at the n-th move, using standard moves with discs labeled (1, 3, 7, 15, ...) starting from top (smallest = 1). - Gary W. Adamson, Oct 26 2009
Equals row sums of triangle A168312. - Gary W. Adamson, Nov 22 2009
In the binary expansion of n, delete everything left of the rightmost 1 bit, and set all bits to the right of it. - Ralf Stephan, Aug 22 2013
Every finite sequence of positive integers summing to n may be termwise dominated by a subsequence of the first n values in this sequence [see Bannister et al., 2013]. - David Eppstein, Aug 31 2013
Sum of powers of 2 dividing n. - Omar E. Pol, Aug 18 2019
Given the binary expansion of (n-1) as {b[k-1], b[k-2], ..., b[2], b[1], b[0]}, then the binary expansion of a(n) is {bitand(b[k-1], b[k-2], ..., b[2], b[1], b[0]), bitand(b[k-2], ..., b[2], b[1], b[0]), ..., bitand(b[2], b[1], b[0]), bitand(b[1], b[0]), b[0], 1}. Recursively stated - 0th bit (L.S.B) of a(n), a(n)[0] = 1, a(n)[i] = bitand(a(n)[i-1], (n-1)[i-1]), where n[i] = i-th bit in the binary expansion of n. - Chinmaya Dash, Jun 27 2020

Examples

			a(6) = 3 because 110 XOR 101 = 11 base 2 = 3.
From _Omar E. Pol_, Aug 18 2019: (Start)
Illustration of initial terms:
a(n) is also the area of the n-th region of an infinite diagram of compositions (ordered partitions) of the positive integers, where the length of the n-th horizontal line segment is equal to A001511(n) and the length of the n-th vertical line segment is equal to A006519(n), as shown below (first eight regions):
-----------------------------
n    a(n)    Diagram
-----------------------------
.            _ _ _ _
1     1     |_| | | |
2     3     |_ _| | |
3     1     |_|   | |
4     7     |_ _ _| |
5     1     |_| |   |
6     3     |_ _|   |
7     1     |_|     |
8    15     |_ _ _ _|
.
The above diagram represents the eight compositions of 4: [1,1,1,1],[2,1,1],[1,2,1],[3,1],[1,1,2],[2,2],[1,3],[4].
(End)
		

Crossrefs

A038713 translated from binary, diagonals of A003987 on either side of main diagonal.
Cf. A062383. Partial sums give A080277.
Bisection of A089312. Cf. A088837.
a(n)-1 is exponent of 2 in A089893(n).
Cf. A130093.
This is Guy Steele's sequence GS(6, 2) (see A135416).
Cf. A001620, A168312, A220466, A361019 (Dirichlet inverse).

Programs

  • C
    int a(int n) { return n ^ (n-1); } // Russ Cox, May 15 2007
    
  • Haskell
    import Data.Bits (xor)
    a038712 n = n `xor` (n - 1) :: Integer  -- Reinhard Zumkeller, Apr 23 2012
    
  • Maple
    nmax:=98: for p from 0 to ceil(simplify(log[2](nmax))) do for n from 1 to ceil(nmax/(p+2)) do a((2*n-1)*2^p) := 2^(p+1)-1 od: od: seq(a(n), n=1..nmax); # Johannes W. Meijer, Feb 01 2013
    # second Maple program:
    a:= n-> Bits[Xor](n, n-1):
    seq(a(n), n=1..98);  # Alois P. Heinz, Feb 02 2023
  • Mathematica
    Table[Denominator[DivisorSigma[1, 2*n]/DivisorSigma[1, n]], {n, 1, 128}]
    Table[BitXor[(n + 1), n], {n, 0, 100}] (* Vladimir Joseph Stephan Orlovsky, Jul 19 2011 *)
  • PARI
    vector(66,n,bitxor(n-1,n)) \\ Joerg Arndt, Sep 01 2013; corrected by Michel Marcus, Aug 02 2018
    
  • PARI
    A038712(n) = ((1<<(1+valuation(n,2)))-1); \\ Antti Karttunen, Nov 24 2024
    
  • Python
    def A038712(n): return n^(n-1) # Chai Wah Wu, Jul 05 2022

Formula

a(n) = A110654(n-1) XOR A008619(n). - Reinhard Zumkeller, Feb 05 2007
a(n) = 2^A001511(n) - 1 = 2*A006519(n) - 1 = 2^(A007814(n)+1) - 1.
Multiplicative with a(2^e) = 2^(e+1)-1, a(p^e) = 1, p > 2. - Vladeta Jovovic, Nov 06 2001; corrected by Jianing Song, Aug 03 2018
Sum_{n>0} a(n)*x^n/(1+x^n) = Sum_{n>0} x^n/(1-x^n). Inverse Moebius transform of A048298. - Vladeta Jovovic, Jan 02 2003
From Ralf Stephan, Jun 15 2003: (Start)
G.f.: Sum_{k>=0} 2^k*x^2^k/(1 - x^2^k).
a(2*n+1) = 1, a(2*n) = 2*a(n)+1. (End)
Equals A130093 * [1, 2, 3, ...]. - Gary W. Adamson, May 13 2007
Sum_{i=1..n} (-1)^A000120(n-i)*a(i) = (-1)^(A000120(n)-1)*n. - Vladimir Shevelev, Mar 17 2009
Dirichlet g.f.: zeta(s)/(1 - 2^(1-s)). - R. J. Mathar, Mar 10 2011
a(n) = A086799(2*n) - 2*n. - Reinhard Zumkeller, Aug 07 2011
a((2*n-1)*2^p) = 2^(p+1)-1, p >= 0. - Johannes W. Meijer, Feb 01 2013
a(n) = A000225(A001511(n)). - Omar E. Pol, Aug 31 2013
a(n) = A000203(n)/A000593(n). - Ivan N. Ianakiev and Omar E. Pol, Dec 14 2017
L.g.f.: -log(Product_{k>=0} (1 - x^(2^k))) = Sum_{n>=1} a(n)*x^n/n. - Ilya Gutkovskiy, Mar 15 2018
a(n) = 2^(1 + (A183063(n)/A001227(n))) - 1. - Omar E. Pol, Nov 06 2018
a(n) = sigma(n)/(sigma(2*n) - 2*sigma(n)) = 3*sigma(n)/(sigma(4*n) - 4*sigma(n)) = 7*sigma(n)/(sigma(8*n) - 8*sigma(n)), where sigma(n) = A000203(n). - Peter Bala, Jun 10 2022
Sum_{k=1..n} a(k) ~ n*log_2(n) + (1/2 + (gamma - 1)/log(2))*n, where gamma is Euler's constant (A001620). - Amiram Eldar, Nov 24 2022
a(n) = Sum_{d divides n} m(d)*phi(d), where m(n) = Sum_{d divides n} (-1)^(d+1)* mobius(d). - Peter Bala, Jan 23 2024

Extensions

Definition corrected by N. J. A. Sloane, Sep 07 2015 at the suggestion of Marc LeBrun
Name corrected by Wolfdieter Lang, Aug 30 2016

A295664 Exponent of the highest power of 2 dividing number of divisors of n: a(n) = A007814(A000005(n)); 2-adic valuation of tau(n).

Original entry on oeis.org

0, 1, 1, 0, 1, 2, 1, 2, 0, 2, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 2, 2, 1, 3, 0, 2, 2, 1, 1, 3, 1, 1, 2, 2, 2, 0, 1, 2, 2, 3, 1, 3, 1, 1, 1, 2, 1, 1, 0, 1, 2, 1, 1, 3, 2, 3, 2, 2, 1, 2, 1, 2, 1, 0, 2, 3, 1, 1, 2, 3, 1, 2, 1, 2, 1, 1, 2, 3, 1, 1, 0, 2, 1, 2, 2, 2, 2, 3, 1, 2, 2, 1, 2, 2, 2, 2, 1, 1, 1, 0, 1, 3, 1, 3, 3, 2, 1, 2, 1, 3, 2, 1, 1, 3, 2, 1, 1, 2, 2, 4, 0
Offset: 1

Views

Author

Antti Karttunen, Nov 28 2017

Keywords

Comments

In the prime factorization of n = p1^e1 * ... pk^ek, add together the number of trailing 1-bits in each exponent e when they are written in binary.

Crossrefs

Cf. A000290 (positions of zeros).

Programs

  • Mathematica
    Table[IntegerExponent[DivisorSigma[0, n], 2], {n, 120}] (* Michael De Vlieger, Nov 28 2017 *)
  • PARI
    a(n) = valuation(numdiv(n), 2); \\ Michel Marcus, Nov 30 2017
    
  • Python
    from sympy import divisor_count
    def A295664(n): return (~(m:=int(divisor_count(n))) & m-1).bit_length() # Chai Wah Wu, Jul 05 2022

Formula

Additive with a(p^e) = A007814(1+e).
a(1) = 0; for n > 1, a(n) = A007814(1+A067029(n)) + a(A028234(n)).
a(n) = A007814(A000005(n)).
a(n) >= A162642(n) >= A056169(n).
Sum_{k=1..n} a(k) ~ n * (log(log(n)) + B + C), where B is Mertens's constant (A077761) and C = Sum_{p prime} f(1/p) =-0.223720656976344505701..., where f(x) = -x + (1-x) * Sum_{k>=1} x^(2^k-1)/(1-x^(2^k)). - Amiram Eldar, Sep 28 2023

A322026 Lexicographically earliest infinite sequence such that a(i) = a(j) => A007814(i) = A007814(j) and A007949(i) = A007949(j), for all i, j, where A007814 and A007949 give the 2- and 3-adic valuations of n.

Original entry on oeis.org

1, 2, 3, 4, 1, 5, 1, 6, 7, 2, 1, 8, 1, 2, 3, 9, 1, 10, 1, 4, 3, 2, 1, 11, 1, 2, 12, 4, 1, 5, 1, 13, 3, 2, 1, 14, 1, 2, 3, 6, 1, 5, 1, 4, 7, 2, 1, 15, 1, 2, 3, 4, 1, 16, 1, 6, 3, 2, 1, 8, 1, 2, 7, 17, 1, 5, 1, 4, 3, 2, 1, 18, 1, 2, 3, 4, 1, 5, 1, 9, 19, 2, 1, 8, 1, 2, 3, 6, 1, 10, 1, 4, 3, 2, 1, 20, 1, 2, 7, 4, 1, 5, 1, 6, 3
Offset: 1

Views

Author

Antti Karttunen, Dec 03 2018

Keywords

Comments

Restricted growth sequence transform of the ordered pair [A007814(n), A007949(n)].
For all i, j:
A305900(i) = A305900(j) => a(i) = a(j),
a(i) = a(j) => A122841(i) = A122841(j),
a(i) = a(j) => A244417(i) = A244417(j),
a(i) = a(j) => A322316(i) = A322316(j) => A072078(i) = A072078(j).
If and only if a(k) > a(i) for all k > i then k is in A003586, - David A. Corneth, Dec 03 2018
That is, A003586 gives the positions of records (1, 2, 3, 4, 5, ...) in this sequence.
Sequence A126760 (without its initial zero) and this sequence are ordinal transforms of each other.

Crossrefs

Cf. A003586 (positions of records, the first occurrence of n), A007814, A007949, A065331, A071521, A072078, A087465, A122841, A126760 (ordinal transform), A322316, A323883, A323884.
Cf. also A247714 and A255975.

Programs

  • PARI
    up_to = 65537;
    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; };
    A007814(n) = valuation(n,2);
    A007949(n) = valuation(n,3);
    v322026 = rgs_transform(vector(up_to, n, [A007814(n), A007949(n)]));
    A322026(n) = v322026[n];
    
  • PARI
    A065331(n) = (3^valuation(n, 3)<A065331
    A071521(n) = { my(t=1/3); sum(k=0, logint(n, 3), t*=3; logint(n\t, 2)+1); }; \\ From A071521.
    A322026(n) = A071521(A065331(n)); \\ Antti Karttunen, Sep 08 2024

Formula

For s = A003586(n), a(s) = n = a((6k+1)*s) = a((6k-1)*s), where s is the n-th 3-smooth number and k > 0. - David A. Corneth, Dec 03 2018
A065331(n) = A003586(a(n)). - David A. Corneth, Dec 04 2018
From Antti Karttunen, Sep 08 2024: (Start)
a(n) = Sum{k=1..n} [A126760(k)==A126760(n)], where [ ] is the Iverson bracket.
a(n) = A071521(A065331(n)). [Found by Sequence Machine and also by LODA miner]
a(n) = A323884(25*n). [Conjectured by Sequence Machine]
(End)

A328461 a(n) = A276156(n) / A002110(A007814(n)).

Original entry on oeis.org

1, 1, 3, 1, 7, 4, 9, 1, 31, 16, 33, 6, 37, 19, 39, 1, 211, 106, 213, 36, 217, 109, 219, 8, 241, 121, 243, 41, 247, 124, 249, 1, 2311, 1156, 2313, 386, 2317, 1159, 2319, 78, 2341, 1171, 2343, 391, 2347, 1174, 2349, 12, 2521, 1261, 2523, 421, 2527, 1264, 2529, 85, 2551, 1276, 2553, 426, 2557, 1279, 2559, 1, 30031, 15016, 30033, 5006
Offset: 1

Views

Author

Antti Karttunen, Oct 16 2019

Keywords

Comments

A276156(n) converts the binary expansion of n to a number whose primorial base representation has the same digits of 0's and 1's, thus each one of its terms is a unique sum of distinct primorial numbers. In this sequence that sum is then divided by the largest primorial that divides it, which only depends on the position of the least significant 1-bit in the binary expansion of the original n, that is, the 2-adic valuation of n.

Crossrefs

Cf. A328462 (bisection, also row 1 of array A328464 which shows the same information in tabular form).

Programs

  • PARI
    A002110(n) = prod(i=1,n,prime(i));
    A276156(n) = { my(p=2,pr=1,s=0); while(n,if(n%2,s += pr); n >>= 1; pr *= p; p = nextprime(1+p)); (s); };
    A328461(n) = (A276156(n)/A002110(valuation(n,2)));

Formula

a(n) = A276156(n) / A002110(A007814(n)).
a(n) = A111701(A276156(n)).

A246676 Permutation of natural numbers: a(n) = A242378(A007814(n), (1+A000265(n))) - 1.

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 7, 6, 9, 14, 11, 24, 13, 26, 15, 10, 17, 20, 19, 34, 21, 44, 23, 48, 25, 32, 27, 124, 29, 80, 31, 12, 33, 74, 35, 54, 37, 62, 39, 76, 41, 38, 43, 174, 45, 134, 47, 120, 49, 50, 51, 64, 53, 98, 55, 342, 57, 104, 59, 624, 61, 242, 63, 16, 65, 56, 67, 244, 69, 224, 71, 90, 73, 68
Offset: 1

Views

Author

Antti Karttunen, Sep 01 2014

Keywords

Comments

To compute a(n) we shift its binary representation right as many steps k as necessary that the result were an odd number. Then one is added to that odd number, and the prime factorization of the resulting even number is shifted the same k number of steps towards larger primes, whose product is then decremented by one to get the final result.
In the essence, a(n) tells which number in array A246275 is at the same position where n is in the array A135764. As the topmost row in both arrays is A005408 (odd numbers), they are fixed, i.e. a(2n+1) = 2n+1 for all n.
Equally: a(n) tells which number in array A246273 is at the same position where n is in the array A054582, as they are the transposes of above two arrays.

Examples

			Consider n=36, "100100" in binary. It has to be shifted two bits right that the result were an odd number 9, "1001" in binary. We see that 9+1 = 10 = 2*5 = p_1 * p_3 [where p_k denotes the k-th prime, A000040(k)], and shifting this two steps towards larger primes results p_3 * p_5 = 5*11 = 55, thus a(36) = 55-1 = 54.
		

Crossrefs

Inverse: A246675.
Even bisection halved: A246680.
More recursed versions: A246678, A246684.
Other related permutations: A209268, A246273, A246275, A135764, A054582.

Programs

Formula

a(n) = A242378(A007814(n), (1+A000265(n))) - 1. [Where the bivariate function A242378(k,n) changes each prime p(i) in the prime factorization of n to p(i+k), i.e., it's the result of A003961 iterated k times starting from n].
As a composition of related permutations:
a(n) = A246273(A209268(n)).
Other identities:
For all n >= 0, a(A005408(n)) = A005408(n). [Fixes the odd numbers].

A305891 Filter sequence combining 2-adic valuation (A007814) and the prime signature (A046523) of n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jun 14 2018

Keywords

Comments

Restricted growth sequence transform of A286161, of the ordered pair [A007814(n), A046523(n)].
For all i, j: a(i) = a(j) => A291761(i) = A291761(j).

Crossrefs

Cf. also A305893.

Programs

  • PARI
    up_to = 65537;
    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; };
    A007814(n) = valuation(n,2);
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ From A046523
    Aux305891(n) = [A007814(n), A046523(n)];
    v305891 = rgs_transform(vector(up_to,n,Aux305891(n)));
    A305891(n) = v305891[n];

A135481 a(n) = 2^A007814(n+1) - 1.

Original entry on oeis.org

0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 31, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 63, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 15, 0, 1, 0, 3, 0, 1, 0, 7, 0, 1, 0, 3, 0, 1, 0, 31, 0, 1, 0, 3, 0, 1, 0
Offset: 0

Views

Author

N. J. A. Sloane, based on a message from Guy Steele and Don Knuth, Mar 01 2008

Keywords

Comments

This is Guy Steele's sequence GS(1, 6) (see A135416).

Crossrefs

Cf. A006519, A007814, A135416, A140670, A136013 (partial sums).

Programs

Formula

a(n) = A006519(n+1) - 1. - R. J. Mathar, Feb 10 2016

Extensions

a(0) = 0 prepended by Andrey Zabolotskiy, Oct 08 2019, based on Lothar Esser's contribution

A246684 "Caves of prime shift" permutation: a(1) = 1, a(n) = A242378(A007814(n), 2*a(A003602(n))) - 1.

Original entry on oeis.org

1, 2, 3, 4, 5, 8, 7, 6, 9, 14, 15, 24, 13, 26, 11, 10, 17, 20, 27, 34, 29, 80, 47, 48, 25, 32, 51, 124, 21, 44, 19, 12, 33, 74, 39, 54, 53, 98, 67, 76, 57, 104, 159, 624, 93, 404, 95, 120, 49, 50, 63, 64, 101, 152, 247, 342, 41, 38, 87, 174, 37, 62, 23, 16, 65, 56, 147, 244, 77, 188, 107, 90, 105, 374, 195, 324, 133, 170, 151, 142, 113, 92
Offset: 1

Views

Author

Antti Karttunen, Sep 06 2014

Keywords

Comments

See the comments in A246676. This is otherwise similar permutation, except that after having reached an odd number 2m-1 when we have shifted the binary representation of n right k steps, here, in contrary to A246676, we don't shift the primes in the prime factorization of the even number 2m, but instead of an even number (2*a(m)), shifting it the same number (k) of positions towards larger primes, whose product is then decremented by one to get the final result.
From Antti Karttunen, Jan 18 2015: (Start)
This can be viewed as an entanglement or encoding permutation where the complementary pairs of sequences to be interwoven together are even and odd numbers (A005843/A005408) which are entangled with another complementary pair: even numbers in the order they appear in A253885 and odd numbers in their usual order: (A253885/A005408).
From the above follows also that this sequence can be represented as a binary tree. Each child to the left is obtained by doubling the parent and subtracting one, and each child to the right is obtained by applying A253885 to the parent:
1
|
...................2...................
3 4
5......../ \........8 7......../ \........6
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
9 14 15 24 13 26 11 10
17 20 27 34 29 80 47 48 25 32 51 124 21 44 19 12
(End)

Examples

			Consider n=30, "11110" in binary. It has to be shifted just one bit-position right that the result were an odd number 15, "1111" in binary. As 15 = 2*8-1, we use 2*a(8) = 2*6 = 12 = 2*2*3 = p_1 * p_1 * p_2 [where p_k denotes the k-th prime, A000040(k)], which we shift one step towards larger primes resulting p_2 * p_2 * p_3 = 3*3*5 = 45, thus a(30) = 45-1 = 44.
		

Crossrefs

Inverse: A246683.
Other versions: A246676, A246678.
Similar or related permutations: A005940, A163511, A241909, A245606, A246278, A246375, A249814, A250243.
Differs from A249814 for the first time at n=14, where a(14) = 26, while A249814(14) = 20.

Programs

  • PARI
    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
    A246684(n) = { my(k=0); if(1==n, 1, while(!(n%2), n = n/2; k++); n = 2*A246684((n+1)/2); while(k>0, n = A003961(n); k--); n-1); };
    for(n=1, 8192, write("b246684.txt", n, " ", A246684(n)));
    (Scheme, with memoization-macro definec, two implementations)
    (definec (A246684 n) (cond ((<= n 1) n) (else (+ -1 (A242378bi (A007814 n) (* 2 (A246684 (A003602 n)))))))) ;; Code for A242378bi given in A242378.
    (definec (A246684 n) (cond ((<= n 1) n) ((even? n) (A253885 (A246684 (/ n 2)))) (else (+ -1 (* 2 (A246684 (/ (+ n 1) 2)))))))

Formula

a(1) = 1, a(n) = A242378(A007814(n), 2*a(A003602(n))) - 1. [Where the bivariate function A242378(k,n) changes each prime p(i) in the prime factorization of n to p(i+k), i.e., it's the result of A003961 iterated k times starting from n].
a(1) = 1, a(2n) = A253885(a(n)), a(2n+1) = (2*a(n+1))-1. - Antti Karttunen, Jan 18 2015
As a composition of other permutations:
a(n) = A250243(A249814(n)).
Other identities. For all n >= 1, the following holds:
a(n) = (1+a((2*n)-1))/2. [The odd bisection from a(1) onward with one added and then halved gives the sequence back].
For all n >= 0, the following holds: a(A000051(n)) = A000051(n). [Numbers of the form 2^n + 1 are among the fixed points].

A265752 a(n) = A007814(A265399(n)).

Original entry on oeis.org

0, 1, 0, 2, 1, 1, 1, 3, 0, 2, 2, 2, 3, 2, 1, 4, 5, 1, 8, 3, 1, 3, 13, 3, 2, 4, 0, 3, 21, 2, 34, 5, 2, 6, 2, 2, 55, 9, 3, 4, 89, 2, 144, 4, 1, 14, 233, 4, 2, 3, 5, 5, 377, 1, 3, 4, 8, 22, 610, 3, 987, 35, 1, 6, 4, 3, 1597, 7, 13, 3, 2584, 3, 4181, 56, 2, 10, 3, 4, 6765, 5, 0, 90, 10946, 3, 6, 145, 21, 5, 17711
Offset: 1

Views

Author

Antti Karttunen, Dec 15 2015

Keywords

Comments

a(n) is the constant term of the reduction by x^2->x+1 of the polynomial encoded in the prime factorization of n. (Assuming here only polynomials with nonnegative integer coefficients, see e.g. A206296 for the details of the encoding).
Completely additive with a(prime(k)) = F(k-2), where F(k) denotes the k-th Fibonacci number, A000045(k) for k >= 0, or A039834(-k) for k <= 0. - Peter Munn, Apr 05 2021, incorporating comment by Antti Karttunen, Dec 15 2015

Crossrefs

Programs

Formula

a(n) = A007814(A265399(n)).
Other identities. For all n >= 1:
a(A000040(n+1)) = A000045(n-1). [Generalized by Peter Munn, Apr 05 2021]
a(A206296(n)) = A192232(n).
a(A265750(n)) = A192750(n).

A173732 a(n) = (A016957(n)/2^A007814(A016957(n)) - 1)/2, with A016957(n) = 6*n+4 and A007814(n) the 2-adic valuation of n.

Original entry on oeis.org

0, 2, 0, 5, 3, 8, 2, 11, 6, 14, 0, 17, 9, 20, 5, 23, 12, 26, 3, 29, 15, 32, 8, 35, 18, 38, 2, 41, 21, 44, 11, 47, 24, 50, 6, 53, 27, 56, 14, 59, 30, 62, 0, 65, 33, 68, 17, 71, 36, 74, 9, 77, 39, 80, 20, 83, 42, 86, 5, 89, 45, 92, 23, 95, 48, 98, 12, 101, 51, 104, 26, 107, 54, 110, 3
Offset: 0

Views

Author

Howard A. Landman, Feb 22 2010

Keywords

Comments

All positive integers eventually reach 1 in the Collatz problem iff all nonnegative integers eventually reach 0 with repeated application of this map, i.e., if for all n, the sequence n, a(n), a(a(n)), a(a(a(n))), ... eventually hits 0.
0 <= a(n) <= (3n+1)/2, with the upper bound being achieved for all odd n.
The positions of the zeros are given by A020988 = (2/3)*(4^n-1). This is because if n = (2/3)*(4^k-1), then m = 2n+1 = (1/3)*(4^(k+1)-1), and 3m+1 = 4^(k+1) is a power of 4. - Howard A. Landman, Mar 14 2010
Subsequence of A025480, a(n) = A025480(3n+1), i.e., A025480 = 0,[0],1,0,[2],1,3,[0],4,2,[5],1,6,[3],7,0,[8],4,9,[2],10,5,[11],1,12,[6],13,3,[14],... with elements of A173732 in brackets. - Paul Tarau, Mar 21 2010
A204418(a(n)) = 1. - Reinhard Zumkeller, Apr 29 2012
Original name: "A compression of the Collatz (or 3x+1) sequence considered as a map from odd numbers to odd numbers." - Michael De Vlieger, Oct 07 2019

Examples

			a(0) = 0 because 2n+1 = 1 (the first odd number), 3*1 + 1 = 4, dividing all powers of 2 out of 4 leaves 1, and (1-1)/2 = 0.
a(1) = 2 because 2n+1 = 3, 3*3 + 1 = 10, dividing all powers of 2 out of 10 leaves 5, and (5-1)/2 = 2.
		

Crossrefs

Programs

  • C
    #include  main() { int k,m,n; for (k = 0; ; k++) { n = 2*k + 1 ; m = 3*n + 1 ; while (!(m & 1)) { m >>= 1 ; } printf("%d,",((m - 1) >> 1)); } }
    
  • Haskell
    a173732 n = a173732_list !! n
    a173732_list = f $ tail a025480_list where f (x :  :  : xs) = x : f xs
    -- Reinhard Zumkeller, Apr 29 2012
    
  • Mathematica
    Array[(#/2^IntegerExponent[#, 2] - 1)/2 &[6 # + 4] &, 75, 0] (* Michael De Vlieger, Oct 06 2019 *)
  • PARI
    odd(n) = n >> valuation(n, 2);
    a(n) = (odd(6*n+4) - 1)/2; \\ Amiram Eldar, Aug 26 2024

Formula

From Amiram Eldar, Aug 26 2024: (Start)
a(n) = (A075677(n+1) - 1)/2.
Sum_{k=1..n} a(k) ~ n^2 / 2. (End)

Extensions

Name changed by Michael De Vlieger, Oct 07 2019
Showing 1-10 of 974 results. Next