login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A319704
Filter sequence which records for primes their residue modulo 4, and for all other numbers assigns a unique number.
11
1, 2, 3, 4, 5, 6, 3, 7, 8, 9, 3, 10, 5, 11, 12, 13, 5, 14, 3, 15, 16, 17, 3, 18, 19, 20, 21, 22, 5, 23, 3, 24, 25, 26, 27, 28, 5, 29, 30, 31, 5, 32, 3, 33, 34, 35, 3, 36, 37, 38, 39, 40, 5, 41, 42, 43, 44, 45, 3, 46, 5, 47, 48, 49, 50, 51, 3, 52, 53, 54, 3, 55, 5, 56, 57, 58, 59, 60, 3, 61, 62, 63, 3, 64, 65, 66, 67, 68, 5, 69, 70, 71, 72, 73, 74, 75, 5, 76, 77, 78, 5, 79, 3
OFFSET
1,2
COMMENTS
Restricted growth sequence transform of function f defined as f(n) = A010873(n) when n is a prime, otherwise -n.
For all i, j:
a(i) = a(j) => A010873(i) = A010873(j),
a(i) = a(j) => A305801(i) = A305801(j),
a(i) = a(j) => A319714(i) = A319714(j).
LINKS
PROG
(PARI)
up_to = 100000;
rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om, invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om, invec[i], i); outvec[i] = u; u++ )); outvec; };
A319704aux(n) = if(isprime(n), -(n%4), n);
v319704 = rgs_transform(vector(up_to, n, A319704aux(n)));
A319704(n) = v319704[n];
CROSSREFS
Cf. A002145 (positions of 3's), A002144 (positions of 5's).
Cf. also A319350, A319705, A319706.
Sequence in context: A319994 A319714 A320004 * A331304 A343721 A070675
KEYWORD
nonn
AUTHOR
Antti Karttunen, Sep 26 2018
STATUS
approved