login
Final result (0 or 1) under iterations of {r mod (max prime p <= r)} starting at r = n.
10

%I #25 Jun 12 2023 09:48:19

%S 1,0,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,0,0,1,0,1,0,0,

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

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

%N Final result (0 or 1) under iterations of {r mod (max prime p <= r)} starting at r = n.

%C Previous name: Find r1 = n modulo p1, where p1 is the largest prime not greater than n. Then find r2 = r1 modulo p2, where p2 is the largest prime not greater than r1. Repeat until the last r is either 1 or 0; a(n) is the last r value.

%C The sequence has the form of blocks of 0's between 1's. See sequence A121560 for the lengths of the blocks of zeros.

%C The function r mod (max prime p <= r), which appears in the definition, equals r - (max prime p <= r) = A064722(r), because p <= r < 2*p by Bertrand's postulate, where p is the largest prime less than or equal to r. - _Pontus von Brömssen_, Jul 31 2022

%H Kerry Mitchell, <a href="/A121559/b121559.txt">Table of n, a(n) for n = 1..7919</a>

%F a(p) = 0 when p is prime. - _Michel Marcus_, Aug 22 2014

%F a(n) = A175077(n+1) - 1. - _Pontus von Brömssen_, Jul 31 2022

%F a(n) = A200947(n) mod 2. - _Alois P. Heinz_, Jun 12 2023

%e a(9) = 0 because 7 is the largest prime not larger than 9, 9 mod 7 = 2, 2 is the largest prime not greater than 2 and 2 mod 2 = 0.

%t Abs[Table[FixedPoint[Mod[#,NextPrime[#+1,-1]]&,n],{n,110}]] (* _Harvey P. Dale_, Mar 17 2023 *)

%o (PARI) a(n) = if (n==1, return (1)); na = n; while((nb = (na % precprime(na))) > 1, na = nb); return(nb); \\ _Michel Marcus_, Aug 22 2014

%Y Cf. A007917 and A064722 (both for the iterations).

%Y Cf. A121560, A121561, A121562, A175077, A200947.

%K easy,nonn

%O 1,1

%A _Kerry Mitchell_, Aug 07 2006

%E New name from _Michel Marcus_, Aug 22 2014