

A121559


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


7



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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

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.
The sequence has the form of blocks of 0's between 1's. See sequence A121560 for the lengths of the blocks of zeros.


LINKS

Kerry Mitchell, Table of n, a(n) for n = 1..7919


FORMULA

a(p) = 0 when p is prime.  Michel Marcus, Aug 22 2014


EXAMPLE

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.


PROG

(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


CROSSREFS

Cf. A007917 and A064722 (both for the iterations).
Cf. A121560, A121561, A121562.
Sequence in context: A244612 A105367 A065043 * A004641 A100810 A174889
Adjacent sequences: A121556 A121557 A121558 * A121560 A121561 A121562


KEYWORD

easy,nonn,changed


AUTHOR

Kerry Mitchell, Aug 07 2006


EXTENSIONS

New name from Michel Marcus, Aug 22 2014


STATUS

approved



