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.

Showing 1-3 of 3 results.

A013643 Numbers k such that the continued fraction for sqrt(k) has period 3.

Original entry on oeis.org

41, 130, 269, 370, 458, 697, 986, 1313, 1325, 1613, 1714, 2153, 2642, 2834, 3181, 3770, 4409, 4778, 4933, 5098, 5837, 5954, 6626, 7465, 7610, 8354, 9293, 10282, 10865, 11257, 11321, 12410, 13033, 13549, 14698, 14738, 15977, 17266, 17989
Offset: 1

Views

Author

N. J. A. Sloane, Clark Kimberling, and Walter Gilbert

Keywords

Comments

All numbers of the form (5n+1)^2 + 4n + 1 for n>0 are elements of this sequence. Numbers of the above form have the continued fraction expansion [5n+1,[2,2,10n+2]]. General square roots of integers with period 3 continued fraction expansions have expansions of the form [n,[2m,2m,2n]]. - David Terr, Jun 15 2004

References

  • Kenneth H. Rosen, Elementary Number Theory and Its Applications, Addison-Wesley, 1984, page 426 (but beware of errors in this reference!).

Crossrefs

Programs

  • Mathematica
    cfp3Q[n_]:=Module[{s=Sqrt[n]},If[IntegerQ[s],1,Length[ ContinuedFraction[ s][[2]]]==3]]; Select[Range[18000],cfp3Q] (* Harvey P. Dale, May 30 2019 *)

Formula

The general form of these numbers is d = d(m, n) = a^2 + 4mn + 1, where m and n are positive integers and a = a(m, n) = (4m^2 + 1)n + m, for which the continued fraction expansion of sqrt(d) is [a;[2m, 2m, 2a]]. - David Terr, Jul 20 2004

A344276 Number of halving and tripling steps to reach 3 in the '3x+3' problem, or -1 if 3 is never reached.

Original entry on oeis.org

2, 3, 0, 4, 9, 1, 4, 5, 7, 10, 10, 2, 18, 5, 5, 6, 21, 8, 8, 11, 16, 11, 11, 3, 11, 19, 19, 6, 19, 6, 6, 7, 14, 22, 22, 9, 22, 9, 9, 12, 9, 17, 17, 12, 17, 12, 12, 4, 25, 12, 12, 20, 113, 20, 20, 7, 20, 20, 20, 7, 108, 7, 7, 8, 28, 15, 15, 23, 15, 23, 23, 10
Offset: 1

Views

Author

Keywords

Comments

The '3x+3' problem is a slight variation of the Collatz problem. If n is even, divide it by 2, if n is odd, multiply by 3 and add 3. The number of steps to reach 3 are given, which may be the endpoint for all n (empirical observation).
From Jon E. Schoenfield, May 14 2021: (Start)
It seems that the average number of steps among the '3x+3' trajectories for n in 1..3m is close to the average number of steps in the '3x+1' trajectories for n in 1..m:
.
m (Sum_{n=1..m} a(n))/m (Sum_{n=1..3m} c(n))/3m
---- --------------------- -----------------------
10^1 6.7000000000 8.6666666667
10^2 31.4200000000 32.1466666667
10^3 59.5420000000 58.9020000000
10^4 84.9666000000 84.6180333333
10^5 107.5384000000 107.6915966667
where c(n) = A006577(n) is the number of steps in the '3x+1' trajectory of n.
Perhaps a good way to explain this result is that, other than the values connected by the string of consecutive divide-by-2 steps at the beginning of the trajectory of an even number not divisible by 3, every value in every '3x+3' trajectory is a multiple of 3, so within any given interval, there are only about 1/3 as many values available for inclusion in '3x+3' trajectories as there are in '3x+1' trajectories. (End)

Examples

			a(1) = 2, with the trajectory 1 -> 6 -> 3.
a(5) = 9, with the trajectory 5 -> 18 -> 9 -> 30 -> 15 -> 48 -> 24 -> 12 -> 6 -> 3.
		

Crossrefs

Cf. A067896 (trajectory of 41).
Cf. A006577 (3x+1 steps).

Programs

  • Maple
    a:= proc(n) a(n):= 1+a(`if`(n::odd, 3*n+3, n/2)) end: a(3):=0:
    seq(a(n), n=1..100);  # Alois P. Heinz, May 14 2021
  • Mathematica
    If[#!=3,#0@If[OddQ@#,3#+3,#/2]+1,0]&/@Range@100 (* Giorgos Kalogeropoulos, May 14 2021 *)
  • PARI
    a(n) = for (k=0, oo, if (n==3, return (k), n%2==0, n=n/2, n=3*n+3)) \\ Rémy Sigrist, Jun 13 2021

Formula

a(3) = 0; for all other n > 0, if n is even, a(n) = a(n/2) + 1; if n is odd, a(n) = a(3n+3) + 1.

A082656 Trajectory of 39 under map x -> x/2 if x even, 3x+9 if x odd.

Original entry on oeis.org

39, 126, 63, 198, 99, 306, 153, 468, 234, 117, 360, 180, 90, 45, 144, 72, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9, 36, 18, 9
Offset: 1

Views

Author

Ernst Berg, May 17 2003

Keywords

Crossrefs

Cf. A067896.

Extensions

More terms from Jinyuan Wang, Apr 07 2020
Showing 1-3 of 3 results.