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-9 of 9 results.

A353311 Number of distinct terms encountered when A353313 is iterated, or -1 if the iteration never reaches a finite cycle.

Original entry on oeis.org

1, 4, 104, 4, 4, 103, 105, 5, 104, 4, 103, 4, 5, 106, 4, 103, 6, 105, 106, 103, 3, 6, 108, 3, 105, 3, 104, 5, 3, 6, 104, 108, 110, 5, 103, 3, 6, 14, 116, 107, 3, 54, 5, 57, 3, 103, 7, 104, 6, 3, 6, 106, 9, 106, 107, 109, 12, 104, 7, 103, 3, 115, 5, 7, 13, 115, 109, 118, 21, 3, 53, 5, 106, 121, 56, 3, 59, 124, 105
Offset: 0

Views

Author

Antti Karttunen, Apr 13 2022

Keywords

Examples

			Starting from n=2 and iterating A353313, we obtain the following 104 terms [2, 5, 10, 19, 34, 59, 100, 169, 284, 475, 794, 1325, 2210, 3685, 6144, 2048, 3415, 5694, 1898, 3165, 1055, 1760, 2935, 4894, 8159, 13600, 22669, 37784, 62975, 104960, 174935, 291560, 485935, 809894, 1349825, 2249710, 3749519, 6249200, 10415335, 17358894, 5786298, 1928766, 642922, 1071539, 1785900, 595300, 992169, 330723, 110241, 36747, 12249, 4083, 1361, 2270, 3785, 6310, 10519, 17534, 29225, 48710, 81185, 135310, 225519, 75173, 125290, 208819, 348034, 580059, 193353, 64451, 107420, 179035, 298394, 497325, 165775, 276294, 92098, 153499, 255834, 85278, 28426, 47379, 15793, 26324, 43875, 14625, 4875, 1625, 2710, 4519, 7534, 12559, 20934, 6978, 2326, 3879, 1293, 431, 720, 240, 80, 135, 45, 15] before the iteration returns to 5 again, therefore a(2) = 104.
		

Crossrefs

Programs

  • PARI
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
    A353311(n) = { my(visited = Map()); for(j=0, oo, if(mapisdefined(visited, n), return(j), mapput(visited, n, j)); n = A353313(n)); };

Formula

a(n) = A353310(n) + A353312(n).
a(n) > A349877(n) for all n.

A353310 Number of terms encountered when iterating A353313, before reaching the first term that is a part of a finite cycle, or -1 if no finite cycle is ever reached.

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 2, 2, 1, 0, 0, 1, 1, 3, 1, 0, 0, 2, 3, 0, 0, 3, 5, 0, 2, 0, 1, 1, 0, 0, 1, 5, 7, 2, 0, 0, 2, 11, 13, 4, 0, 51, 2, 54, 0, 0, 4, 1, 0, 0, 0, 3, 3, 3, 4, 6, 6, 1, 4, 0, 0, 12, 2, 4, 10, 12, 6, 15, 15, 0, 50, 2, 3, 18, 53, 0, 56, 21, 2, 3, 0, 2, 5, 19, 0, 0, 62, 1, 59, 2, 2, 27, 65, 6, 5, 5, 8, 90, 8
Offset: 0

Views

Author

Antti Karttunen, Apr 14 2022

Keywords

Examples

			For n = 1, when iterating with A353313, we obtain 1 -> 4 -> 9 -> 3 -> 1 -> etc, thus 1 itself is included in the closed cycle, and therefore a(1) = 0.
For n = 6, when iterating with A353313, we obtain 6 -> 2 -> 5 -> ..., and after 103 more iterations we obtain 5 again (see examples in A353311 and A353312), thus only the two initial numbers, 6 and 2 are outside of the final closed cycle, therefore a(6) = 2.
		

Crossrefs

