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.

A139566 a(n) is the sum of squares of digits of a(n-1); a(1)=15.

Original entry on oeis.org

15, 26, 40, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37, 58, 89, 145, 42, 20, 4, 16, 37
Offset: 1

Views

Author

Robert Gornall (rob(AT)khobbits.net), Jun 11 2008

Keywords

Crossrefs

Cf. A003132 (the iterated map), A003621, A039943, A099645, A031176, A007770, A000216 (starting with 2), A000218 (starting with 3), A080709 (starting with 4), A000221 (starting with 5), A008460 (starting with 6), A008462 (starting with 8), A008463 (starting with 9), A122065 (starting with 74169). - M. F. Hasler, May 24 2009

Programs

  • Mathematica
    a = {15}; Do[AppendTo[a, Plus @@ (IntegerDigits[a[[ -1]]]^2)], {70}]; a (* Stefan Steinerberger, Jun 14 2008 *)
    NestList[Total[IntegerDigits[#]^2] &, 15, 70] (* or *) PadRight[ {15,26,40},70,{42,20,4,16,37,58,89,145}](* Harvey P. Dale, Jan 28 2013 *)
  • PARI
    /* to check the given terms */
    a=[/* paste the terms here */]; a==vector(#a,n,k=if(n>1,A003132(k),15))
    /* to check the following code, use: a==vector(99,n,A139566(n)) */
    A139566(n)=[15,26,40,16,37,58,89,145,42,20,4][if(n>11,(n-4)%8+4,n)] \\ (End)
    
  • PARI
    Vec(x*(36*x^10+6*x^9-27*x^8-145*x^7-89*x^6-58*x^5-37*x^4-16*x^3 -40*x^2-26*x-15)/((x-1)*(x+1)*(x^2+1)*(x^4+1)) + O(x^70)) \\ Colin Barker, Aug 24 2015

Formula

Eventually periodic with period 8.
a(n) = A008463(n) for n > 4. - M. F. Hasler, May 24 2009
a(n) = a(n-8) for n > 11. - Colin Barker, Aug 24 2015
G.f.: x*(36*x^10 + 6*x^9 - 27*x^8 - 145*x^7 - 89*x^6 - 58*x^5 - 37*x^4 - 16*x^3 - 40*x^2 - 26*x - 15) / ((x-1)*(x+1)*(x^2+1)*(x^4+1)). - Colin Barker, Aug 24 2015

Extensions

More terms from Stefan Steinerberger, Jun 14 2008
Terms checked, using the given PARI code, by M. F. Hasler, May 24 2009
Minor edits and starting value added in name by M. F. Hasler, Apr 27 2018

A051692 a(n) is twice the smallest k such that A051686(k) = prime(n).

Original entry on oeis.org

2, 4, 38, 16, 170, 72, 446, 58, 512, 282, 178, 148, 758, 856, 836, 1592, 1712, 388, 1906, 2606, 2034, 1918, 656, 5924, 1648, 13082, 652, 1514, 2758, 10922, 5758, 18986, 6764, 10570, 20918, 4936, 8188, 5842, 4094, 30710, 15212, 11482, 57932, 14626, 5624, 36232, 16018, 57874
Offset: 1

Views

Author

Keywords

Comments

The sequence is based on the first 50000 terms of A051686, in which the first 54 primes (2,3,...,251) appear along with 19 others, the largest of which is A051686(37976) = 823.

Examples

			The 25th term in this sequence is 1648. This means that prime(25) = 97 arises in A051686 as A051686(1648/2) = A051686(824). Thus, 1648 is the first term in the sequence {..., 2k, ...} = {1648, 1798, 4108, ...} with the property that 2k*97 + 1 = 194k + 1 is also a prime, moreover the smallest one: 159857.
		

Crossrefs

Programs

  • Mathematica
    s[n_] := Module[{p = 2, i = 1}, While[! PrimeQ[2*n*p + 1], p = NextPrime[p]; i++]; i]; seq[len_] := Module[{v = Table[0, {len}], c = 0, k = 1, i}, While[c < len, i = s[k]; If[i <= len && v[[i]] == 0, v[[i]] = 2*k; c++]; k++]; v]; seq[48] (* Amiram Eldar, Feb 28 2025 *)
  • PARI
    a051686(n) = my(p=2); while(!isprime(2*n*p+1), p = nextprime(p+1)); p;
    a(n) = my(k=1); while(a051686(k) != prime(n), k++); 2*k; \\ Michel Marcus, Jun 08 2018
    
  • PARI
    s(n) = {my(p = 2, i = 1); while(!isprime(2*n*p + 1), p = nextprime(p+1); i++); i;}
    list(len) = {my(v = vector(len), c = 0, k = 1, i); while(c < len, i = s(k); if(i <= len && v[i] == 0, v[i] = 2*k; c++); k++); v;} \\ Amiram Eldar, Feb 28 2025

Extensions

More terms from Michel Marcus, Jun 08 2018
Showing 1-2 of 2 results.