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.

A355958 Positions where primes occur in A104589.

Original entry on oeis.org

2, 3, 4, 8, 12, 18, 19, 35, 39, 47, 53, 65, 75, 81, 84, 102, 109, 127, 131, 261, 265, 273, 283, 305, 323, 329, 350, 450, 456, 462, 492, 522, 562, 660, 664, 784, 904, 922, 1081, 1213, 1258, 1406, 1443, 1467, 1549, 1655, 1772, 1774, 1786, 1810, 1901, 1919, 2024, 2144, 2161
Offset: 1

Views

Author

Michel Marcus, Jul 21 2022

Keywords

Examples

			The 1st prime in A104589 is 2, and its position is 2, so a(1) = 2.
The 2nd prime in A104589 is 5, and its position is 3, so a(2) = 3.
The 3rd prime in A104589 is 13, and its position is 4, so a(3) = 4.
		

Crossrefs

Programs

  • Mathematica
    s[1] = 1; s[n_] := s[n] = s[n - 1] + Sum[If[CompositeQ[s[k]], 0, s[k]], {k, 1, n - 1}]; Select[Range[2000], PrimeQ[s[#]] &] (* Amiram Eldar, Jul 21 2022 *)
  • PARI
    lista(nn) = my(last=1, s = 1, list = List()); for (n=2, nn, last += s; if (isprime(last), s += last; listput(list, n));); Vec(list);

A355967 Indices of the primes that occur in A104589.

Original entry on oeis.org

1, 3, 6, 25, 104, 634, 1236, 22613, 103409, 929044, 6298419, 80396036, 843325558, 5843115733, 24428345613, 515211289906, 4021634909249, 77930896716918, 387592118891917, 53467625139656294, 258820291307490689, 2600667638804262010, 29899374277934530878
Offset: 1

Views

Author

Michel Marcus, Jul 21 2022

Keywords

Examples

			The primes in A104589 are 2, 5, 13, 97, ... with prime indices 1, 3, 6, 25, ...
		

Crossrefs

Programs

  • Mathematica
    s[1] = 1; s[n_] := s[n] = s[n - 1] + Sum[If[CompositeQ[s[k]], 0, s[k]], {k, 1, n - 1}]; PrimePi[Select[s /@ Range[200], PrimeQ[#] &]] (* Amiram Eldar, Jul 21 2022 *)
  • PARI
    lista(nn) = my(last=1, s = 1, list = List()); for (n=2, nn, last += s; if (isprime(last), s += last; listput(list, primepi(last)));); Vec(list);
    
  • Python
    from sympy import isprime, primepi
    from itertools import islice
    def A355967_gen(): # generator of terms
        a, b = 1, 1
        while True:
            a += b
            if isprime(a):
                b += a
                yield primepi(a)
    A355967_list = list(islice(A355967_gen(),14)) # Chai Wah Wu, Jun 03 2024

Extensions

a(14)-a(20) from Amiram Eldar, Jul 21 2022
a(21)-a(23) from Chai Wah Wu, Jun 03 2024

A355697 a(0) = 0, a(1) = 1; for n > 1, a(n) = a(n-1) + g - 1 if a(n-1) is prime, otherwise a(n) = a(n-1) + g + 1, where g = a(n-1) - a(n-2).

Original entry on oeis.org

0, 1, 3, 4, 6, 9, 13, 16, 20, 25, 31, 36, 42, 49, 57, 66, 76, 87, 99, 112, 126, 141, 157, 172, 188, 205, 223, 240, 258, 277, 295, 314, 334, 355, 377, 400, 424, 449, 473, 498, 524, 551, 579, 608, 638, 669, 701, 732, 764, 797, 829, 860, 892, 925, 959, 994, 1030, 1067, 1105, 1144, 1184
Offset: 0

Views

Author

John Tyler Rascoe, Jul 19 2022

Keywords

Examples

			0                              =  0
0 + 1                          =  1
0 + 1 + 2                      =  3 (prime)
0 + 1 + 2 + 1                  =  4
0 + 1 + 2 + 1 + 2              =  6
0 + 1 + 2 + 1 + 2 + 3          =  9
0 + 1 + 2 + 1 + 2 + 3 + 4      = 13 (prime)
0 + 1 + 2 + 1 + 2 + 3 + 4 + 3  = 16
		

Crossrefs

Programs

  • MATLAB
    function a = A355697(max_n)
        a = 0; m = 0;
        for n = 1:max_n
            if isprime(a(n))
                m = m - 1;
            else
                m = m + 1;
            end
            a(n+1) = a(n) + m;
        end
    end % Thomas Scheuerle, Jul 22 2022
    
  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := a[n] = 2*a[n - 1] - a[n - 2] - If[PrimeQ[a[n - 1]], 1, -1]; Array[a, 50, 0] (* Amiram Eldar, Jul 23 2022 *)
  • PARI
    lista(nn) = my(va = vector(nn)); va[1] = 0; va[2] = 1; for (n=3, nn, if (isprime(va[n-1]), va[n] = 2*va[n-1]-va[n-2]-1, va[n] = 2*va[n-1]-va[n-2]+1);); va; \\ Michel Marcus, Aug 23 2022
  • Python
    import sympy
    A355697 = A = [0,1]
    for n in range(1,100):
          if sympy.isprime(A355697[-1]):
                y = A[-1] - A[-2] - 1
          else:
                y = A[-1] - A[-2] + 1
          A.append(A[-1] + y)
    
Showing 1-3 of 3 results.