Programs

  • PARI
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
    A353310(n) = { my(visited = Map(), p); for(j=0, oo, if(mapisdefined(visited, n, &p), return(p), mapput(visited, n, j)); n = A353313(n)); };

Formula

a(n) = A353311(n) - A353312(n).

A353312 Size of the finite cycle eventually reached by iterating A353313, or -1 if no finite cycle is ever reached.

Original entry on oeis.org

1, 4, 103, 4, 4, 103, 103, 3, 103, 4, 103, 3, 4, 103, 3, 103, 6, 103, 103, 103, 3, 3, 103, 3, 103, 3, 103, 4, 3, 6, 103, 103, 103, 3, 103, 3, 4, 3, 103, 103, 3, 3, 3, 3, 3, 103, 3, 103, 6, 3, 6, 103, 6, 103, 103, 103, 6, 103, 3, 103, 3, 103, 3, 3, 3, 103, 103, 103, 6, 3, 3, 3, 103, 103, 3, 3, 3, 103, 103, 3, 103
Offset: 0

Views

Author

Antti Karttunen, Apr 13 2022

Keywords

Examples

			Starting from n=2 and iterating A353313, we obtain the following 104 terms [2, 5, 10, 19, 34, 59, 100, 169, 284, 475, 794, 1325, 2210, 3685, 6144, 2048, 3415, 5694, 1898, 3165, 1055, 1760, 2935, 4894, 8159, 13600, 22669, 37784, 62975, 104960, 174935, 291560, 485935, 809894, 1349825, 2249710, 3749519, 6249200, 10415335, 17358894, 5786298, 1928766, 642922, 1071539, 1785900, 595300, 992169, 330723, 110241, 36747, 12249, 4083, 1361, 2270, 3785, 6310, 10519, 17534, 29225, 48710, 81185, 135310, 225519, 75173, 125290, 208819, 348034, 580059, 193353, 64451, 107420, 179035, 298394, 497325, 165775, 276294, 92098, 153499, 255834, 85278, 28426, 47379, 15793, 26324, 43875, 14625, 4875, 1625, 2710, 4519, 7534, 12559, 20934, 6978, 2326, 3879, 1293, 431, 720, 240, 80, 135, 45, 15] before the iteration returns to 5 again, in other words, forming a finite cycle of length 103, therefore a(2) = 103.
		

Crossrefs

Programs

  • PARI
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
    A353312(n) = { my(visited = Map()); for(j=1, oo, if(mapisdefined(visited, n), return(j-mapget(visited, n)), mapput(visited, n, j)); n = A353313(n)); };

Formula

a(n) = A353311(n) - A353310(n).

A353305 The smallest number reached after n when iterating map x -> A353313(x) and starting from x=n, or -1 if no finite cycle is ever reached.

Original entry on oeis.org

0, 1, 5, 1, 1, 5, 2, 14, 5, 1, 5, 20, 1, 5, 25, 5, 16, 5, 2, 5, 20, 7, 5, 23, 5, 25, 5, 1, 28, 16, 5, 2, 5, 11, 5, 20, 1, 11, 5, 5, 23, 20, 14, 20, 25, 5, 25, 5, 16, 28, 16, 5, 16, 5, 2, 5, 16, 5, 11, 5, 20, 5, 20, 7, 11, 5, 5, 5, 16, 23, 20, 23, 5, 5, 20, 25, 20, 5, 5, 25, 5, 1, 5, 5, 28, 16, 20, 16, 20, 16, 5, 5
Offset: 0

Views

Author

Antti Karttunen, Apr 13 2022

Keywords

