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

A355457 Numbers k > 1 such that A354833(k) = k * A354833(k-1).

Original entry on oeis.org

2, 3, 4, 7, 15, 26, 31, 43, 98, 117, 140, 215, 540, 1945, 22279, 38459, 39461, 66869, 69328, 4047994, 4615259, 5617480, 5898979, 9685120, 9751023
Offset: 1

Views

Author

Rémy Sigrist, Jul 02 2022

Keywords

Comments

This sequence gives indexes of multiplicative steps in A354833.

Examples

			For k = 7:
- A354833(7) = 91 = 7 * 13 = 7 * A354833(6),
- so 7 is a term.
		

Crossrefs

Cf. A354833.

Programs

  • PARI
    { seen = Map(); v = 1; for (n=2, oo, mapput(seen, v, 0); v=if (mapisdefined(seen, w=v-n) || w<0, print1 (n", "); v*n, w)) }
    
  • Python
    from itertools import count, islice
    def agen():
        an, seen = 1, {1}
        for n in count(2):
            t = an - n
            if t not in seen and t >= 0: an = t
            else: an *= n; yield n
            seen.add(an)
    print(list(islice(agen(), 25))) # Michael S. Branicky, Jul 02 2022

Extensions

a(20)-a(25) from Michael S. Branicky, Jul 02 2022

A363962 a(1)=1; for n > 1, if n appears in the sequence then a(n) = lastindex(n), where lastindex(n) is the index of the last appearance of n. Otherwise a(n) = a(n-1) - n unless that result is already in the sequence or would be negative; otherwise, a(n) = a(n-1) * n.

Original entry on oeis.org

1, 2, 6, 24, 19, 3, 21, 13, 4, 40, 29, 17, 8, 112, 97, 81, 12, 216, 5, 100, 7, 154, 131, 4, 100, 74, 47, 1316, 11, 330, 299, 267, 234, 200, 165, 129, 92, 54, 15, 10, 410, 368, 325, 281, 236, 190, 27, 1296, 1247, 1197, 1146, 1094, 1041, 38, 2090, 2034, 1977, 1919, 1860, 1800, 1739, 1677, 1614
Offset: 1

Views

Author

Kelvin Voskuijl, Jun 29 2023

Keywords

Examples

			a(6) = 3, as a(3) = 6 = n, thus a(6) = 3.
a(28) = 1316 because subtracting 28 from the previous term (47) would give 19, which is already in the sequence, so multiply 47 by 28 to get 1316.
a(100) = 25, as a(25) = 100 = n, thus a(100) = 25.
		

Crossrefs

Programs

  • MATLAB
    function a = A363962( max_n )
        a = 1;
        for n = 2:max_n
            r = find(a == n,1,'last');
            if ~isempty(r)
                a(n) = r;
            else
                k = a(n-1) - n;
                if k > 0 && isempty(find(a == k, 1))
                    a(n) = k;
                else
                    a(n) = a(n-1) * n;
                end
            end
        end
    end % Thomas Scheuerle, Jul 03 2023
  • Mathematica
    a[1] = 1; a[n_] := a[n] = Module[{s = Array[a, n - 1], a1}, If[MemberQ[s, n], Position[s, n][[-1, 1]], a1 = a[n - 1] - n; If[a1 < 0 || MemberQ[s, a1], a[n - 1]*n, a1]]]; Array[a, 100] (* Amiram Eldar, Jul 23 2023 *)
Showing 1-2 of 2 results.