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.

A018845 Number of iterations required for the sum of n and its prime divisors = t to reach a prime (where t replaces n in each iteration) in A016837.

Original entry on oeis.org

4, 2, 3, 2, 1, 2, 2, 2, 1, 3, 1, 2, 1, 1, 3, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 3, 3, 2, 3, 5, 4, 1, 1, 1, 2, 2, 1, 2, 2, 10, 3, 2, 1, 6, 1, 3, 1, 5, 5, 1, 5, 3, 2, 1, 5, 1, 1, 2, 7, 3, 4, 4, 4, 1, 10, 3, 1, 4, 6, 3, 6, 3, 1, 6, 3, 4, 2, 2, 2, 2, 9, 2, 5, 1, 1, 3
Offset: 2

Views

Author

Keywords

Examples

			Starting with 4, 4=2*2, so 4+2+2=8. 8=2*2*2 so 8+2+2+2=14. 14=2*7 so 14+2+7=23, prime in 3 iterations, so a(4)=3.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember; local t;
       t:= n + convert(map(convert,ifactors(n)[2],`*`),`+`);
       if isprime(t) then 1 else 1+procname(t) fi
    end proc:
    map(f, [$2..100]); # Robert Israel, Jul 26 2015
  • Mathematica
    a[n_] := a[n] = Module[{t, f = FactorInteger[n]}, t = n + f[[All, 1]]. f[[All, 2]]; If[PrimeQ[t], 1, 1 + a[t]]];
    a /@ Range[2, 100] (* Jean-François Alcover, Jul 19 2020, after Maple *)
  • PARI
    sfpn(n) = {my(f = factor(n)); n + sum(k=1, #f~, f[k,1]*f[k,2]);}
    a(n) = {nb = 1; while (! isprime(t=sfpn(n)), n=t; nb++); nb;}

Formula

Factor n, add n and its prime divisors. Sum = t, t replaces n, repeat until a prime is produced in k iterations.
For x in A050703, a(x) = 1. - Michel Marcus, Jul 24 2015
Number of iterations x->A075254(x) to reach a prime, starting at x=n. - R. J. Mathar, Jul 27 2015

Extensions

Corrected by Michel Marcus, Jul 24 2015

A282795 Start with n. If n is 1 or a prime, stop. Otherwise, add the prime factors of n (with repetition) to n, and repeat until reaching a prime, when we stop. If no prime is ever reached, a(n) = -1.

Original entry on oeis.org

1, 2, 3, 23, 5, 11, 7, 23, 23, 17, 11, 19, 13, 23, 23, 47, 17, 41, 19, 29, 31, 47, 23, 47, 47, 41, 71, 71, 29, 71, 31, 83, 47, 53, 47, 71, 37, 59, 71, 71, 41, 83, 43, 59, 167, 71, 47, 59, 149, 167, 71, 167, 53, 83, 71, 167, 79, 89, 59, 251, 61
Offset: 1

Views

Author

Peter Weiss, Feb 21 2017

Keywords

Comments

a(n) > 0 for every n up to at least 2000000. - Ivan N. Ianakiev, Feb 23 2017

Examples

			4 -> 4+2+2 = 8 -> 8+2+2+2 = 14 -> 14+2+7 = 23, prime, so a(4) = 23.
		

Crossrefs

Cf. A016837, A037274 (home primes), A075254, A195264.

Programs

  • Maple
    A282795 := proc(n)
        local nrec;
        nrec := n ;
        while not isprime(nrec) and nrec <> 1 do
            nrec := A075254(nrec) ;
        end do:
        nrec ;
    end proc:
    seq(A282795(n),n=1..90) ; # R. J. Mathar, Feb 23 2017
  • Mathematica
    f[n_]:=n+Total[Replace[{a_,b_}->a*b]/@FactorInteger[n]];
    a[1]=1;a[n_]:=If[PrimeQ[n],n,Last[NestWhileList[f,n,!PrimeQ[#]&]]];
    Array[a,2000000] (* Ivan N. Ianakiev, Feb 23 2017 *)
Showing 1-2 of 2 results.