Examples

			Starting from n=2 and iterating A353313, we obtain the following 104 terms [2, 5, 10, 19, 34, 59, 100, 169, 284, 475, 794, 1325, 2210, 3685, 6144, 2048, 3415, 5694, 1898, 3165, 1055, 1760, 2935, 4894, 8159, 13600, 22669, 37784, 62975, 104960, 174935, 291560, 485935, 809894, 1349825, 2249710, 3749519, 6249200, 10415335, 17358894, 5786298, 1928766, 642922, 1071539, 1785900, 595300, 992169, 330723, 110241, 36747, 12249, 4083, 1361, 2270, 3785, 6310, 10519, 17534, 29225, 48710, 81185, 135310, 225519, 75173, 125290, 208819, 348034, 580059, 193353, 64451, 107420, 179035, 298394, 497325, 165775, 276294, 92098, 153499, 255834, 85278, 28426, 47379, 15793, 26324, 43875, 14625, 4875, 1625, 2710, 4519, 7534, 12559, 20934, 6978, 2326, 3879, 1293, 431, 720, 240, 80, 135, 45, 15] before the iteration returns to 5 again, thus after the initial 2, 5 is the smallest number encountered, therefore a(2) = 5.
		

Crossrefs

Cf. A353306 (positions of 1's), A353313.

Programs

  • PARI
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
    A353305(n) = { my(visited = Map(), m=0); for(j=1, oo, n = A353313(n); if(!m, m=n, m=min(m,n)); if(mapisdefined(visited, n), return(m), mapput(visited, n, j))); };

A353309 The maximum sum of base-3 digits occurring among all numbers reached after n, when iterating map x -> A353313(x) starting from x=n, or -1 if no finite cycle is ever reached.

Original entry on oeis.org

0, 2, 18, 2, 2, 18, 18, 6, 18, 2, 18, 5, 2, 18, 6, 18, 6, 18, 18, 18, 5, 6, 18, 5, 18, 6, 18, 2, 5, 6, 18, 18, 18, 5, 18, 5, 2, 6, 18, 18, 5, 13, 6, 13, 6, 18, 8, 18, 6, 5, 6, 18, 6, 18, 18, 18, 8, 18, 5, 18, 5, 18, 5, 6, 6, 18, 18, 18, 8, 5, 13, 5, 18, 18, 13, 6, 13, 18, 18, 8, 18, 2, 18, 18, 5, 6, 13, 6, 13, 6
Offset: 0

Views

Author

Antti Karttunen, Apr 13 2022

Keywords

Examples

			When starting iterating A353313 from n=7, we obtain -> 14 -> 25 -> 44 -> 75 -> 25 -> 44 -> 75 -> 25 -> etc, ad infinitum. Applying A053735 to all distinct terms encountered after 7, that is [14, 25, 44, 75] gives us base-3 digit sums [4, 5, 6, 5], therefore a(7) = 6, which is the largest sum.
		

Crossrefs

Cf. also A352895.

Programs

  • PARI
    A053735(n) = sumdigits(n, 3);
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
    A353309(n) = { my(visited = Map(), m=0); for(j=1, oo, n = A353313(n); m=max(m,A053735(n)); if(mapisdefined(visited, n), return(m), mapput(visited, n, j))); };

A353306 Numbers k such that 1 is in the transitive closure of the map x -> A353313(x) when starting iterating from x=k.

Original entry on oeis.org

1, 3, 4, 9, 12, 27, 36, 81, 108, 193, 243, 324, 346, 436, 579, 729, 972, 1038, 1308, 1522, 1737, 1867, 2187, 2353, 2539, 2916, 3114, 3493, 3924, 4234, 4566, 5211, 5601, 5824, 6286, 6561, 7059, 7617, 8748, 9342, 9446, 9709, 10479, 10886, 11756, 11772, 12702, 13698, 13772, 14792, 14806, 15633, 15745, 16184, 16803, 17003
Offset: 1

Views

Author

Antti Karttunen, Apr 13 2022

Keywords

Crossrefs

Positions of ones in A353305.
Subsequences: A000244, A003946, A211221.

Programs

  • PARI
    A353313(n) = { my(r=(n%3)); if(!r,n/3,((5*((n-r)/3)) + r + 3)); };
    A353305(n) = { my(visited = Map(), m=0); for(j=1, oo, n = A353313(n); if(!m, m=n, m=min(m,n)); if(mapisdefined(visited, n), return(m), mapput(visited, n, j))); };
    isA353306(n) = (1==A353305(n));

A353314 If n is of the form 3k, then a(n) = n, and if n is of the form 3k+r, with r = 1 or 2, then a(n) = 5*k + 3 + r.

Original entry on oeis.org

0, 4, 5, 3, 9, 10, 6, 14, 15, 9, 19, 20, 12, 24, 25, 15, 29, 30, 18, 34, 35, 21, 39, 40, 24, 44, 45, 27, 49, 50, 30, 54, 55, 33, 59, 60, 36, 64, 65, 39, 69, 70, 42, 74, 75, 45, 79, 80, 48, 84, 85, 51, 89, 90, 54, 94, 95, 57, 99, 100, 60, 104, 105, 63, 109, 110, 66, 114, 115, 69, 119, 120, 72, 124, 125, 75, 129, 130
Offset: 0

Views

Author

Antti Karttunen, Apr 14 2022

Keywords

Crossrefs

Cf. A353313 (variant), A349876 (the first multiple of 3 reached when iterating this sequence), A349877 (number of iterations to reach the first multiple of 3), A353327 (A102899).

Programs

  • Mathematica
    Array[If[#2 == 0, #1, 5 #1 + 3 + #2 & @@ QuotientRemainder[#1, 3]] & @@ {#, Mod[#, 3]} &, 78, 0] (* Michael De Vlieger, Apr 14 2022 *)
  • PARI
    A353314(n) = { my(r=(n%3)); if(!r,n,((5*((n-r)/3)) + r + 3)); };

Formula

a(n) = n + A353327(n) = n + A102899(3+n).
From Chai Wah Wu, Jul 27 2022: (Start)
a(n) = 2*a(n-3) - a(n-6) for n > 5.
G.f.: x*(x^3 + 3*x^2 + 5*x + 4)/(x^6 - 2*x^3 + 1). (End)

A349876 If n is divisible by 3, a(n) = n; otherwise n = 3k + r with r in {1, 2} and a(n) = a(5k + r + 3). a(n) = -1 if no multiple of three will be ever reached by iterating A353314.

Original entry on oeis.org

0, 9, 6144, 3, 9, 6144, 6, 75, 15, 9, 6144, 60, 12, 24, 75, 15, 144, 30, 18, 6144, 60, 21, 39, 69, 24, 75, 45, 27, 84, 144, 30, 54, 159, 33, 6144, 60, 36, 309, 519, 39, 69, 1560, 42, 210, 75, 45, 225, 135, 48, 84, 144, 51, 150, 90, 54, 159, 450, 57, 99, 6144, 60, 294, 105, 63
Offset: 0

Views

Author

Nicholas Drozd, Dec 03 2021

Keywords

Comments

It is not known if this function is total, that is, if a(n) is well-defined for all n (this is the reason for the escape clause in the definition).
This is a so-called "Collatz-like" function, because A353313 and A353314 have some similarity to the Collatz function A006370.
The sequence can be implemented with a Turing machine with 4 states and 2 colors.

Examples

			a(1) = a(3*0 + 1) = a(5*0 + 1 + 3) = a(4)
a(4) = a(3*1 + 1) = a(5*1 + 1 + 3) = a(9)
a(9) = 9
Trajectory of a(1): 4, 9
a(7) = a(3*2 + 1) = a(5*2 + 1 + 3) = a(14)
a(14) = a(3*4 + 2) = a(5*4 + 2 + 3) = a(25)
a(25) = a(3*8 + 1) = a(5*8 + 1 + 3) = a(44)
a(44) = a(3*14 + 2) = a(5*14 + 2 + 3) = a(75)
a(75) = 75
Trajectory of a(7): 14, 25, 44, 75
Trajectory of a(2): 5, 10, 19, 34, 59, 100, 169, 284, 475, 794, 1325, 2210, 3685, 6144.
		

Crossrefs

Cf. A010872, A349877, A349896 (record values), A353313, A353314.
Cf. also A006370.

Programs

  • Mathematica
    a[n_] := a[n] = Module[{qr = QuotientRemainder[n, 3]}, If[qr[[2]] == 0, n, a[5*qr[[1]] + qr[[2]] + 3]]]; Array[a, 64, 0] (* Amiram Eldar, Jan 04 2022 *)
  • PARI
    a(n) = my(d=divrem(n, 3)); if (d[2], a(5*d[1]+d[2]+3), n); \\ Michel Marcus, Dec 05 2021
  • Python
    def a(n):
        while True:
            quot, rem = divmod(n, 3)
            if rem == 0:
                return n
            n = (5 * quot) + rem + 3
    

Formula

If A010872(n) = 0 [when n is a multiple of 3], a(n) = n, otherwise a(n) = a(A353314(n)). [Here one may also use A353313 instead of A353314] - Antti Karttunen, Apr 14 2022

Extensions

Formal escape clause added to the definition by Antti Karttunen, Apr 14 2022

A349877 a(n) is the number of times the map x -> A353314(x) needs to be applied to n to reach a multiple of 3, or -1 if the trajectory never reaches a multiple of 3.

Original entry on oeis.org

0, 2, 14, 0, 1, 13, 0, 4, 1, 0, 12, 3, 0, 1, 3, 0, 4, 1, 0, 11, 2, 0, 1, 2, 0, 2, 1, 0, 2, 3, 0, 1, 3, 0, 10, 1, 0, 4, 5, 0, 1, 7, 0, 3, 1, 0, 3, 2, 0, 1, 2, 0, 2, 1, 0, 2, 4, 0, 1, 9, 0, 3, 1, 0, 3, 4, 0, 1, 5, 0, 6, 1, 0, 4, 2, 0, 1, 2, 0, 2, 1, 0, 2, 7, 0, 1, 4, 0, 6, 1, 0, 6, 3, 0, 1, 3, 0, 5, 1, 0, 8, 2, 0
Offset: 0

Views

Author

Nicholas Drozd, Dec 03 2021

Keywords

Comments

Equally, number of iterations of A353313 needed to reach a multiple of 3, or -1 if no multiple of 3 is ever reached. - Antti Karttunen, Apr 14 2022

Examples

			a(1) = 2 : 1 -> 4 -> 9 (as it takes two applications of A353314 to reach a multiple of three),
a(2) = 14 : 2 -> 5 -> 10 -> 19 -> 34 -> 59 -> 100 -> 169 -> 284 -> 475 -> 794 -> 1325 -> 2210 -> 3685 -> 6144
a(3) = 0 : 3 (as the starting point 3 is already a multiple of 3).
a(4) = 1 : 4 -> 9
a(7) = 4 : 7 -> 14 -> 25 -> 44 -> 75.
		

Crossrefs

Programs

  • PARI
    A353314(n) = { my(r=(n%3)); if(!r,n,((5*((n-r)/3)) + r + 3)); };
    A349877(n) = { my(k=0); while(n%3, k++; n = A353314(n)); (k); }; \\ Antti Karttunen, Apr 14 2022
  • Python
    import itertools
    def f(n):
        for i in itertools.count():
            quot, rem = divmod(n, 3)
            if rem == 0:
                return i
            n = (5 * quot) + rem + 3
    

Formula

From Antti Karttunen, Apr 14 2022: (Start)
If A010872(n) = 0 then a(n) = 0, otherwise a(n) = 1 + a(A353314(n)).
a(n) < A353311(n) for all n.
(End)

Extensions

Definition corrected and more terms from Antti Karttunen, Apr 14 2022
Showing 1-9 of 9 results.