login
This site is supported by donations to The OEIS Foundation.

 

Logo

Many excellent designs for a new banner were submitted. We will use the best of them in rotation.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A072491 Define f(1) = 0. For n>=2, let f(n) = n - p where p is the largest prime <= n. a(n) = number of iterations of f to reach 0, starting from n. 3
1, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 3, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 1, 2, 2, 2, 3, 2, 1, 2, 2, 2, 3, 2, 3, 2, 1, 2, 2, 2, 1, 2, 1, 2, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

COMMENTS

a(p)=1, a(p+1)=2 and a(p+4)=3 if p is an odd prime but p+2 and p+4 are composite.

REFERENCES

S. S. Pillai, "An arithmetical function concerning primes", Annamalai University Journal (1930), pp. 159-167.

LINKS

Table of n, a(n) for n=1..105.

FORMULA

On Cramér's conjecture, a(n) = O(log* n). - Charles R Greathouse IV, Feb 04 2013

EXAMPLE

a(27)=3 as f(27)=27-23=4, f(4)=4-3=1 and f(1)=0.

MATHEMATICA

f[1]=0; f[n_] := n-Prime[PrimePi[n]]; a[n_] := Module[{k, x}, For[k=0; x=n, x>0, k++; x=f[x], Null]; k]

PROG

(PARI) a(n)=if(n<4, n>0, 1+a(n-precprime(n))) \\ Charles R Greathouse IV, Feb 04 2013

CROSSREFS

Cf. A072492. A066352(n) is the smallest k such that a(k)=n.

Not the same as A051034: a(122) = 3, but A051034(122) = 2.

Sequence in context: A071854 A183025 A072410 * A051034 A082477 A036430

Adjacent sequences:  A072488 A072489 A072490 * A072492 A072493 A072494

KEYWORD

nonn,easy

AUTHOR

Amarnath Murthy, Jul 14 2002

EXTENSIONS

Edited by Dean Hickerson (dean.hickerson(AT)yahoo.com), Nov 26 2002

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified April 24 13:28 EDT 2014. Contains 240983 sequences.