login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A072968 Least k>0 such that the last digit of (n+k)^(n+k) is the same as the last digit of n^n. 0

%I #18 Oct 16 2021 13:48:30

%S 10,16,14,2,10,2,6,4,10,10,10,2,14,2,10,8,6,4,10,10,10,16,14,2,10,2,6,

%T 4,10,10,10,2,14,2,10,8,6,4,10,10,10,16,14,2,10,2,6,4,10,10,10,2,14,2,

%U 10,8,6,4,10,10,10,16,14,2,10,2,6,4,10,10,10,2,14,2,10,8,6,4,10,10,10

%N Least k>0 such that the last digit of (n+k)^(n+k) is the same as the last digit of n^n.

%H <a href="/index/Rec#order_20">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1).

%F a(n) is periodic with period (10, 16, 14, 2, 10, 2, 6, 4, 10, 10, 10, 2, 14, 2, 10, 8, 6, 4, 10, 10, 10) of length 20

%t ld[n_]:=Module[{ldn=Mod[n^n,10],k=1},While[Mod[(n+k)^(n+k),10] != ldn,k++];k]; Array[ld, 90] (* _Harvey P. Dale_, Sep 07 2012 *)

%t LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},{10, 16, 14, 2, 10, 2, 6, 4, 10, 10, 10, 2, 14, 2, 10, 8, 6, 4, 10, 10},81] (* _Ray Chandler_, Aug 26 2015 *)

%o (PARI) a(n)=if(n<0,0,s=1; while(abs((n+s)^(n+s)%10-n^n%10)>0,s++); s)

%o (Python)

%o def a(n):

%o k, target = 1, pow(n, n, 10)

%o while pow(n+k, n+k, 10) != target: k += 1

%o return k

%o print([a(n) for n in range(1, 82)]) # _Michael S. Branicky_, Oct 16 2021

%K base,easy,nonn

%O 1,1

%A _Benoit Cloitre_, Aug 13 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 10:31 EDT 2024. Contains 371240 sequences. (Running on oeis4.)