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.

User: Rafik Khalfi

Rafik Khalfi's wiki page.

Rafik Khalfi has authored 17 sequences. Here are the ten most recent ones:

A380098 Numbers whose sum of cubes of distinct prime factors is prime.

Original entry on oeis.org

165, 210, 390, 399, 420, 462, 495, 561, 570, 595, 615, 630, 651, 780, 798, 825, 840, 924, 957, 1050, 1085, 1140, 1170, 1173, 1197, 1218, 1235, 1245, 1260, 1302, 1386, 1435, 1470, 1482, 1485, 1495, 1554, 1560, 1596, 1615, 1680, 1683, 1705, 1710, 1767, 1771, 1815, 1845, 1848, 1885, 1890, 1938, 1950, 1953
Offset: 1

Author

Rafik Khalfi, Jan 12 2025

Keywords

Examples

			165=3*5*11 and 3^3 + 5^3 + 11^3 = 1483, which is prime. Therefore, 165 is included.
		

Crossrefs

Programs

  • Maple
    a:=proc(n) local DPF: DPF:=factorset(n): if isprime(sum(DPF[j]^3, j=1..nops(DPF)))=true then n else fi end: seq(a(n), n=1..2000);
  • Mathematica
    Select[Range[2000], PrimeQ[Total[Transpose[FactorInteger[#]][[1]]^3]]&]
  • Python
    from sympy import isprime, factorint
    def ok(n): return isprime(sum(p**3 for p in factorint(n)))
    print([k for k in range(2000) if ok(k)]) # Michael S. Branicky, Jan 12 2025

A378423 a(n) is the number of distinct terms reached by iterating the function f(x) = 2 + A008472(x), starting from x=n.

Original entry on oeis.org

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

Author

Rafik Khalfi, Nov 25 2024

Keywords

Comments

a(n)= The number of distinct elements in the set A(n)={f^{k}(n);k>=0}, where f^{k} is the k-th iteration of f.
The set A(n) contains either the fixed point 4 or a cyclic component {5,7,9}.

Examples

			For n=33, 33->16->4->4-> ... and 4 is a fixed point, then a(n)= number of distinct terms = 3.
For n=66, 66->18->7->9->5->7 ... and {5,7,9} is a cyclic component, then a(n)= number of distinct terms = 5.
		

Crossrefs

Cf. A008472.

Programs

  • Maple
    f:= proc(n)
    add( d, d= numtheory[factorset](n)):
    end proc: f(1) := 0:
    g:= proc(n)
       2 + f(n)
    end proc:
     a:= proc(n)
     local k, result:
     k := 1:
    result := n:
    while not (result = 4 or result = 5 or result = 7 or result = 9) do
    result := g(result):
    k := k + 1:
    end do:
    if result = 5 or result = 7 or result = 9 then
    return k + 2;
    else
    return k:
    end if
    end proc:
    map(a, [$1..100]);
  • Mathematica
    a[n_] := -1 + Length@ NestWhileList[2 + If[# == 1, 0, Total[FactorInteger[#][[;; , 1]]]] &, n, UnsameQ, All]; Array[a, 100] (* Amiram Eldar, Nov 26 2024 *)
  • Python
    from sympy import factorint
    def a(n):
        reach = set()
        while n not in reach:
            reach.add(n)
            n = 2 + sum(factorint(n))
        return len(reach)
    print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Nov 26 2024

A377643 a(n) is the number of terms in the trajectory when the map x -> 2+sopfr(x) is iterated, starting from x = n until x = 8, with sopfr = A001414.

Original entry on oeis.org

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

Author

Rafik Khalfi, Nov 03 2024

Keywords

Examples

			For n=1, the trajectory from n down to 8 comprises a(1) = 7 terms: 1 -> 2 -> 4 -> 6 -> 7 -> 9 -> 8.
		

Crossrefs

Cf. A001414 (sopfr).

Programs

  • Maple
    f := proc(n)
      add(op(1, i) * op(2, i), i = ifactors(n)[2]):
    end proc:
    g := proc(n)
      2 + f(n):
    end proc:
    A377643 := proc(n)
    local k, result:
     k := 1:
    result := n:
    while result <> 8 do
    result := g(result):
    k := k + 1:
    end do:
    k:
    end proc:
    A377643(8) := 1:
    map(A377643, [$1..100]);
  • Mathematica
    s[n_] := 2 + Plus @@ Times @@@ FactorInteger[n]; s[1] = 2; a[n_] := Length@ NestWhileList[s, n, # != 8 &]; Array[a, 100] (* Amiram Eldar, Nov 07 2024 *)

A376070 a(n) is the number of distinct terms reached by iterating the function x->2+A075860(x), starting from x=n, with n>0.

Original entry on oeis.org

3, 2, 4, 1, 3, 4, 3, 2, 3, 4, 4, 4, 3, 4, 2, 2, 6, 4, 5, 4, 4, 3, 5, 4, 4, 2, 4, 4, 6, 4, 5, 2, 4, 5, 4, 4, 3, 4, 2, 4, 4, 4, 3, 3, 2, 4, 5, 4, 4, 4, 4, 2, 3, 4, 2, 4, 3, 5, 6, 4, 5, 4, 4, 2, 4, 2, 3, 5, 2, 4, 4, 4, 3, 2, 2, 4, 4, 4, 5, 4, 4, 3, 4, 4, 3, 2, 2, 3, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 4, 4, 4
Offset: 1

Author

Rafik Khalfi, Sep 08 2024

Keywords

Comments

The sequence has another definition: a(n)= The number of distinct elements in the set A(n)={f^{k}(n);k>=0}, where f^{k} is the k-th iteration of the function f defined by f(n)=2+A075860(n), f^{0}(n)=n and n>0.
For all n>0, the set A(n) contains either the fixed point 4 or a cyclic component {5,7,9}.
For all n>1 and h in A(n)\{n}, h-2 is a prime number.
a(n)=1 if and only if n=4.
If (p,p+2) is a twin prime pair with p>7, then a(p+2)=a(p)-1.

Examples

			For n=3, 3->5->7->9->5->7->9-> ... and {5,7,9} is a cyclic component, then a(n)=number of distinct terms = 4.
For n=66, 66->4->4->4-> ... and 4 is a fixed point, then a(n)= number of distinct terms = 2.
For n=25, 25->7->9->5->7->9->5->7->9->... and {5,7,9} is a cyclic component, then a(n)=number of distinct terms = 4.
		

Crossrefs

Cf. A075860.

Programs

  • Maple
    f := proc(n) option remember:
        if isprime(n) then
            n
        else
            procname(convert(numtheory:-factorset(n), `+`))
        end if
    end proc:
    f(1) := 0:
    g := proc(n)
        2 + f(n)
    end proc:
    A376070 := proc(n)
        local k, result:
        k := 1:
        result := n:
        while not (result = 4 or result = 5 or result = 7 or result = 9) do
            result := g(result):
            k := k + 1:
        end do:
        if result = 5 or result = 7 or result = 9 then
            return k + 2;
        else
            return k:
        end if
    end proc:
    map(A376070, [$1..200]);
  • Python
    from sympy import  primefactors
    def a(n, pn):
        if n == pn:
            return n
        else:
            return a(sum(primefactors(n)), n)
    def A376070(n):
        k = 1
        result = n
        while result not in {4, 5, 7, 9}:
            result = 2 + a(result, None)
            k += 1
        if result in {5, 7, 9}:
            return k + 2
        else:
            return k
    print([A376070(i) for i in range(1, 200)])

A375535 a(n) = n - A075860(n).

Original entry on oeis.org

1, 0, 0, 2, 0, 1, 0, 6, 6, 3, 0, 7, 0, 11, 13, 14, 0, 13, 0, 13, 14, 9, 0, 19, 20, 24, 24, 25, 0, 23, 0, 30, 30, 15, 30, 31, 0, 31, 37, 33, 0, 37, 0, 31, 43, 41, 0, 43, 42, 43, 44, 50, 0, 49, 53, 53, 44, 27, 0, 53, 0, 59, 56, 62, 60, 64, 0, 49, 67, 67, 0, 67, 0, 72, 73, 69, 72, 73
Offset: 1

Author

Rafik Khalfi, Aug 18 2024

Keywords

Comments

If p is a prime number, then a(p)=0.

Examples

			For n=15, a(15) = 15-2 = 13.
		

Crossrefs

Cf. A075860.

Programs

  • Maple
    f := proc(n)
        option remember:
        if isprime(n) then
            n
        else
            procname(convert(numtheory:-factorset(n), `+`))
        end if
    end proc:
    f(1) := 0:
    seq(n - f(n), n = 1..100);
  • Python
    from sympy import primefactors
    def a(n, pn):
        if n == pn:
            return n
        else:
            return a(sum(primefactors(n)), n)
    print([i-a(i, None) for i in range(1, 100)])

A374330 a(n) is the number of numbers k <= prime(n)^2 such that A075860(k) = prime(n).

Original entry on oeis.org

2, 2, 6, 8, 2, 10, 3, 14, 6, 8, 22, 7, 8, 21, 9, 14, 12, 45, 14, 17, 45, 17, 21, 20, 18, 17, 64, 21, 54, 28, 25, 22, 22, 72, 37, 82, 26, 28, 31, 43, 36, 93, 44, 95, 38, 95, 41, 38, 33, 106, 36, 49, 111, 65, 53, 53, 49, 113, 55, 68, 138, 80, 49, 50, 152, 61, 55, 43, 73, 120
Offset: 1

Author

Rafik Khalfi, Jul 04 2024

Keywords

Comments

For all n>=1, a(n)>=2.

Examples

			For n=3, prime(3)=5. The only integers k <= 5^2 such that A075860(k)=5 are 5,6,12,18,24 and 25. Therefore a(3)=6.
		

Crossrefs

Programs

  • Maple
    f := proc (n)
        option remember;
        if isprime(n) then
            return n
        else
            return procname(convert(numtheory:-factorset(n), `+`))
        end if
    end proc:
    g := proc (n)
        local count, k;
        count := 0;
        for k from ithprime(n) to ithprime(n)^2 do
            if f(k) = ithprime(n) then
                count := count + 1
            end if
        end do;
        return count
    end proc:
    map(g, [$1 .. 80]);
  • PARI
    fp(n, pn) = if (n == pn, n, fp(vecsum(factor(n)[, 1]), n));
    f(n) = if (n==1, 0, fp(n, 0)); \\ A075860
    a(n) = sum(k=1, prime(n)^2, f(k) == prime(n)); \\ Michel Marcus, Jul 04 2024

A374163 a(1) = 1; for n>1 a(n) is the minimum value of k > 0 such that sigma^{k}(n)-1 is prime, if such a k exists; otherwise -1, where sigma^{k} is the k-th iteration of sigma=A000203.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 2, 2, 1, 1, 4, 1, 1, 1, 2, 1, 4, 1, 1, 1, 5, 1, 1, 2, 1, 2, 3, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 7, 1, 2, 2, 7, 1, 3, 1, 1, 2, 1, 2, 1, 1, 2, 8, 2, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 7, 2
Offset: 1

Author

Rafik Khalfi, Jun 29 2024

Keywords

Examples

			For n=12, sigma^{4}(12)-1 = 360-1 = 359 is prime, and there is no positive k<4 such that sigma^{k}(12)-1 is prime, so a(12)=4.
		

Crossrefs

Programs

  • Maple
    sigma_iterate := proc (n, k)
        local sigma_result, i:
        sigma_result := n:
        for i to k do
            sigma_result := sigma(sigma_result)
        end do:
        return sigma_result
    end proc:
    find_min_k := proc (n)
        local k, sigma_k_n, prime_candidate:
        k := 0:
        do
            k := k+1:
            sigma_k_n := sigma_iterate(n, k):
            prime_candidate := sigma_k_n - 1:
            if isprime(prime_candidate) then
                return k
            end if
        end do
    end proc:
    map(find_min_k, [$ 2 .. 100]);
  • Mathematica
    A374163[n_] := If[n==1, 1, Length[NestWhileList[DivisorSigma[1, #]&, n, !PrimeQ[# - 1]&, {2, 1}]] - 1]; Array[A374163, 100] (* Paolo Xausa, Jul 24 2024 *)
  • PARI
    a(n) = my(k=1, s=sigma(n)); while(!isprime(s-1), k++; s = sigma(s)); k; \\ Michel Marcus, Jun 29 2024

Extensions

Offset corrected by N. J. A. Sloane, Jul 25 2024

A374104 a(n) = A075860(A075860(n) + 2) + 2.

Original entry on oeis.org

4, 4, 7, 4, 9, 9, 5, 4, 7, 5, 15, 9, 4, 7, 4, 4, 21, 9, 9, 5, 5, 4, 7, 9, 9, 4, 7, 7, 33, 5, 5, 4, 7, 9, 9, 9, 4, 5, 4, 5, 45, 9, 4, 4, 4, 9, 9, 9, 5, 5, 5, 4, 4, 9, 4, 7, 4, 5, 63, 5, 9, 7, 5, 4, 9, 4, 4, 9, 4, 7, 75, 9, 4, 4, 4, 5, 9, 9, 5, 5, 7, 4, 15, 9, 4, 4, 4, 4, 9, 5, 5, 9
Offset: 1

Author

Rafik Khalfi, Jun 28 2024

Keywords

Comments

(p,p+2) is a twin prime pair if and only if a(p)=p+4.
For all positive integers n, there exists a positive integer m such that a(n)

Crossrefs

Programs

  • Maple
    g:= proc(n) option remember;
        if isprime(n) then n
       else procname(convert(numtheory:-factorset(n), `+`))
        fi
     end proc:
     g(1):= 0:
    seq(2+g(2+g(i)),i=1..140);
  • PARI
    fp(n, pn) = if (n == pn, n, fp(vecsum(factor(n)[, 1]), n));
    f(n) = if (n==1, 0, fp(n, 0)); \\ A075860
    a(n) = f(f(n)+2)+2; \\ Michel Marcus, Jun 28 2024

A374066 a(n) is the number of terms in the trajectory when the map x -> A067240(x) is iterated, starting from x = n until x = 0.

Original entry on oeis.org

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

Author

Rafik Khalfi, Jun 27 2024

Keywords

Examples

			For n=11, the trajectory from n down to 0 comprises a(11) = 7 terms: 11 -> 10 -> 5 -> 4 -> 2 -> 1 -> 0.
		

Crossrefs

Programs

  • Maple
    f := proc(n)
        local e, j:
        e := ifactors(n)[2]:
        add((e[j][1] - 1) * e[j][1]^(e[j][2] - 1), j = 1 .. nops(e))
    end proc:
     A374066:= proc(n)
        local count, current:
        count := 1:
        current := n:
        while current <> 0 do
            current := f(current):
            count := count + 1
        end do:
        return count
    end proc:
    map(A374066, [$1..200]);
  • Mathematica
    f[p_, e_] := (p - 1)*p^(e - 1); s[n_] := s[n] = Plus @@ f @@@ FactorInteger[n]; a[n_] := Length[NestWhileList[s, n, # > 0 &]]; Array[a, 100] (* Amiram Eldar, Jun 27 2024 *)

A373437 Integers k such that sigma(sigma(2*k))=2*sigma(sigma(k)); sigma=A000203.

Original entry on oeis.org

2, 6, 14, 18, 38, 42, 50, 54, 62, 74, 86, 114, 122, 126, 134, 146, 150, 158, 162, 186, 206, 218, 222, 254, 258, 266, 302, 314, 326, 342, 350, 366, 378, 386, 398, 402, 422, 434, 438, 450, 458, 474, 482, 518, 542, 554, 558, 566, 578, 602, 618, 626, 654, 662, 666, 674, 686, 734, 746, 758, 762, 774, 794
Offset: 1

Author

Rafik Khalfi, Jun 04 2024

Keywords

Crossrefs

Programs

  • Maple
    with(numtheory):
    P := proc (q)
        local n, result:
        result := []:
        for n to q do
            if sigma(sigma(2*n)) = 2*sigma(sigma(n)) then
                result := [op(result), n]:
            end if
        end do:
        print(result):
    end proc:
    P(10^3);
  • Mathematica
    Select[Range[800],DivisorSigma[1,DivisorSigma[1,2#]]==2DivisorSigma[1,DivisorSigma[1,#]]&] (* Stefano Spezia, Jun 05 2024 *)
  • Python
    from sympy import divisor_sigma as sigma
    def P(q):
        result = []
        for n in range(1, q + 1):
            if sigma(sigma(2 * n)) == 2 * sigma(sigma(n)):
                result.append(n)
        print(result)
    P(10**3)