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.

User: Alessandro Polcini

Alessandro Polcini's wiki page.

Alessandro Polcini has authored 7 sequences.

A320028 a(n) is the first prime encountered when running the Collatz algorithm (halving and tripling steps) on the number n.

Original entry on oeis.org

2, 3, 2, 5, 3, 7, 2, 7, 5, 11, 3, 13, 7, 23, 2, 17, 7, 19, 5, 2, 11, 23, 3, 19, 13, 41, 7, 29, 23, 31, 2, 19, 17, 53, 7, 37, 19, 59, 5, 41, 2, 43, 11, 17, 23, 47, 3, 37, 19, 29, 13, 53, 41, 83, 7, 43, 29, 59, 23, 61, 31, 137, 2, 37, 19, 67, 17, 13, 53, 71, 7, 73, 37, 113, 19, 29, 59, 79, 5, 61, 41, 83, 2, 2, 43, 131
Offset: 2

Author

Alessandro Polcini, Oct 03 2018

Keywords

Comments

A modified version of the halving and tripling Collatz algorithm, which stops as soon as the starting number becomes a prime (instead of stopping when the starting number reaches 1).
The plot of this sequence "completes" or "fills" the lower (empty) part of plot of A270570 and evolves in a similar fashion.

Examples

			a(4) is 2 because 4/2 = 2 and 2 is prime.
a(6) is 3 because 6/2 = 3 and 3 is prime.
a(15) is 23 because 15*3 + 1 = 46; 46/2 = 23 and 23 is prime.
a(18) is 7 because 18/2 = 9; 9*3 + 1 = 28; 28/2 = 14; 14/2 = 7 and 7 is prime.
		

Crossrefs

