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.

A282409 Numbers n for which the number of odd members and the number of even members in the Collatz (3x+1) trajectory are both prime.

Original entry on oeis.org

3, 9, 10, 12, 13, 22, 23, 40, 42, 73, 88, 90, 92, 93, 114, 115, 118, 119, 144, 148, 149, 152, 154, 162, 163, 164, 165, 166, 192, 208, 212, 213, 226, 227, 251, 295, 318, 319, 350, 351, 576, 592, 596, 597, 608, 616, 618, 625, 640, 642, 643, 648, 650, 652, 653
Offset: 1

Views

Author

Michel Lagneau, Feb 14 2017

Keywords

Comments

Or numbers m such that A078719(m) and A006666(m) are both prime.
The distinct pairs of primes in the order of appearance are: (3, 5), (7, 13), (2, 5), (3, 7), (5, 11), (2, 7), (43, 73), (5, 13), (11, 23), (7, 17), (41, 71), (3, 11), (23, 43), (19, 37),...

Examples

			13 is in the sequence because its Collatz trajectory is 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 which contains 3 odd members and 7 even members.
		

Crossrefs

Programs

  • Maple
    nn:=10^6:
    for n from 1 to 500 do:
      m:=n:i1:=1:i2:=0:
       for i from 1 to nn while(m<>1) do:
        if irem(m,2)=0
         then
         m:=m/2:i2:=i2+1:
         else
         m:=3*m+1:i1:=i1+1:
        fi:
       od:
         if isprime(i1) and isprime(i2)
         then
         printf(`%d, `,n):
         else
        fi:od:
  • PARI
    is(n)=my(e,o=1); while(n>1, n=if(n%2, o++; 3*n+1, e++; n/2)); isprime(e) && isprime(o) \\ Charles R Greathouse IV, Feb 14 2017
    
  • Python
    from sympy import isprime
    def a(n):
        l=[n]
        while True:
            if n%2==0: n//=2
            else: n = 3*n + 1
            l.append(n)
            if n<2: break
        o=list(filter(lambda i: i%2==1, l))
        e=list(filter(lambda i: i%2==0, l))
        return [o, e]
    print([n for n in range(2, 1001) if isprime(len(a(n)[0])) and isprime(len(a(n)[1]))]) # Indranil Ghosh, Apr 14 2017