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.

A064684 Number of primes in orbit of 2n+1 in the 3x+1 problem.

Original entry on oeis.org

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

Views

Author

Jon Perry, Oct 10 2001

Keywords

Examples

			orbit(3) = 3->10->5->16->8->4->2->1. This contains 3 primes, 3, 5 and 2. So a(1) = 3.
		

Programs

  • ARIBAS
    function orbit(n: integer): array; var stk: stack; begin stack_push(stk,n); while n <> 1 do if n mod 2 = 0 then n := n div 2; else n := 3*n + 1; end; stack_push(stk,n); end; return stack2array(stk); end; function primesfilter(ar: array): array; var j,k: integer; stk: stack; begin for j := 0 to length(ar) - 1 do k := prime32test(ar[j]); if k = 1 then stack_push(stk,ar[j]); end; end; return stack2array(stk); end; function a064684(maxarg: integer); var n: integer; begin for n := 1 to maxarg by 2 do write(length(primesfilter(orbit(n)))," "); end; end; a064684(190);

Extensions

More terms from Klaus Brockhaus, Oct 13 2001