The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A081878 Triangle read by rows in which row n begins with n (n=1,2,3,...) and iterates the process of dividing n by 2 if n is even, adding 3 if n is an odd prime, otherwise adding 1; stopping when either 1 or 3 is reached. 2
 1, 2, 1, 3, 4, 2, 1, 5, 8, 4, 2, 1, 6, 3, 7, 10, 5, 8, 4, 2, 1, 8, 4, 2, 1, 9, 10, 5, 8, 4, 2, 1, 10, 5, 8, 4, 2, 1, 11, 14, 7, 10, 5, 8, 4, 2, 1, 12, 6, 3, 13, 16, 8, 4, 2, 1, 14, 7, 10, 5, 8, 4, 2, 1, 15, 16, 8, 4, 2, 1, 16, 8, 4, 2, 1, 17, 20, 10, 5, 8, 4, 2, 1, 18, 9, 10, 5, 8, 4, 2, 1, 19, 22, 11, 14 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,2 COMMENTS The number of steps to reach 1 or 3 is in A081879. The sequence is well-defined: iteration of f (the map defining the sequence) terminates either at 1 or 3 for all values of n>0. Proof: Assuming that all natural numbers < k converge, then if k is even it converges (as f(k)=k/2 < k) and if it is odd, then f(f(k)) is either (k+1)/2 or (k+3)/2 and these are less than k for all k>4. LINKS EXAMPLE Triangle begins: 1; 2,1; 3; 4,2,1; 5,8,4,2,1; 6,3; 7,10,5,8,4,2,1; ... PROG (PARI) xnprp3(n) = { for(x=1, n, p1 = x; print1(x" "); while(p1>1, if(p1%2==0, p1/=2, if(isprime(p1), p1+=3, p1 = p1+1; )); print1(p1" "); if(p1==3, break) ) ) } (MIT Scheme) (define (isprime? n) (cond ((< n 4) (> n 1)) (else (let loop ((i (floor->exact (/ n 2)))) (cond ((= 1 i) #t) ((zero? (modulo n i)) #f) (else (loop (-1+ i)))))))) (define (A081878 upto-n) (let outloop ((x 1) (a (list))) (cond ((> x upto-n) (reverse! a)) (else (let inloop ((a (cons x a))) (let ((n (car a))) (cond ((and (not (= 1 n)) (not (= 3 n))) (cond ((even? n) (inloop (cons (/ n 2) a))) ((isprime? n) (inloop (cons (+ n 3) a))) (else (inloop (cons (1+ n) a))))) (else (outloop (1+ x) a))))))))) CROSSREFS Cf. A081879. Sequence in context: A306805 A162598 A088208 * A088606 A140073 A333400 Adjacent sequences:  A081875 A081876 A081877 * A081879 A081880 A081881 KEYWORD easy,nonn,tabf AUTHOR Cino Hilliard, Apr 12 2003 EXTENSIONS Edited by Antti Karttunen and Jud McCranie, Jun 03 2003 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 21 14:38 EDT 2021. Contains 343154 sequences. (Running on oeis4.)