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!)
A338530 a(n) = (prime(n) + a(n-1)) mod prime(n-1), a(1) = 1. 0

%I #14 Dec 23 2020 19:51:56

%S 1,0,2,4,1,3,7,9,13,19,21,27,31,33,37,43,49,51,57,61,63,69,73,79,87,

%T 91,93,97,99,103,4,8,14,16,26,28,34,40,44,50,56,58,68,70,74,76,88,100,

%U 104,106,110,116,118,128,134,140,146,148,154,158,160,170,184

%N a(n) = (prime(n) + a(n-1)) mod prime(n-1), a(1) = 1.

%e a(2) = (prime(2) + a(1)) mod prime(1) = ( 3 + 1) mod 2 = 0,

%e a(3) = (prime(3) + a(2)) mod prime(2) = ( 5 + 0) mod 3 = 2,

%e a(4) = (prime(4) + a(3)) mod prime(3) = ( 7 + 2) mod 5 = 4,

%e a(5) = (prime(5) + a(4)) mod prime(4) = (11 + 4) mod 7 = 1,

%e a(6) = (prime(6) + a(5)) mod prime(5) = (13 + 1) mod 11 = 3.

%t Nest[Append[#1, Mod[(Prime@ #2 + #1[[-1]]), Prime[#2 - 1]]] & @@ {#, Length[#] + 1} &, {1}, 62] (* _Michael De Vlieger_, Nov 05 2020 *)

%o (Ruby) require 'prime'

%o count = 50

%o primes = Prime.first(count+1)

%o values = [1]

%o count.times { |n| values << (primes[n+1] + values[-1]) % primes[n] }

%o p values

%o (PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; for (n=2, nn, va[n] = (prime(n) + va[n-1]) % prime(n-1);); va;} \\ _Michel Marcus_, Nov 05 2020

%Y Cf. A000040.

%K nonn

%O 1,3

%A _Simon Strandgaard_, Nov 01 2020

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 April 19 02:03 EDT 2024. Contains 371782 sequences. (Running on oeis4.)