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

A354386 a(n) is the first prime that is the start of a sequence of exactly n primes under the map p -> p + A001414(p-1) + A001414(p+1).

Original entry on oeis.org

3, 2, 337, 2633, 14143, 6108437, 373777931
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, May 24 2022

Keywords

Examples

			a(3) = 337 because 337, 337+A001414(336)+A001414(338) = 383, and 383+A001414(382)+A001414(384) = 593 are prime, but 593+A001414(592)+A001414(594) = 660 is not prime, and 337 is the first prime for which this works.
		

Crossrefs

Programs

  • Maple
    spf:= proc(n) option remember; local t; add(t[1]*t[2], t=ifactors(n)[2]) end proc:
    f:= n -> spf(n-1)+n+spf(n+1):
    g:= proc(n) option remember;
      if not isprime(n) then return 0 fi;
      1 + procname(f(n))
    end proc:
    V:= Vector(7): count:= 0:
    p:= 1:
    while count < 7 do
      p:= nextprime(p);
      v:= g(p);
      if V[v] = 0 then V[v]:= p; count:= count+1 fi;
    od:
    convert(V,list);
  • Mathematica
    f[1] = 0; f[n_] := Plus @@ Times @@@ FactorInteger[n]; g[n_] := -1 + Length @ NestWhileList[# + f[# - 1] + f[# + 1] &, n, PrimeQ]; seq[len_, max_] := Module[{s = Table[0, {len}], c = 0, p = 1, i}, While[p < max && c < len, p = NextPrime[p]; i = g[p]; If[i <= len && s[[i]] == 0, c++; s[[i]] = p]]; s]; seq[6, 10^7] (* Amiram Eldar, May 29 2022 *)
  • Python
    from sympy import factorint, isprime, nextprime
    def A001414(n): return sum(p*e for p, e in factorint(n).items())
    def f(p): return p + A001414(p-1) + A001414(p+1)
    def a(n):
        p, count = 1, 0
        while count != n:
            p = nextprime(p)
            fp, count = f(p), 1
            while isprime(fp): fp = f(fp); count += 1
        return p
    print([a(n) for n in range(1, 6)]) # Michael S. Branicky, May 29 2022
Showing 1-1 of 1 results.