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.

A257588 If n = abcd... in decimal, a(n) = |a^2 - b^2 + c^2 - d^2 + ...|.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 1, 0, 3, 8, 15, 24, 35, 48, 63, 80, 4, 3, 0, 5, 12, 21, 32, 45, 60, 77, 9, 8, 5, 0, 7, 16, 27, 40, 55, 72, 16, 15, 12, 7, 0, 9, 20, 33, 48, 65, 25, 24, 21, 16, 9, 0, 11, 24, 39, 56, 36, 35, 32, 27, 20, 11, 0, 13, 28, 45, 49
Offset: 0

Views

Author

N. J. A. Sloane, May 10 2015

Keywords

Comments

a(n) = 0 iff n is in A352535. - Bernard Schott, Jul 08 2022

Crossrefs

Programs

  • Haskell
    a257588 = abs . f 1 where
       f _ 0 = 0
       f s x = s * d ^ 2 + f (negate s) x' where (x', d) = divMod x 10
    -- Reinhard Zumkeller, May 10 2015
    
  • Maple
    a:= n-> (l-> abs(add(l[i]^2*(-1)^i, i=1..nops(l))))(convert(n, base, 10)):
    seq(a(n), n=0..70);  # Alois P. Heinz, Mar 24 2022
  • Mathematica
    Array[Abs@ Total@ MapIndexed[(2 Boole@ EvenQ[First[#2]] - 1) (#1^2) &, IntegerDigits[#]] &, 70] (* Michael De Vlieger, Feb 27 2022 *)
  • PARI
    a(n) = my(d=digits(n)); abs(sum(k=1, #d, (-1)^k*d[k]^2)); \\ Michel Marcus, Feb 27 2022
  • Python
    def A257588(n):
        return abs(sum((int(d)**2*(-1)**j for j,d in enumerate(str(n)))))
    # Chai Wah Wu, May 10 2015
    

A257587 If n = abcd... in decimal, a(n) = a^2 - b^2 + c^2 - d^2 + ...

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 1, 0, -3, -8, -15, -24, -35, -48, -63, -80, 4, 3, 0, -5, -12, -21, -32, -45, -60, -77, 9, 8, 5, 0, -7, -16, -27, -40, -55, -72, 16, 15, 12, 7, 0, -9, -20, -33, -48, -65, 25, 24, 21, 16, 9, 0, -11, -24, -39, -56, 36, 35, 32
Offset: 0

Views

Author

N. J. A. Sloane, May 10 2015

Keywords

Crossrefs

First 100 terms coincide with those of A177894, but then they diverge.
Cf. A257588, A257796, A352535 (indices of zeros).

Programs

  • Mathematica
    A257587[n_] := Total[-(-1)^Range[Max[IntegerLength[n], 1]]*IntegerDigits[n]^2];
    Array[A257587, 100, 0] (* Paolo Xausa, Mar 11 2024 *)
  • PARI
    a(n) = my(d=digits(n)); sum(k=1, #d, (-1)^(k+1)*d[k]^2); \\ Michel Marcus, Jul 12 2022
  • Python
    def a(n): return sum(int(d)**2*(-1)**i for i, d in enumerate(str(n)))
    print([a(n) for n in range(63)]) # Michael S. Branicky, Jul 11 2022
    

Formula

a(A352535(n)) = 0. - Bernard Schott, Jul 12 2022

A258482 Positive numbers n with concatenations n=x//y such that n=x^2-y^2.

Original entry on oeis.org

100, 147, 10000, 13467, 1000000, 1010100, 1016127, 1034187, 1140399, 1190475, 1216512, 1300624, 1334667, 1416767, 1484847, 1530900, 100000000, 102341547, 102661652, 116604399, 133346667, 159809775, 10000000000, 10101010100, 13333466667, 14848484847
Offset: 1

Views

Author

Pieter Post, May 31 2015

Keywords

Comments

The terms in this sequence have only an odd number of digits. If they would have an even number of digits both parts would have the same length. The maximum difference x^2 - y^2 would be (10^m-1)^2 - 1^2, which is (10^m-2)*10^m. But this is always less than (10^m-1)^2 + 1, so m never equals x^2 - y^2.
For example m=3: 999^2 - 1^2 < 999001.
The terms in this sequence all start with the digit '1'. Suppose they would start with the digit '2' (or more) the smallest possiblity of x^2 - y^2 would be (2*10^m)^2 - (10^m-1)^2 = 3*10^2*m + 2*10^m-1, but this is always more than 2*10^2*m + 10^3-1, so m never equals x^2 - y^2.
For example m=3: 2000^2 - 999^2 > 2000999.
This sequence has an infinite subsequence, since (10^m+(10^m+2)/3)*10^m+(2*10^m+1)/3 equals (10^m+(10^m+2)/3)^2 - ((2*10^m+1)/3)^2 for every positive m.
For example m=3: 1334667 = 1334^2 - 667^2.
This set is a subset of A113797.

Examples

			147 is a member, since 147 = 14^2 - 7^2.
1484847 is a member, since 1484847 = 1484^2- 847^2.
48 is a member of A113797 since 48 = |4^2 - 8^2|, but 48 is not equal to 4^2 - 8^2, so 48 is not a member of this sequence.
		

Crossrefs

Programs

  • PARI
    isok(n) = {d = digits(n); if (#d > 1, for (k=1, #d-1, vba = Vecrev(vector(k, i, d[i])); vbb = Vecrev(vector(#d-k, i, d[k+i])); da = sum(i=1, #vba, vba[i]*10^(i-1)); db = sum(i=1, #vbb, vbb[i]*10^(i-1)); if (da^2 - db^2 == n, return(1));););} \\ Michel Marcus, Jun 14 2015
  • Python
    for p in range(1, 7):
        for i in range(10**p, 10**(p + 1)):
            c = 10**(int((p - 1) / 2) + 1)
            a, b = i // c, i % c
            if i == a**2 - b**2:
                print(i, end=",")
    

Formula

n=x*10^d+y, where 10^(d-1)<=x<10^d and 0<=y<10^d and n=x^2-y^2.

Extensions

More terms from Giovanni Resta, Jun 14 2015

A259379 Numbers k of the form a - b + c, such that k^3 equals the decimal concatenation a//b//c and numbers k, b, and c have the same number of digits.

Original entry on oeis.org

155, 209, 274, 286, 287, 351, 364, 428, 573, 637, 715, 727, 846, 923, 1095, 1096, 2191, 8905, 18182, 18183, 81818, 81819, 326734, 336634, 663367, 673267, 2727273, 2727274, 4545454, 5454547, 7272727, 23529411, 23529412, 76470589
Offset: 1

Views

Author

Pieter Post, Jul 22 2015

Keywords

Comments

This sequence is infinite because it has several infinite subsequences. For example:
274, 326734, 332667334, 3..326..673..34 etc.;
364, 336634, 333666334, 3..36..63..34 etc.;
637, 663367, 666333667, 6..63..36..67 etc.;
727, 673267, 667332667, 6..673..326..67 etc.
Note that: 274 + 727 = 364 + 637 = 1001 and 326734 + 673267 = 336634 + 663367 = 1000001.
Many numbers come in pairs, like: (286, 287), (1095, 1096), (18182, 18183) but also bigger number (140017877, 140017878) and (859982123, 859982124).
140017877 + 859982124 = 140017878 + 859982123 = 1000000001.

Examples

			155^3 = 3723875 and 155 = 3 - 723 + 875.
715^3 = 365525875 and 715 = 365 - 525 + 875.
		

Crossrefs

Programs

  • PARI
    isok(n)=nb = #digits(n, 10); if (a = n^3 \ 10^(2*nb), c = n^3 % 10^nb; b = (n^3 - a*10^(2*nb))\10^nb; n^3 == (a-b+c)^3;); \\ Michel Marcus, Aug 05 2015
  • Python
    def modb(n,m):
        kk = 0
        l = 1
        while n > 0:
            na = n % m
            l += 1
            kk += ((-1)**l) * na
            n //= m
        return kk
    for n in range (100, 10**9):
        ll = len(str(n))
        if modb(n**3, 10**ll) == n:
            print(n, end=', ') # corrected by David Radcliffe, May 09 2025
    

A260193 Numbers k of the form abs(a - b + c - d) such that k^4 equals the concatenation of a//b//c//d and numbers k,b,c,d have the same number of digits.

Original entry on oeis.org

198, 220, 221, 287, 352, 364, 484, 562, 627, 638, 672, 715, 716, 780, 793, 858, 901, 1095, 1233, 2328, 8905, 18183, 39753, 60248, 85207, 336734, 2727274, 5893504, 8620777, 17769557, 52818678, 70710735, 76470590, 82230444, 101318734, 101636206, 104263158, 105262158, 109891110, 109942690, 117883117, 119722383, 120826541
Offset: 1

Views

Author

Pieter Post, Jul 22 2015

Keywords

Comments

Leading zeros in b, c, and d are allowed.
Many numbers come in pairs, like: (220, 221), (715, 716), (140017877, 140017878).
Some numbers are also member of A259379, for example: 287, 715, 1095 and also the pair (140017877, 140017878).

Examples

			198^4 = 1536953616 and 198 = abs (1 - 536 + 953 - 616 ).
8905^4 = 6288335365950625 and 8905 = abs (6288 - 3353 + 6595 - 0625 ).
		

Crossrefs

Programs

  • Mathematica
    test[n_] := Block[{L=IntegerLength@ n, v}, v = IntegerDigits[ n^4, 10^L]; Length@ v == 4 && Abs@ Total[ {1, -1, 1, -1} v] == n]; Select[Range[10^5], test] (* Giovanni Resta, Aug 12 2015 *)
  • Python
    def modb(n, m):
        kk = 0
        l = 1
        while n > 0:
            na = n % m
            l += 1
            kk += ((-1)**l) * na
            n //= m
        return abs(kk)
    for n in range (100, 10**9):
        ll = len(str(n))
        if modb(n**4, 10**ll) == n and n**4 >= 10**(ll*3):
             print (n, end=', ') # corrected by David Radcliffe, May 09 2025
Showing 1-5 of 5 results.