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

A341515 The Collatz or 3x+1 map (A006370) conjugated by unary-binary-encoding (A156552).

Original entry on oeis.org

1, 5, 2, 15, 3, 11, 5, 45, 4, 125, 7, 33, 11, 245, 6, 135, 13, 77, 17, 375, 10, 605, 19, 99, 9, 845, 8, 735, 23, 17, 29, 405, 14, 1445, 15, 231, 31, 1805, 22, 1125, 37, 1331, 41, 1815, 12, 2645, 43, 297, 25, 275, 26, 2535, 47, 539, 21, 2205, 34, 4205, 53, 51, 59, 4805, 20, 1215, 33, 1859, 61, 4335, 38, 3125, 67, 693
Offset: 1

Views

Author

Antti Karttunen, Feb 14 2021

Keywords

Comments

Collatz-conjecture can be formulated via this sequence by postulating that all iterations of a(n), starting from any n > 1, will eventually reach the cycle [2, 5, 3].

Crossrefs

Cf. A005940, A006370, A064989, A156552, A329603, A341510, A347115 (Möbius transform),
Sequences related to iterations of this sequence: A352890, A352891, A352892, A352893, A352894, A352896, A352897, A352898, A352899.
Cf. A341516 (a variant).

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    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)};
    A156552(n) = { my(f = factor(n), 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 };
    A329603(n) = A005940(2+(3*A156552(n)));
    A341515(n) = if(n%2, A064989(n), A329603(n));

Formula

If n is odd, then a(n) = A064989(n), otherwise a(n) = A329603(n) = A341510(n,2*n).
a(n) = A005940(1+A006370(A156552(n))).

A352892 Next even term in the trajectory of map x -> A341515(x), when starting from x=n; a(1) = 1. Here A341515 is the Collatz or 3x+1 map (A006370) conjugated by unary-binary-encoding (A156552).

Original entry on oeis.org

1, 2, 2, 6, 2, 2, 2, 12, 4, 8, 2, 14, 2, 18, 6, 24, 2, 6, 2, 54, 10, 50, 2, 28, 4, 98, 8, 150, 2, 2, 2, 48, 14, 242, 6, 70, 2, 338, 22, 108, 2, 8, 2, 294, 12, 578, 2, 56, 4, 20, 26, 726, 2, 12, 10, 300, 34, 722, 2, 26, 2, 1058, 20, 96, 14, 18, 2, 1014, 38, 32, 2, 140, 2, 1682, 18, 1734, 6, 50, 2, 216, 16, 1922, 2, 686
Offset: 1

Views

Author

Antti Karttunen, Apr 08 2022

Keywords

Crossrefs

Coincides with A353268 on even n, and with A348717 on odd n.

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    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)};
    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 };
    A329603(n) = A005940(2+(3*A156552(n)));
    A341515(n) = if(n%2, A064989(n), A329603(n));
    A348717(n) = { my(f=factor(n)); if(#f~>0, my(pi1=primepi(f[1, 1])); for(k=1, #f~, f[k, 1] = prime(primepi(f[k, 1])-pi1+1))); factorback(f); }; \\ From A348717
    A352892(n) = A348717(A341515(n));
    
  • PARI
    A352892(n) = if(1==n, n, n = A341515(n); while(n%2, n = A341515(n)); (n)); \\ A slower alternative.

Formula

a(n) = A348717(A341515(n)).
For all n >= 1, a(2n) = A353268(2n), a(2n-1) = A348717(2n-1).
a(p) = 2 for all primes p.
For n > 1, a(n) = A005940(1+A139391(A156552(n))).

A352896 Maximum value of bigomega (A001222) computed for the terms x after the initial n, when map x -> A352892(x) is iterated starting from x=n down to the first x <= 2, or -1 if such number is never reached. Here A352892 is the next odd term in the Collatz or 3x+1 map (A139391) conjugated by unary-binary-encoding (A156552).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 08 2022

Keywords

Comments

Equally, maximum value of bigomega (A001222) computed for the terms x after the initial n, when map x -> A341515(x) is iterated starting from x=n.

Crossrefs

Programs

  • PARI
    A352896(n) = if(n<=2,n-1, my(m=0); while(n>2, n = A352892(n); m = max(m,bigomega(n))); (m)); \\ Needs also code from A352892.
    
  • PARI
    A352896(n) = if(n<=2,n-1,my(m=0); while(n>2, n = A341515(n); m = max(m,bigomega(n))); (m)); \\ Slower, but equivalent.
    
  • PARI
    \\ Faster:
    A139391(n) = my(x = if(n%2, 3*n+1, n/2)); x/2^valuation(x, 2); \\ From A139391
    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 };
    A352895(n) = { my(mw=1); while(n>1, n = A139391(n); mw = max(hammingweight(n),mw)); (mw); };
    A352896(n) = if(1==n,0,A352895(A156552(n)));

Formula

a(n) = A352897(A341515(n)) = A352897(A352892(n)).
For n > 1, a(n) = A352895(A156552(n)).

A352898 Lexicographically earliest infinite sequence such that a(i) = a(j) => f(i) = f(j), where f(n) = [A046523(n), A352892(n)], except f(n) = -n when <= 2.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Apr 08 2022

Keywords

Comments

For all i, j: A305801(i) = A305801(j) => a(i) = a(j) => A352897(i) = A352897(j).

Crossrefs

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; };
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); (t); };
    A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); };  \\ From A046523
    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)};
    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 };
    A329603(n) = A005940(2+(3*A156552(n)));
    A341515(n) = if(n%2, A064989(n), A329603(n));
    A348717(n) = { my(f=factor(n)); if(#f~>0, my(pi1=primepi(f[1, 1])); for(k=1, #f~, f[k, 1] = prime(primepi(f[k, 1])-pi1+1))); factorback(f); }; \\ From A348717
    A352892(n) = A348717(A341515(n));
    Aux352898(n) = if(n<=2,-n,[A046523(n),A352892(n)]);
    v352898 = rgs_transform(vector(up_to, n, Aux352898(n)));
    A352898(n) = v352898[n];

A333860 The maximum Hamming (binary) weight of the elements of the Collatz orbit of n, or -1 if 1 is never reached.

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 3, 1, 3, 2, 3, 2, 3, 3, 4, 1, 3, 3, 4, 2, 3, 3, 4, 2, 4, 3, 8, 3, 4, 4, 8, 1, 4, 3, 4, 3, 3, 4, 5, 2, 8, 3, 4, 3, 4, 4, 8, 2, 3, 4, 4, 3, 4, 8, 8, 3, 4, 4, 5, 4, 5, 8, 8, 1, 3, 4, 4, 3, 3, 4, 8, 3, 8, 3, 4, 4, 4, 5, 6, 2, 5, 8, 8, 3, 4, 4, 5
Offset: 1

Views

Author

Markus Sigg, Apr 08 2020

Keywords

Examples

			The Collatz orbit of 3 is 3,10,5,16,8,4,2,1. The Hamming weights are 2,2,2,1,1,1,1,1. The maximum is a(3) = 2.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Max[DigitCount[#, 2, 1] & /@ NestWhileList[If[OddQ[#], 3*# + 1, #/2] &, n, # > 1 &]]; Array[a, 100] (* Amiram Eldar, Jul 29 2023 *)
  • PARI
    a(n) = {
    my(c = hammingweight(n));
    while(n>1, n = if(n%2 == 0, n/2, 3*n+1); c = max(c, hammingweight(n)));
    c;
    }

Formula

a(n) = max(A000120(n), A352895(n)) = max(A000120(n), a(A006370(n))). - Antti Karttunen, Apr 10 2022

Extensions

Escape clause added to the definition by Antti Karttunen, Apr 10 2022
Showing 1-5 of 5 results.