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!)
A116533 a(1)=1, a(2)=2, for n > 2 if a(n-1) is prime, then a(n) = 2*a(n-1), otherwise a(n) = a(n-1) - 1. 14

%I #11 Sep 03 2017 13:25:18

%S 1,2,4,3,6,5,10,9,8,7,14,13,26,25,24,23,46,45,44,43,86,85,84,83,166,

%T 165,164,163,326,325,324,323,322,321,320,319,318,317,634,633,632,631,

%U 1262,1261,1260,1259,2518,2517,2516,2515,2514,2513,2512,2511,2510,2509,2508

%N a(1)=1, a(2)=2, for n > 2 if a(n-1) is prime, then a(n) = 2*a(n-1), otherwise a(n) = a(n-1) - 1.

%C For n >= 3, using Wilson's theorem, a(n) = a(n-1) + (-1)^r*gcd(a(n-1), W), where W = A038507(a(n-1) - 1), and r=1 if gcd(a(n-1), W) = 1 and r=0 otherwise. - _Vladimir Shevelev_, Aug 07 2009

%p a[1]:=1: a[2]:=2: for n from 3 to 60 do if isprime(a[n-1])=true then a[n]:=2*a[n-1] else a[n]:=a[n-1]-1 fi od: seq(a[n],n=1..60); # _Emeric Deutsch_, Apr 02 2006

%Y Cf. A006992, A055496, A080359, A104272, A106108, A132199. - _Vladimir Shevelev_, Aug 07 2009

%K nonn

%O 1,2

%A _Rodolfo Kurchan_, Mar 26 2006

%E More terms from _Emeric Deutsch_, Apr 02 2006

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 12:26 EDT 2024. Contains 371254 sequences. (Running on oeis4.)