login
A064684
Number of primes in orbit of 2n+1 in the 3x+1 problem.
3
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,2
EXAMPLE
orbit(3) = 3->10->5->16->8->4->2->1. This contains 3 primes, 3, 5 and 2.
PROG
(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).
CROSSREFS
Sequence in context: A196565 A104633 A102022 * A371944 A098071 A347741
KEYWORD
nonn,easy
AUTHOR
Jon Perry, Oct 10 2001
EXTENSIONS
More terms from Klaus Brockhaus, Oct 13 2001
STATUS
approved