login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A285701 a(n) = number of iterations x -> A064216(x) needed to reach a nonprime number when starting from n, a(2) = a(3) = 1. 4

%I #24 Jul 03 2017 01:53:35

%S 0,1,1,0,1,0,2,0,0,0,1,0,1,0,0,0,1,0,3,0,0,0,1,0,0,0,0,0,1,0,2,0,0,0,

%T 0,0,2,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,

%U 0,0,1,0,1,0,0,0,0,0,2,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,2,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0

%N a(n) = number of iterations x -> A064216(x) needed to reach a nonprime number when starting from n, a(2) = a(3) = 1.

%H Antti Karttunen, <a href="/A285701/b285701.txt">Table of n, a(n) for n = 1..10000</a>

%F If A010051(n) = 0 [when n is a nonprime], a(n) = 0, otherwise a(n) = 1 + a(A064216(n)), with a(2) = a(3) = 1.

%e For n=2, A064216(2) = 2, thus there is exactly one distinct prime that can be reached when iterating A064216 starting from 2, thus a(2) = 1.

%e For n=19, A064216(19) = 31 (a prime), A064216(31) = 59 (a prime) and A064216(59) = 44 (not a prime), thus there are exactly three distinct primes that are encountered when iterating A064216 starting from 19 before a nonprime is reached, thus a(19) = 3 (the count includes also the starting prime 19).

%o (PARI)

%o A064989(n) = {my(f); f = factor(n); if((n>1 && f[1,1]==2), f[1,2] = 0); for (i=1, #f~, f[i,1] = precprime(f[i,1]-1)); factorback(f)};

%o A064216(n) = A064989((2*n)-1);

%o A285701(n) = if(!isprime(n),0,if((2==n)||(3==n),1,1+A285701(A064216(n))));

%o (Scheme)

%o (definec (A285701 n) (cond ((zero? (A010051 n)) 0) ((or (= 2 n) (= 3 n)) 1) (else (+ 1 (A285701 (A064216 n))))))

%o ;; Another version not requiring A064216 and A064989:

%o (definec (A285701 n) (cond ((zero? (A010051 n)) 0) ((or (= 2 n) (= 3 n)) 1) ((zero? (A010051 (+ n n -1))) 1) (else (+ 1 (A285701 (A000040 (+ -1 (A000720 (+ n n -1)))))))))

%Y Cf. A000040, A000720, A010051, A048674, A064216, A064989, A245449, A246373, A285700, A285706.

%Y Cf. A005382 (gives positions of terms > 1 from its third term 7 onward).

%K nonn

%O 1,7

%A _Antti Karttunen_, Apr 26 2017

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 11:59 EDT 2024. Contains 371254 sequences. (Running on oeis4.)