cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A322973 Lexicographically earliest such sequence a that a(i) = a(j) => f(i) = f(j) for all i, j, where f(1) = 0, f(n) = -1 if n is an odd prime, and f(n) = A006370(n) for all other numbers.

Original entry on oeis.org

1, 2, 3, 4, 3, 5, 3, 6, 7, 8, 3, 9, 3, 10, 11, 12, 3, 13, 3, 14, 15, 16, 3, 17, 18, 19, 20, 21, 3, 22, 3, 23, 24, 25, 26, 27, 3, 28, 29, 30, 3, 31, 3, 32, 33, 34, 3, 35, 36, 37, 38, 39, 3, 40, 41, 7, 42, 43, 3, 44, 3, 45, 46, 47, 48, 49, 3, 50, 51, 52, 3, 53, 3, 54, 55, 56, 57, 58, 3, 59, 60, 61, 3, 62, 63, 64, 65, 66, 3, 67, 68, 11, 69, 70, 71, 72, 3, 73, 74, 75, 3, 76, 3
Offset: 1

Views

Author

Antti Karttunen, Jan 05 2019

Keywords

Comments

For all i, j: a(i) = a(j) => A274472(i) = A274472(j).

Crossrefs

See the crossrefs section in A322809 for a list of similarly constructed filter sequences.

Programs

  • PARI
    up_to = 65537;
    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; };
    A006370(n) = if(n%2, 3*n+1, n/2);
    A322973aux(n) = if(1==n,0,if((n>2)&&isprime(n),-1,A006370(n)));
    v322973 = rgs_transform(vector(up_to,n,A322973aux(n)));
    A322973(n) = v322973[n];

A280929 Number of steps required to reach the first prime when starting from n in the Collatz (or '3x+1') problem.

Original entry on oeis.org

2, 3, 2, 1, 4, 1, 2, 2, 3, 1, 2, 2, 4, 1, 2, 3, 3, 4, 2, 2, 6, 1, 4, 3, 3, 1, 2, 2, 4, 3, 2, 4, 6, 1, 2, 5, 5, 1, 2, 3, 3, 7, 8, 2, 4, 1, 2, 4, 3, 4, 6, 2, 6, 3, 2, 3, 3, 1, 2, 4, 4, 1, 17, 5, 6, 7, 2, 2, 5, 3, 2, 6, 5, 1, 2, 2, 4, 3, 4, 4, 3, 1, 6, 8, 8, 1, 2, 3, 3, 5, 2, 2, 6, 1, 15, 5, 3, 4, 2, 5
Offset: 1

Views

Author

Dmitry Kamenetsky, Jan 11 2017

Keywords

Comments

If n=p*2^k, where k>0 and p is some prime then a(n)=k.
If n is odd then a(n)=a(3n+1)+1.
If n is even then a(n)=1 or a(n)=a(n/2)+1.
If n is composite then a(n)=A274472(n).

Examples

			The Collatz iteration for 33 is 100, 50, 25, 76, 38, 19, 58, 29, ... 1. The first prime (19) is reached after 6 steps, so a(33)=6.
		

Crossrefs

Showing 1-2 of 2 results.