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

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

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.

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).
Showing 1-4 of 4 results.