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.

A175126 a(0) = a(1) = 0, for n >= 2, a(n) = number of steps of iteration of {r - (smallest prime divisor of r)} needed to reach 0 starting at r = n.

Original entry on oeis.org

0, 0, 1, 1, 2, 1, 3, 1, 4, 4, 5, 1, 6, 1, 7, 7, 8, 1, 9, 1, 10, 10, 11, 1, 12, 11, 13, 13, 14, 1, 15, 1, 16, 16, 17, 16, 18, 1, 19, 19, 20, 1, 21, 1, 22, 22, 23, 1, 24, 22, 25, 25, 26, 1, 27, 26, 28, 28, 29, 1, 30, 1, 31, 31, 32, 31, 33, 1, 34, 34, 35, 1, 36, 1, 37, 37, 38, 36, 39, 1, 40, 40
Offset: 0

Views

Author

Jaroslav Krizek, Feb 15 2010

Keywords

Comments

See A005843 and A175127 for the smallest and greatest numbers m such that a(m) = k for k >= 2.

Examples

			Example (a(6)=3): 6-2=4, 4-2=2, 2-2=0; iterations has 3 steps.
a(25) = 11, as we have 25 -> 20 -> 18 -> 16 -> 14 -> 12 -> 10 -> 8 -> 6 -> 4 -> 2 -> 0, in total eleven steps to reach zero. - _Antti Karttunen_, Aug 22 2019
		

Crossrefs

From a(2) on, one more than A046667.

Programs

  • Maple
    Contribution from R. J. Mathar, Mar 11 2010: (Start)
    A020639 := proc(n) min(op(numtheory[factorset](n))) ; end proc:
    A046666 := proc(n) n-A020639(n) ; end proc:
    A175126 := proc(n) local a; if n = 1 then 0; elif n = 0 then 0; else 1+procname(A046666(n)) ; end if; end proc:
    seq(A175126(n),n=1..100) ; (End)
  • Mathematica
    stps[n_]:=Length[NestWhileList[#-FactorInteger[#][[1,1]]&,n,#>0&]]-1; Join[{0},Rest[Array[stps,90]]] (* Harvey P. Dale, Aug 15 2012 *)
  • PARI
    A020639(n) = if(1==n, n, factor(n)[1, 1]);
    A175126(n) = if(n<2,0,1+A175126(n-A020639(n))); \\ Antti Karttunen, Aug 22 2019
    
  • PARI
    a(n) = if(n>1, (n-factor(n)[1, 1])/2 + 1, 0) \\ Jianing Song, Aug 07 2022

Formula

a(2n) = n >= 2; a(p) = 1 for p = prime.
a(n) = 0 if n<=1, else a(n) = 1+a(A046666(n)). - R. J. Mathar, Mar 11 2010
a(n) = (n-lpf(n))/2 + 1 for n > 1, lpf = A020639. - Jianing Song, Aug 07 2022

Extensions

Corrected A-number typo in the comment - R. J. Mathar, Mar 11 2010
Extended beyond a(30) by R. J. Mathar, Mar 11 2010
Term a(0) = 0 prepended by Antti Karttunen, Aug 22 2019