Programs

  • Java
    int collatzPrime(int i) {
        while(!BigInteger.valueOf(i).isProbablePrime(10) && i > 1) {
            if(i % 2 == 0)
                i /= 2;
            else
                i = 3 * i + 1;
        }
        return i;
    }
    
  • Mathematica
    Array[NestWhile[If[EvenQ@ #, #/2, 3 # + 1] &, #, ! PrimeQ@ # &] &, 86, 2] (* Michael De Vlieger, Nov 07 2018 *)
  • PARI
    a(n) = {while (!isprime(n), if (n % 2, n = 3*n+1, n = n/2);); n;} \\ Michel Marcus, Oct 28 2018

Formula

a(n) <= A087272(n). - Rémy Sigrist, Oct 08 2018

A319936 Numbers with more than one Collatz tripling step whose odd Collatz trajectory does not contain primes.

Original entry on oeis.org

113, 227, 453, 906, 909, 1812, 1813, 1818, 2417, 3624, 3626, 3636, 3637, 7248, 7252, 7253, 7272, 7281, 9669, 14496, 14504, 14544, 14549, 14562, 14563, 19338, 28992, 29008, 29013, 29088, 29124, 29125, 30559, 38676, 38677, 38833, 38835, 45839, 54327, 57984
Offset: 1

Author

Alessandro Polcini, Oct 10 2018

Keywords

Comments

The starting number itself is not counted in the trajectory, otherwise prime numbers like 113 or 227 wouldn't appear in this sequence.
The "odd Collatz trajectory" of a number k is the subset of odd numbers of the full Collatz trajectory of k.

Examples

			113 is in this sequence because 113*3+1 = 340; 340/2 = 170; 170/2 = 85; 85*3+1 = 256, which goes to 1. The trajectory has 2 (> 1) tripling steps and 85 isn't a prime.
114 is not in this sequence because 114/2 = 57; 57*3+1 = 172; 172/2 = 86; 86/2 = 43, which is a prime, and this trajectory has more than 1 tripling step.
		

Crossrefs

Programs

A216189 Numbers n whose odd Collatz steps (except for 1) are all primes.

Original entry on oeis.org

3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 17, 19, 20, 21, 22, 24, 25, 26, 28, 29, 34, 35, 37, 38, 39, 40, 44, 45, 48, 49, 52, 53, 56, 58, 59, 67, 68, 69, 74, 76, 77, 80, 85, 87, 88, 89, 96, 99, 101, 104, 106, 112, 116, 117, 118, 119, 131, 134, 136, 141, 148, 149
Offset: 1

Author

Alessandro Polcini, Oct 10 2018

Keywords

Comments

Powers of 2 are not included as they don't have odd Collatz steps. The number n itself (if odd) is not counted as an odd step. [Corrected by Jianing Song, Dec 09 2018]

Examples

			7 is in this sequence because 7*3+1 = 22; 22/2 = [11]; 11*3+1 = 34; 34/2 = [17]; 17*3+1 = 52; 52/2 = 26; 26/2 = [13]; 13*3+1 = 40; 40/2 = 20; 20/2 = 10; 10/2 = [5]; 5*3+1 = 16; 16/2 = 8; 8/2 = 4; 4/2 = 2; 2/2 = 1. 11, 17, 13 and 5 are all primes.
15 is not in this sequence because 15*3+1 = 46; 46/2 = [23]; 23*3+1 = 70; 70/2 = 35, which isn't a prime number.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[3, 150], And[AllTrue[Select[Rest@ #2, OddQ], PrimeQ], !IntegerQ@ Log2@ #1] & @@ {#, NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, #, # > 2 &, 1, Infinity, -1]} &] (* Michael De Vlieger, Nov 07 2018 *)

A320020 Numbers whose Collatz trajectory always alternates between a halving and a tripling step until a power of 2 is reached.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 10, 16, 21, 32, 42, 64, 85, 128, 151, 170, 227, 256, 302, 341, 454, 512, 682, 1024, 1365, 2048, 2730, 4096, 5461, 8192, 10922, 14563, 16384, 21845, 29126, 32768, 43690, 65536, 87381, 131072, 174762, 262144, 349525, 524288, 699050, 932067
Offset: 1

Author

Alessandro Polcini, Oct 03 2018

Keywords

Comments

Any number whose Collatz trajectory has two or more consecutive halving steps (before reaching a power of 2) is not included in this sequence.
The b-file was generated using the reverse Collatz algorithm.
Instead of going: n -> 3n + 1 (if odd), n/2 (if even), this algorithm starts from a power of 2 and goes: n -> (n - 1)/3 (if possible) and n*2, repeating these two consecutive steps as long as the number n is divisible by 3. The results are progressively added to a dynamic array, which gets sorted by ascending order once the algorithm terminates.
Example 1: 8 -> (8 - 1) and the calculation stops because 7 isn't divisible by 3. No numbers are added to the dynamic array.
Example 2: 16 -> (16 - 1)/3 = 5; 5*2 = 10; (10 - 1)/3 = 3; 3*2 = 6; (6 - 1) and the calculation stops because 5 isn't divisible by 3. The numbers 5, 10, 3, 6 are then added to the dynamic array.
Example 3: 64 -> (64 - 1)/3 = 21; 21*2 = 42; (42 - 1) and the calculation stops because 41 isn't divisible by 3. The numbers 21 and 42 are then added to the dynamic array.

Examples

			6 is in the sequence because 6/2 = 3 (halving step); 3*3 + 1 = 10 (tripling step); 10/2 = 5 (halving step); 5*3 + 1 = 16 (tripling step) and a power of 2 is reached.
7 is not in this sequence because 7*3 + 1 = 22 (tripling step); 22/2 = 11 (halving step); 11*3 + 1 = 34 (tripling step); 34/2 = 17 (halving step); 17*3 + 1 = 52 (tripling step); 52/2 = 26 (halving step); 26/2 = 13 (another halving step).
		

Crossrefs

Cf. A006577.

Programs

  • Java
    for(BigInteger pow = TWO; pow.compareTo(END) < 0; pow = pow.multiply(TWO)) {
        terms.add(pow); //otherwise numbers like 8, 32, 128, etc. aren't added
        BigInteger newPow = pow.subtract(ONE);
        while(newPow.mod(THREE).compareTo(ZERO) == 0) {
            terms.add(newPow.add(ONE));
            newPow = newPow.divide(THREE);
            terms.add(newPow);
            newPow = newPow.add(newPow);
            terms.add(newPow);
            newPow = newPow.subtract(ONE);
        }
    }
    terms.sort(Comparator.naturalOrder()); //sorting by ascending order
    for(int i = 1; i < terms.size(); i++) {
        if(terms.get(i).compareTo(terms.get(i - 1)) == 0) {
            terms.remove(i); //to remove duplicates
        }
    }
  • PARI
    isp2(n) = (n==1) || (n==2) || (ispower(n,,&p) && (p==2));
    isok(n) = {while (! isp2(n), if (n % 2, newn = (3*n+1), newn = n/2); if (((n % 2) == (newn % 2)), return (0)); n = newn;); return (1);} \\ Michel Marcus, Oct 07 2018
    

A298509 First differences of A023108.

Original entry on oeis.org

99, 99, 99, 99, 97, 2, 97, 2, 89, 8, 91, 8, 509, 2, 88, 2, 88, 2, 88, 2, 88, 2, 88, 2, 50, 497, 2, 88, 2, 88, 2, 88, 2, 88, 2, 88, 2, 50, 497, 2, 88, 2, 88, 2, 88, 2, 88, 2, 88, 2
Offset: 1

Author

Alessandro Polcini, Jan 20 2018

Keywords

Comments

It appears that this sequence has a very regular pattern, as shown by the attached .png graphical visualization.

Crossrefs

Cf. A023108.

A282671 Twice composite numbers.

Original entry on oeis.org

8, 12, 16, 18, 20, 24, 28, 30, 32, 36, 40, 42, 44, 48, 50, 52, 54, 56, 60, 64, 66, 68, 70, 72, 76, 78, 80, 84, 88, 90, 92, 96, 98, 100, 102, 104, 108, 110, 112, 114, 116, 120, 124, 126, 128, 130, 132, 136, 138, 140, 144, 148, 150, 152, 154, 156, 160, 162, 164, 168, 170, 172, 174
Offset: 1

Author

Alessandro Polcini, Feb 20 2017

Keywords

Comments

Even numbers greater than 2 that do not appear in A001747.

Crossrefs

Programs

Formula

a(n) = 2*A002808(n). - R. J. Mathar, Feb 23 2017
a(n) = A139270(n+1). - R. J. Mathar, Feb 25 2017

A274489 a(n) = floor(sinh(n) / n^2).

Original entry on oeis.org

1, 0, 1, 1, 2, 5, 11, 23, 50, 110, 247, 565, 1308, 3067, 7264, 17355, 41790, 101327, 247205, 606456, 1495255, 3703422, 9210589, 22994029, 57603919, 144770421, 364916488, 922357821, 2337297441
Offset: 1

Author

Alessandro Polcini, Nov 10 2016

Keywords

Comments

This sequence has some elements in common with A018112 (-> elements 1, 2, 5, 11, 23, 50, 110).
The sum of the reciprocals of a(n) (for n>=2) converges to 2.870623225848376377857...

Programs

  • Mathematica
    Table[Floor[Sinh[n]/n^2],{n,30}] (* Harvey P. Dale, Nov 15 2018 *)
  • PARI
    a(n)=localprec(19); localprec((n-log(2))\log(10)+9); sinh(n)\n^2 \\ Charles R Greathouse IV, Nov 10 2016

Formula

a(n) = floor(sinh(n)/(n^2)), for n >= 1.