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.

Previous Showing 11-20 of 21 results. Next

A225721 Starting with x = n, the number of iterations of x := 2x - 1 until x is prime, or -1 if no prime exists.

Original entry on oeis.org

-1, 0, 0, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 3, 0, 6, 1, 1, 0, 1, 2, 2, 1, 2, 0, 1, 0, 8, 3, 1, 2, 1, 0, 2, 5, 1, 0, 1, 0, 2, 1, 2, 0, 583, 1, 2, 1, 1, 0, 1, 1, 4, 1, 2, 0, 5, 0, 4, 7, 1, 2, 1, 0, 2, 1, 1, 0, 3, 0, 2, 1, 1, 4, 3, 0, 2, 3, 1, 0, 1, 2, 4
Offset: 1

Views

Author

Keywords

Comments

This appears to be a shifted variant of A040076. - R. J. Mathar, May 28 2013
If n is prime, then a(n) = 0. If the sequence never reaches a prime number (for n = 1) or the prime number has more than 1000 digits, -1 is used instead. There are 22 such numbers for n < 10000.

Examples

			For a(20), the trajectory is 20->39->77->153->305->609->1217, a prime number. That required 6 steps, so a(20)=6.
		

Crossrefs

Cf. A050921 (primes obtained).
Cf. A040081, A038699, A050412, A052333, A046069 (related to the Riesel problem).
Cf. A000668, A000043, A065341 (Mersenne primes), A000079 (powers of 2).
Cf. A007770 (happy numbers), A031177 (unhappy numbers).
Cf. A037274 (home primes), A037271 (steps), A037272, A037272.

Programs

  • R
    y=as.bigz(rep(0,500)); ys=rep(0,500);
    for(i in 1:500) { n=as.bigz(i); k=0;
        while(isprime(n)==0 & ndig(n)<1000 & k<5000) { k=k+1; n=2*n-1 }
        if(ndig(n)>=1000 | k>=5000) { ys[i]=-1; y[i]=-1;
        } else {ys[i]=k; y[i]=n; }
    }

A362026 Smallest unhappy number in base A161874(n).

Original entry on oeis.org

3, 7, 3, 5, 20, 3, 12, 3, 3, 14, 3, 3, 3, 3, 3, 3, 23, 3, 23, 3, 261, 6, 12
Offset: 1

Views

Author

Lucas A. Brown, Apr 26 2023

Keywords

Comments

This sequence is the list of least unhappy numbers (A161872) with all terms < 3 removed.

Examples

			The first term in this sequence corresponds to base 16.  In base 16, 2 is happy because the sequence it generates is 2 -> 4 -> (1,0) -> 1, while 3 is unhappy because the sequence it generates is 3 -> 9 -> (5,1) -> (1,10) -> (6,5) -> (3,13) -> (11,2) -> (7,13) -> (13,10) -> (1,0,13) -> (10,10) -> (12,8) -> (13,0) -> (10,9) -> (11,5) -> (9,2) -> (5,5) -> (3,2) -> (0,13) -> (10,9) -> ..., which repeats with period 6.
		

Crossrefs

Formula

a(n) = A161872(A161874(n)).

A193565 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 4.

Original entry on oeis.org

2, 4, 11, 78, 87, 101, 110, 113, 131, 168, 179, 186, 197, 200, 249, 257, 259, 275, 294, 295, 311, 429, 449, 467, 476, 492, 494, 527, 529, 559, 567, 572, 576, 592, 595, 618, 647, 657, 674, 675, 681, 708, 719, 725, 746, 752, 756, 764, 765, 779, 780, 791, 797
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			7899 is such a number of height 6 because it enters the cycle at 4 in 6 steps: 7899 -> 275 -> 78 -> 113 -> 11 -> 2 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=4 then a:=[op(a),i] fi; od: print(op(a));

A193566 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 16.

Original entry on oeis.org

15, 16, 26, 40, 51, 62, 69, 88, 96, 105, 117, 128, 134, 143, 150, 155, 156, 165, 171, 182, 206, 218, 237, 247, 260, 273, 274, 278, 279, 281, 287, 297, 314, 327, 341, 372, 399, 400, 413, 427, 431, 448, 458, 466, 472, 484, 485, 501, 510, 515, 516, 548, 551
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			466 is such a number of height 8 because it enters the cycle at 16 in 8 steps: 466 -> 88 -> 128 -> 69 -> 117 -> 51 -> 26 -> 40 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=16 then a:=[op(a),i] fi; od: print(op(a));

A193567 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 37.

Original entry on oeis.org

