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.

A085073 Smallest k such that n+k and n*k have the same prime signature, or 0 if no such number exists.

Original entry on oeis.org

2, 1, 7, 41, 15, 134, 3, 127, 11, 2, 3, 548, 2, 1, 3, 389, 5, 582, 2, 316, 1, 38, 3, 2216, 3, 2, 13, 212, 5, 2742, 2, 1669, 1, 1, 31, 2764, 2, 1, 13, 1094, 4, 2298, 3, 1, 123, 14, 11, 8912, 3, 202, 17, 2, 2, 1146, 23, 904, 1, 26, 3, 11028, 13, 22, 57, 3581, 37, 1194, 2, 172, 15
Offset: 1

Views

Author

Amarnath Murthy, Jul 01 2003

Keywords

Examples

			a(6) = 379 as 6*379 = 2*3*379 and 6+379 = 385 = 5*7*11 both have prime signature p*q*r.
		

Crossrefs

Cf. A052213 (a(n)=1), A085072.

Programs

  • Maple
    s:= proc(n) s(n):= sort(map(i-> i[2], ifactors(n)[2])) end:
    a:= proc(n) option remember; local k; for k
           while s(n*k)<>s(n+k) do od; k
        end:
    seq(a(n), n=1..70);  # Alois P. Heinz, Mar 06 2019
  • Mathematica
    kmax = 10^6;
    s[n_] := FactorInteger[n][[All, 2]] // Sort;
    a[n_] := Module[{k}, If[n == 1, Return[2]]; For[k = 1, k <= kmax, k++, If[s[n k] == s[n+k], Return[k]]]; 0];
    Array[a, 70] (* Jean-François Alcover, Nov 17 2020 *)
  • PARI
    sgntr(n) = vecsort(factor(n)[, 2]~);
    a(n) = {my(k=1); while (sgntr(n+k) != sgntr(n*k), k++); k; } \\ Michel Marcus, Nov 17 2020

Extensions

Corrected by Jason Earls, Jul 10 2003
More terms from David Wasserman, Jan 12 2005