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.

A066903 Primes in A006577.

Original entry on oeis.org

7, 2, 5, 3, 19, 17, 17, 7, 7, 23, 5, 13, 13, 109, 29, 11, 11, 11, 19, 19, 19, 19, 107, 107, 17, 17, 17, 17, 113, 113, 113, 7, 41, 41, 103, 103, 23, 23, 23, 23, 23, 23, 23, 67, 31, 31, 31, 31, 31, 31, 13, 13, 13, 13, 101, 101, 13, 13, 127, 83, 127, 47, 47, 109, 47, 109, 109
Offset: 1

Views

Author

K. B. Subramaniam (kb_subramaniambalu(AT)yahoo.com), Dec 20 2001

Keywords

Examples

			a(1) = 7 because the first prime in A006577 is A006577(3) = 7.
		

Crossrefs

Cf. A006577.

Programs

  • Maple
    N:= 1000; # to get the first N terms
    Collatz:= proc(n) option remember;
    if n::even then 1+Collatz(n/2)
    else 1+Collatz(3*n+1)
    fi
    end proc;
    Collatz(1):= 0;
    count:= 0;
    for i from 1 while count < N do
      x:= Collatz(i);
      if isprime(x) then count:= count+1; A[count]:= x fi;
    od:
    seq(A[i],i=1..N); # Robert Israel, Jun 01 2014
  • Mathematica
    M = 100;
    Collatz[n_] := Collatz[n] = If[EvenQ[n], 1+Collatz[n/2], 1+Collatz[3n+1]];
    Collatz[1] = 0;
    count = 0;
    For[i = 1, count < M, i++, x = Collatz[i]; If[PrimeQ[x], count = count+1; a[count] = x]];
    Array[a, M] (* Jean-François Alcover, Mar 26 2019, after Robert Israel *)

Extensions

More terms from Sascha Kurz, Mar 23 2002
Offset corrected by Robert Israel, Jun 01 2014