3, 9, 18, 30, 33, 37, 39, 47, 56, 57, 59, 61, 65, 74, 75, 81, 90, 93, 95, 106, 108, 111, 114, 122, 125, 137, 138, 141, 144, 148, 152, 157, 158, 160, 173, 175, 178, 180, 183, 184, 185, 187, 212, 215, 221, 225, 227, 246, 251, 252, 256, 258, 264, 265, 272, 285
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			568 is such a number of height 7 because it enters the cycle at 37 in 7 steps: 568 -> 125 -> 30 -> 9 -> 81 -> 65 -> 61 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=37 then a:=[op(a),i] fi; od: print(op(a));

A193568 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 58.

Original entry on oeis.org

38, 58, 73, 83, 116, 119, 161, 166, 191, 235, 253, 299, 307, 308, 325, 352, 357, 370, 375, 380, 468, 486, 489, 498, 523, 532, 537, 573, 611, 616, 648, 661, 679, 684, 697, 703, 730, 735, 753, 769, 796, 803, 830, 846, 849, 864, 894, 911, 929, 948, 967, 976
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			468 is such a number of height 4 because it enters the cycle at 58 in 4 steps: 468 -> 116 -> 38 -> 73 -> 58 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=58 then a:=[op(a),i] fi; od: print(op(a));

A193569 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 89.

Original entry on oeis.org

5, 6, 8, 12, 14, 17, 21, 22, 25, 27, 29, 34, 35, 36, 41, 43, 45, 46, 48, 50, 52, 53, 54, 55, 60, 63, 64, 66, 67, 71, 72, 76, 80, 84, 85, 89, 92, 99, 102, 104, 107, 112, 115, 118, 120, 121, 123, 124, 126, 127, 132, 135, 136, 140, 142, 146, 147, 151
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			15999 is such a number of height 12 because it enters the cycle at 89 in 12 steps: 15999 -> 269 -> 121 -> 6 -> 36 -> 45 -> 41 -> 17 -> 50 -> 25 -> 29 -> 85 -> 89 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=89 then a:=[op(a),i] fi; od: print(op(a));

A193570 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 145.

Original entry on oeis.org

77, 98, 145, 149, 194, 238, 283, 289, 298, 328, 358, 382, 385, 419, 456, 465, 491, 538, 546, 564, 583, 645, 654, 678, 687, 707, 768, 770, 786, 789, 798, 809, 823, 829, 832, 835, 853, 867, 876, 879, 890, 892, 897, 908, 914, 928, 941, 978, 980, 982, 987
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			25889 is such a number of height 4 because it enters the cycle at 145 in 4 steps: 25889 -> 238 -> 77 -> 98 -> 145 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=145 then a:=[op(a),i] fi; od: print(op(a));

A193571 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 42.

Original entry on oeis.org

42, 154, 389, 398, 415, 451, 514, 541, 839, 893, 938, 983, 1045, 1054, 1126, 1162, 1216, 1261, 1344, 1405, 1434, 1443, 1450, 1504, 1540, 1588, 1612, 1621, 1669, 1696, 1858, 1885, 1966, 2116, 2161, 2235, 2253, 2325, 2352, 2523, 2532, 2611, 3089, 3098, 3144
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			389 is such a number of height 2 because it enters the cycle at 42 in 2 steps: 389 -> 154 -> 42 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=42 then a:=[op(a),i] fi; od: print(op(a));

A193572 Unhappy numbers which enter the cycle (4, 16, 37, 58, 89, 145, 42, 20) at 20.

Original entry on oeis.org

20, 24, 204, 224, 240, 242, 402, 420, 422, 1133, 1313, 1331, 2004, 2024, 2040, 2042, 2204, 2240, 2400, 2402, 2420, 3113, 3131, 3311, 4002, 4020, 4022, 4200, 4202, 4220, 4899, 4989, 4998, 5779, 5797, 5977, 7579, 7597, 7759, 7795, 7957, 7975, 8499, 8949, 8994
Offset: 1

Views

Author

Martin Renner, Jul 31 2011

Keywords

Examples

			4899 is such a number of height 3 because it enters the cycle at 20 in 3 steps: 4899 -> 242 -> 24 -> 20 -> 4 -> 16 -> 37 -> 58 -> 89 -> 145 -> 42 -> 20 -> ...
		

Crossrefs

Programs

  • Maple
    S:=proc(n) local Q,k,N,z; Q:=[n]; for k from 1 do N:=convert(Q[k],base,10); z:=sum(N['i']^2,'i'=1..nops(N)); if not member(z,Q) then Q:=[op(Q),z]; else Q:=[op(Q),z]; break; fi; od; return Q; end:
    a:=[]: for i from 1 while nops(a)<30 do Q:=S(i); A:=Q[nops(Q)]; if A=20 then a:=[op(a),i] fi; od: print(op(a));
Previous Showing 11-20 of 21 results. Next