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.

A285700 a(n) = Number of iterations x -> 2x-1 needed to get a nonprime number, when starting with x = n.

This page as a plain text file.
%I A285700 #11 Apr 26 2017 21:48:03
%S A285700 0,3,2,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 A285700 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 A285700 0,0,1,0,1,0,0,0,0,0,3,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 A285700 a(n) = Number of iterations x -> 2x-1 needed to get a nonprime number, when starting with x = n.
%H A285700 Antti Karttunen, <a href="/A285700/b285700.txt">Table of n, a(n) for n = 1..10000</a>
%F A285700 If A010051(n) = 0 [when n is a nonprime], a(n) = 0, otherwise a(n) = 1 + a((2*n)-1).
%F A285700 a(A000040(n)) = A181715(n).
%t A285700 Array[Length@ NestWhileList[2 # - 1 &, #, PrimeQ@ # &] - 1 &, 120] (* _Michael De Vlieger_, Apr 26 2017 *)
%o A285700 (Scheme) (define (A285700 n) (if (zero? (A010051 n)) 0 (+ 1 (A285700 (+ n n -1)))))
%o A285700 (Python)
%o A285700 from sympy import isprime
%o A285700 def a(n): return 0 if isprime(n) == 0 else 1 + a(2*n - 1) # _Indranil Ghosh_, Apr 26 2017
%Y A285700 Cf. A000040, A005382 (positions of terms > 1), A010051, A181715, A285701.
%K A285700 nonn
%O A285700 1,2
%A A285700 _Antti Karttunen_, Apr 26 2017