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-5 of 5 results.

A213407 First occurrence of n in A213381.

Original entry on oeis.org

2, 0, 3, 5, 4, 9, 8, 7, 12, 17, 594270126787, 21, 20, 13, 24, 29, 16, 23, 32, 19, 36, 41, 1356, 45, 38, 151, 51, 411, 994, 57, 56, 31, 60, 65, 52, 69, 71, 37, 72, 77, 490, 81, 80, 169, 84, 6125, 68, 1043, 92, 49, 99, 101, 304, 105, 104, 55, 111, 63, 73, 89, 116, 61, 120, 125, 78, 129, 188, 67, 93, 137, 97, 18349355, 140, 433
Offset: 0

Views

Author

Alex Ratushnyak, Jun 10 2012

Keywords

Examples

			Smallest n such that A213381(n)=9 is 17, so a(9)=17.
		

Crossrefs

Programs

  • C
    #include  // GCC -O3 -fopenmp
    #include   // 11 minutes
    #define SIZE 4096
    #define STEP 0x1000000
    long long first[SIZE];
    int main(int argc, char **argv)
    {
        unsigned long long a, i;
        for (a=0; a0; p=(p*p)%b, t>>=1) {
                if (t&1) r=(r*p)%b;
            }
            if (r
    				

Formula

a(n) = smallest k>n such that (-2)^k == n (mod k+2).

Extensions

Terms a(10) onward from Max Alekseyev, Jan 31 2014

A213382 Numbers n such that n^n mod (n + 2) = n.

Original entry on oeis.org

1, 4, 7, 13, 16, 19, 31, 37, 49, 55, 61, 67, 85, 91, 109, 121, 127, 139, 157, 175, 181, 193, 196, 199, 211, 217, 235, 247, 265, 289, 301, 307, 313, 319, 325, 337, 379, 391, 397, 409, 415, 445, 451, 469, 487, 499, 517, 535, 541, 571, 577, 589, 595, 631, 667, 679
Offset: 1

Views

Author

Alex Ratushnyak, Jun 10 2012

Keywords

Comments

Equivalently, numbers n such that (n^n+2)/(n+2) is an integer. Derek Orr, May 23 2014
It was conjectured that A176003 is a subsequence.
Terms that do not appear in A176003: 16, 61, 193, 196, 313, 397, 691, 729, 769 ...
The conjecture is correct: verify the cases 1 and 3, then it suffices to show that (3p-2)^(3p-2) = 3p-2 mod 3 and mod p. Mod 3 the congruence is 1^(3p-2) = 1, and mod p the congruence is (-2)^(3p-2) = -2 which is true by Fermat's little theorem. - Charles R Greathouse IV, Sep 12 2012
a(62) = 729 is the first number not congruent to 1 mod 3. - Derek Orr, May 23 2014

Examples

			A213381(n) = 7^7 mod 9 = 7, so 7 is in the sequence.
		

Crossrefs

Cf. A213381 : a(n) = n^n mod (n+2).
Cf. A176003.

Programs

  • Mathematica
    Select[Range[700],PowerMod[#,#,#+2]==#&] (* Harvey P. Dale, Oct 03 2015 *)
  • PARI
    is(n)=Mod(n,n+2)^n==n \\ Charles R Greathouse IV, Sep 12 2012
  • Python
    for n in range(999):
        x = n**n % (n+2)
        if x==n:
            print(n, end=", ")
    

A212844 a(n) = 2^(n+2) mod n.

Original entry on oeis.org

0, 0, 2, 0, 3, 4, 1, 0, 5, 6, 8, 4, 8, 2, 2, 0, 8, 4, 8, 4, 11, 16, 8, 16, 3, 16, 23, 8, 8, 16, 8, 0, 32, 16, 2, 4, 8, 16, 32, 24, 8, 4, 8, 20, 23, 16, 8, 16, 22, 46, 32, 12, 8, 4, 7, 16, 32, 16, 8, 4, 8, 16, 32, 0, 63, 58, 8, 64, 32, 36, 8, 40, 8, 16, 47
Offset: 1

Views

Author

Alex Ratushnyak, Jul 22 2012

Keywords

Comments

Also a(n) = x^x mod (x-2), where x = n+2.
Indices of 0's: 2^k, k>=0.
Indices of 1's: 7, 511, 713, 11023, 15553, 43873, 81079, 95263, 323593, 628153, 2275183, 6520633, 6955513, 7947583, 10817233, 12627943, 14223823, 15346303, 19852423, 27923663, 28529473, ...
Conjecture: every integer k >= 0 appears in a(n) at least once.
Each number below 69 appears at least once. Some large first occurrences: a(39806401) = 25, a(259274569) = 33, a(10571927) = 55, a(18039353) = 81. - Charles R Greathouse IV, Jul 21 2015

Examples

			a(3) = 2^5 mod 3 = 32 mod 3 = 2.
		

Crossrefs

Programs

  • Maple
    A212844 := proc(n)
        modp( 2&^ (n+2),n) ;
    end proc: # R. J. Mathar, Jul 24 2012
  • Mathematica
    Table[PowerMod[2, n+2, n], {n, 79}] (* Alonso del Arte, Jul 22 2012 *)
  • PARI
    A212844(n)=lift(Mod(2,n)^(n+2)) \\ M. F. Hasler, Jul 23 2012
  • Python
    for n in range(1,99):
        print(2**(n+2) % n, end=',')
    

Formula

a(n) = 2^(n+2) mod n.

A215747 a(n) = (-2)^n mod n.

Original entry on oeis.org

0, 0, 1, 0, 3, 4, 5, 0, 1, 4, 9, 4, 11, 4, 7, 0, 15, 10, 17, 16, 13, 4, 21, 16, 18, 4, 1, 16, 27, 4, 29, 0, 25, 4, 17, 28, 35, 4, 31, 16, 39, 22, 41, 16, 28, 4, 45, 16, 19, 24, 43, 16, 51, 28, 12, 32, 49, 4, 57, 16, 59, 4, 55, 0, 33, 64, 65, 16, 61, 44, 69, 64, 71, 4, 7
Offset: 1

Views

Author

Alex Ratushnyak, Aug 23 2012

Keywords

Comments

n^(n+2) mod (n+2) is essentially the same.
Indices of 0's: 2^k - 1, k>=0.
Indices of 1's: A006521 except the first term.
Indices of 3's: A015940.
Indices of 5's: 7, 133, 1517, 11761, ...
a(A000040(n)) = A000040(n)-2 = A040976(n).

Examples

			a(5) = (-2)^5 mod 5 = -32 mod 5 = 3.
		

Crossrefs

Programs

  • Maple
    a:= n-> (-2)&^n mod n:
    seq(a(n), n=1..100);  # Alois P. Heinz, Apr 08 2015
  • Mathematica
    a[n_]:=Mod[(-2)^n ,n]; Array[a,75] (* Stefano Spezia, Aug 25 2025 *)
  • Python
    for n in range(1, 333):
        print((-2)**n % n, end=',')

A213085 First occurrence of n in A212844.

Original entry on oeis.org

1, 7, 3, 5, 6, 9, 10, 55, 11, 3521, 246, 21, 52, 89969, 286, 60827, 22, 57481, 1501, 31937, 44, 2977, 49, 27, 40, 39806401, 110, 16777, 114, 214293, 24823, 247, 33, 259274569, 222, 2739, 70, 5993, 253217, 1062899, 72, 2007, 215, 85, 140, 4187, 50, 75
Offset: 0

Views

Author

Alex Ratushnyak, Jul 22 2012

Keywords

Comments

It is conjectured that every integer n>=0 appears in A212844 at least once, and therefore every a(n) is defined.
Indices of terms that are bigger than 2^32-1 and possibly undefined: 69, 91, 114, 127, 141, 157, 175, 181, 195, 301, 313, 339, ...
Indices 69, 127, 175, 181, 301, 313, 339, ... correspond to terms that either do not exist or are greater than 2*10^12. - Charles R Greathouse IV, Aug 13 2015

Examples

			Smallest n such that A212844(n)=1 is 7, so a(1)=7.
		

Crossrefs

Programs

  • PARI
    a(n) = my(k=1); while(lift(Mod(2, k)^(k+2)) != n, k++); k; \\ Michel Marcus, Aug 14 2015
Showing 1-5 of 5 results.