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.

A036840 a(n) is the average of the repeating terms of {T(n,k)} rounded to the nearest integer (rounding up if there's a choice), if {T(n,k)} is eventually periodic; = 0 otherwise. Here T(n,k) is the "phi/sigma tug-of-war sequence with seed n" defined by T(n,1) = phi(n), T(n,2) = sigma(phi(n)), T(n,3) = phi(sigma(phi(n))), ..., T(n,k) = phi(T(n,k-1)) if k is odd and = sigma(T(n,k-1)) if k is even.

Original entry on oeis.org

1, 1, 3, 3, 7, 3, 7, 7, 7, 7, 7, 7, 20, 7, 12, 12, 39, 7, 39, 12, 20, 7, 20, 12, 20, 20, 39, 20, 39, 12, 39, 39, 20, 39, 39, 20, 154, 39, 39, 39, 39, 20, 154, 20, 39, 20, 39, 39, 154, 20, 154, 39, 154, 39, 39, 39, 154, 39, 39, 39, 100, 39, 154, 154, 100, 20, 100, 154, 39, 39
Offset: 1

Views

Author

Joseph L. Pe, Jan 09 2002

Keywords

Comments

Conjecture: a(n) is never 0; i.e. the sequence {T(n,k)} is eventually periodic for every n.
a(n) - n can be thought of as the final score in the phi/sigma tug-of-war with seed n. For example a(5) - 5 = 7 - 5 = 2, so sigma wins by "2 points" over phi at 5. a(8) - 8 = 7 - 8 = -1, so phi wins by "1 point" over sigma at 8. a(3) - 3 = 3 - 3 = 0, so it is a tie at 3. Are sigma's margins of victory over phi bounded? Are phi's bounded?

Examples

			The sequence {T(5,k)} is 4, 7, 6, 12, 4, 7, .... The average of the repeating numbers is 7.25 which rounds off to 7. So a(5) = 7. The sequence {T(37,k)} is 36, 91, 72, 195, 96, 252, 72, 195, .... The average of the repeating numbers is 153.75, which rounds off to 154. So a(37) = 154.
		

Crossrefs

Programs

  • Mathematica
    a[ n_ ] := Module[ {}, For[ m=n; seq={}, !MemberQ[ seq, m ], m=DivisorSigma[ 1, EulerPhi[ m ] ], AppendTo[ seq, m ] ]; rp=Drop[ seq, Position[ seq, m ][ [ 1, 1 ] ]-1 ]; Floor[ 1/2+(Plus@@Join[ rp, EulerPhi/@rp ])/2/Length[ rp ] ] ]
  • Scheme
    (define (A036840 n) (let loop ((visited (list n)) (i 1)) (let ((next ((if (odd? i) A000010 A000203) (car visited)))) (cond ((member next (reverse visited)) => (lambda (start_of_cyclic_part) (cond ((even? (length start_of_cyclic_part)) (floor->exact (+ 1/2 (/ (apply + start_of_cyclic_part) (length start_of_cyclic_part))))) (else (loop (cons next visited) (+ 1 i)))))) (else (loop (cons next visited) (+ 1 i))))))) ;; Antti Karttunen, Dec 06 2017

Extensions

Edited by Dean Hickerson, Jan 18 2002